| 4284 | } |
| 4285 | |
| 4286 | static bool DecodeTiledPixelData( |
| 4287 | unsigned char **out_images, int *width, int *height, |
| 4288 | const int *requested_pixel_types, const unsigned char *data_ptr, |
| 4289 | size_t data_len, int compression_type, int data_width, |
| 4290 | int data_height, int tile_offset_x, int tile_offset_y, int tile_size_x, |
| 4291 | int tile_size_y, size_t pixel_data_size, size_t num_attributes, |
| 4292 | const EXRAttribute *attributes, size_t num_channels, |
| 4293 | const EXRChannelInfo *channels, |
| 4294 | const std::vector<size_t> &channel_offset_list) { |
| 4295 | // Here, data_width and data_height are the dimensions of the current (sub)level. |
| 4296 | if (tile_size_x * tile_offset_x > data_width || |
| 4297 | tile_size_y * tile_offset_y > data_height) { |
| 4298 | return false; |
| 4299 | } |
| 4300 | |
| 4301 | // Compute actual image size in a tile. |
| 4302 | if ((tile_offset_x + 1) * tile_size_x >= data_width) { |
| 4303 | (*width) = data_width - (tile_offset_x * tile_size_x); |
| 4304 | } else { |
| 4305 | (*width) = tile_size_x; |
| 4306 | } |
| 4307 | |
| 4308 | if ((tile_offset_y + 1) * tile_size_y >= data_height) { |
| 4309 | (*height) = data_height - (tile_offset_y * tile_size_y); |
| 4310 | } else { |
| 4311 | (*height) = tile_size_y; |
| 4312 | } |
| 4313 | |
| 4314 | // Image size = tile size. |
| 4315 | // Line order within tiles is always increasing. |
| 4316 | return DecodePixelData(out_images, requested_pixel_types, data_ptr, data_len, |
| 4317 | compression_type, /* line_order*/ 0, (*width), tile_size_y, |
| 4318 | /* stride */ tile_size_x, /* y */ 0, /* line_no */ 0, |
| 4319 | (*height), pixel_data_size, num_attributes, attributes, |
| 4320 | num_channels, channels, channel_offset_list); |
| 4321 | } |
| 4322 | |
| 4323 | static bool ComputeChannelLayout(std::vector<size_t> *channel_offset_list, |
| 4324 | int *pixel_data_size, size_t *channel_offset, |
no test coverage detected