MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / ComputeChannelLayout

Function ComputeChannelLayout

Source/ThirdParty/tinyexr.h:5750–5776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5748}
5749
5750static bool ComputeChannelLayout(std::vector<size_t> *channel_offset_list,
5751 int *pixel_data_size, size_t *channel_offset,
5752 int num_channels,
5753 const EXRChannelInfo *channels) {
5754 channel_offset_list->resize(static_cast<size_t>(num_channels));
5755
5756 (*pixel_data_size) = 0;
5757 (*channel_offset) = 0;
5758
5759 for (size_t c = 0; c < static_cast<size_t>(num_channels); c++) {
5760 (*channel_offset_list)[c] = (*channel_offset);
5761 if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) {
5762 (*pixel_data_size) += sizeof(unsigned short);
5763 (*channel_offset) += sizeof(unsigned short);
5764 } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {
5765 (*pixel_data_size) += sizeof(float);
5766 (*channel_offset) += sizeof(float);
5767 } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) {
5768 (*pixel_data_size) += sizeof(unsigned int);
5769 (*channel_offset) += sizeof(unsigned int);
5770 } else {
5771 // ???
5772 return false;
5773 }
5774 }
5775 return true;
5776}
5777
5778// TODO: Simply return nullptr when failed to allocate?
5779static unsigned char **AllocateImage(int num_channels,

Callers 1

DecodeChunkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected