MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ storage_element_size()

MAYAFLUX_API size_t MayaFlux::Kakshya::storage_element_size ( ImageFormat  format)

Byte width of the DataVariant element backing a given ImageFormat.

Returns 1 for uint8 storage, 2 for uint16, 4 for float. Defaults to 1 for any format without an explicit mapping.

Size determines the alternative unambiguously only because DataVariant's pixel alternatives are uint8, uint16, and float: 4 means float, not uint32. Half-float formats return 2, since the uint16 bits are the IEEE-754 binary16 encoding rather than a UNORM value; consumers needing the decoded magnitude must check is_float_format().

Parameters
formatPixel format.
Returns
Element size in bytes.

Definition at line 66 of file PixelStorage.cpp.

67{
68 switch (format) {
69 case ImageFormat::R8:
70 case ImageFormat::RG8:
71 case ImageFormat::RGB8:
72 case ImageFormat::RGBA8:
73 case ImageFormat::RGBA8_SRGB:
74 case ImageFormat::BGRA8:
75 case ImageFormat::BGRA8_SRGB:
76 case ImageFormat::DEPTH24:
77 case ImageFormat::DEPTH24_STENCIL8:
78 return 1;
79
80 case ImageFormat::R16:
81 case ImageFormat::RG16:
82 case ImageFormat::RGBA16:
83 case ImageFormat::R16F:
84 case ImageFormat::RG16F:
85 case ImageFormat::RGBA16F:
86 case ImageFormat::DEPTH16:
87 return 2;
88
89 case ImageFormat::R32F:
90 case ImageFormat::RG32F:
91 case ImageFormat::RGBA32F:
92 case ImageFormat::DEPTH32F:
93 return 4;
94
95 default:
96 return 1;
97 }
98}
bool format

References BGRA8, BGRA8_SRGB, DEPTH16, DEPTH24, DEPTH24_STENCIL8, DEPTH32F, format, R16, R16F, R32F, R8, RG16, RG16F, RG32F, RG8, RGB8, RGBA16, RGBA16F, RGBA32F, RGBA8, and RGBA8_SRGB.

Referenced by blend_frames(), format_has_variant_storage(), MayaFlux::Kakshya::VideoStreamContainer::get_frame_typed(), MayaFlux::Kakshya::VideoStreamContainer::get_frames_impl(), MayaFlux::Kakshya::VideoStreamContainer::get_region_data(), MayaFlux::Kakshya::VideoStreamContainer::get_value_impl(), make_empty_storage(), MayaFlux::Kakshya::VideoStreamContainer::set_value_impl(), MayaFlux::Kakshya::TextureContainer::value_element_type(), and MayaFlux::Kakshya::VideoStreamContainer::value_element_type().

+ Here is the caller graph for this function: