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

Function ParseEXRHeader

third-party/tinyexr/tinyexr.h:4359–4706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4357
4358
4359static int ParseEXRHeader(HeaderInfo *info, bool *empty_header,
4360 const EXRVersion *version, std::string *err,
4361 const unsigned char *buf, size_t size) {
4362 const char *marker = reinterpret_cast<const char *>(&buf[0]);
4363
4364 if (empty_header) {
4365 (*empty_header) = false;
4366 }
4367
4368 if (version->multipart) {
4369 if (size > 0 && marker[0] == '\0') {
4370 // End of header list.
4371 if (empty_header) {
4372 (*empty_header) = true;
4373 }
4374 return TINYEXR_SUCCESS;
4375 }
4376 }
4377
4378 // According to the spec, the header of every OpenEXR file must contain at
4379 // least the following attributes:
4380 //
4381 // channels chlist
4382 // compression compression
4383 // dataWindow box2i
4384 // displayWindow box2i
4385 // lineOrder lineOrder
4386 // pixelAspectRatio float
4387 // screenWindowCenter v2f
4388 // screenWindowWidth float
4389 bool has_channels = false;
4390 bool has_compression = false;
4391 bool has_data_window = false;
4392 bool has_display_window = false;
4393 bool has_line_order = false;
4394 bool has_pixel_aspect_ratio = false;
4395 bool has_screen_window_center = false;
4396 bool has_screen_window_width = false;
4397 bool has_name = false;
4398 bool has_type = false;
4399
4400 info->name.clear();
4401 info->type.clear();
4402
4403 info->data_window.min_x = 0;
4404 info->data_window.min_y = 0;
4405 info->data_window.max_x = 0;
4406 info->data_window.max_y = 0;
4407 info->line_order = 0; // @fixme
4408 info->display_window.min_x = 0;
4409 info->display_window.min_y = 0;
4410 info->display_window.max_x = 0;
4411 info->display_window.max_y = 0;
4412 info->screen_window_center[0] = 0.0f;
4413 info->screen_window_center[1] = 0.0f;
4414 info->screen_window_width = -1.0f;
4415 info->pixel_aspect_ratio = -1.0f;
4416

Callers 2

ParseEXRHeaderFromMemoryFunction · 0.85

Calls 10

ReadAttributeFunction · 0.85
swap4Function · 0.85
ReadChannelInfoFunction · 0.85
compareMethod · 0.80
maxFunction · 0.50
clearMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected