| 4357 | |
| 4358 | |
| 4359 | static 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 |
no test coverage detected