| 4210 | } |
| 4211 | |
| 4212 | static bool DecodeTiledPixelData( |
| 4213 | unsigned char **out_images, int *width, int *height, |
| 4214 | const int *requested_pixel_types, const unsigned char *data_ptr, |
| 4215 | size_t data_len, int compression_type, int line_order, int data_width, |
| 4216 | int data_height, int tile_offset_x, int tile_offset_y, int tile_size_x, |
| 4217 | int tile_size_y, size_t pixel_data_size, size_t num_attributes, |
| 4218 | const EXRAttribute *attributes, size_t num_channels, |
| 4219 | const EXRChannelInfo *channels, |
| 4220 | const std::vector<size_t> &channel_offset_list) { |
| 4221 | // Here, data_width and data_height are the dimensions of the current (sub)level. |
| 4222 | if (tile_size_x * tile_offset_x > data_width || |
| 4223 | tile_size_y * tile_offset_y > data_height) { |
| 4224 | return false; |
| 4225 | } |
| 4226 | |
| 4227 | // Compute actual image size in a tile. |
| 4228 | if ((tile_offset_x + 1) * tile_size_x >= data_width) { |
| 4229 | (*width) = data_width - (tile_offset_x * tile_size_x); |
| 4230 | } else { |
| 4231 | (*width) = tile_size_x; |
| 4232 | } |
| 4233 | |
| 4234 | if ((tile_offset_y + 1) * tile_size_y >= data_height) { |
| 4235 | (*height) = data_height - (tile_offset_y * tile_size_y); |
| 4236 | } else { |
| 4237 | (*height) = tile_size_y; |
| 4238 | } |
| 4239 | |
| 4240 | // Image size = tile size. |
| 4241 | return DecodePixelData(out_images, requested_pixel_types, data_ptr, data_len, |
| 4242 | compression_type, line_order, (*width), tile_size_y, |
| 4243 | /* stride */ tile_size_x, /* y */ 0, /* line_no */ 0, |
| 4244 | (*height), pixel_data_size, num_attributes, attributes, |
| 4245 | num_channels, channels, channel_offset_list); |
| 4246 | } |
| 4247 | |
| 4248 | static bool ComputeChannelLayout(std::vector<size_t> *channel_offset_list, |
| 4249 | int *pixel_data_size, size_t *channel_offset, |
no test coverage detected