| 5711 | } |
| 5712 | |
| 5713 | static bool DecodeTiledPixelData( |
| 5714 | unsigned char **out_images, int *width, int *height, |
| 5715 | const int *requested_pixel_types, const unsigned char *data_ptr, |
| 5716 | size_t data_len, int compression_type, int data_width, |
| 5717 | int data_height, int tile_offset_x, int tile_offset_y, int tile_size_x, |
| 5718 | int tile_size_y, size_t pixel_data_size, size_t num_attributes, |
| 5719 | const EXRAttribute *attributes, size_t num_channels, |
| 5720 | const EXRChannelInfo *channels, |
| 5721 | const std::vector<size_t> &channel_offset_list) { |
| 5722 | // Here, data_width and data_height are the dimensions of the current (sub)level. |
| 5723 | if (tile_size_x * tile_offset_x > data_width || |
| 5724 | tile_size_y * tile_offset_y > data_height) { |
| 5725 | return false; |
| 5726 | } |
| 5727 | |
| 5728 | // Compute actual image size in a tile. |
| 5729 | if ((tile_offset_x + 1) * tile_size_x >= data_width) { |
| 5730 | (*width) = data_width - (tile_offset_x * tile_size_x); |
| 5731 | } else { |
| 5732 | (*width) = tile_size_x; |
| 5733 | } |
| 5734 | |
| 5735 | if ((tile_offset_y + 1) * tile_size_y >= data_height) { |
| 5736 | (*height) = data_height - (tile_offset_y * tile_size_y); |
| 5737 | } else { |
| 5738 | (*height) = tile_size_y; |
| 5739 | } |
| 5740 | |
| 5741 | // Image size = tile size. |
| 5742 | // Line order within tiles is always increasing. |
| 5743 | return DecodePixelData(out_images, requested_pixel_types, data_ptr, data_len, |
| 5744 | compression_type, /* line_order*/ 0, (*width), tile_size_y, |
| 5745 | /* stride */ tile_size_x, /* y */ 0, /* line_no */ 0, |
| 5746 | (*height), pixel_data_size, num_attributes, attributes, |
| 5747 | num_channels, channels, channel_offset_list); |
| 5748 | } |
| 5749 | |
| 5750 | static bool ComputeChannelLayout(std::vector<size_t> *channel_offset_list, |
| 5751 | int *pixel_data_size, size_t *channel_offset, |
no test coverage detected