MCPcopy Create free account
hub / github.com/OpenPathGuidingLibrary/openpgl / ComputeChannelLayout

Function ComputeChannelLayout

third-party/tinyexr/tinyexr.h:4248–4274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4246}
4247
4248static bool ComputeChannelLayout(std::vector<size_t> *channel_offset_list,
4249 int *pixel_data_size, size_t *channel_offset,
4250 int num_channels,
4251 const EXRChannelInfo *channels) {
4252 channel_offset_list->resize(static_cast<size_t>(num_channels));
4253
4254 (*pixel_data_size) = 0;
4255 (*channel_offset) = 0;
4256
4257 for (size_t c = 0; c < static_cast<size_t>(num_channels); c++) {
4258 (*channel_offset_list)[c] = (*channel_offset);
4259 if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) {
4260 (*pixel_data_size) += sizeof(unsigned short);
4261 (*channel_offset) += sizeof(unsigned short);
4262 } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {
4263 (*pixel_data_size) += sizeof(float);
4264 (*channel_offset) += sizeof(float);
4265 } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) {
4266 (*pixel_data_size) += sizeof(unsigned int);
4267 (*channel_offset) += sizeof(unsigned int);
4268 } else {
4269 // ???
4270 return false;
4271 }
4272 }
4273 return true;
4274}
4275
4276// TODO: Simply return nullptr when failed to allocate?
4277static unsigned char **AllocateImage(int num_channels,

Callers 1

DecodeChunkFunction · 0.85

Calls 1

resizeMethod · 0.45

Tested by

no test coverage detected