Skip to content

Commit 735ff73

Browse files
authored
Merge pull request #224 from metamuffin/line-order-bugs
Fix line order bugs
2 parents 80282e2 + 50577f0 commit 735ff73

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tinyexr.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4286,7 +4286,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,
42864286
static bool DecodeTiledPixelData(
42874287
unsigned char **out_images, int *width, int *height,
42884288
const int *requested_pixel_types, const unsigned char *data_ptr,
4289-
size_t data_len, int compression_type, int line_order, int data_width,
4289+
size_t data_len, int compression_type, int data_width,
42904290
int data_height, int tile_offset_x, int tile_offset_y, int tile_size_x,
42914291
int tile_size_y, size_t pixel_data_size, size_t num_attributes,
42924292
const EXRAttribute *attributes, size_t num_channels,
@@ -4312,8 +4312,9 @@ static bool DecodeTiledPixelData(
43124312
}
43134313

43144314
// Image size = tile size.
4315+
// Line order within tiles is always increasing.
43154316
return DecodePixelData(out_images, requested_pixel_types, data_ptr, data_len,
4316-
compression_type, line_order, (*width), tile_size_y,
4317+
compression_type, /* line_order*/ 0, (*width), tile_size_y,
43174318
/* stride */ tile_size_x, /* y */ 0, /* line_no */ 0,
43184319
(*height), pixel_data_size, num_attributes, attributes,
43194320
num_channels, channels, channel_offset_list);
@@ -5088,7 +5089,6 @@ static int DecodeTiledLevel(EXRImage* exr_image, const EXRHeader* exr_header,
50885089
&(exr_image->tiles[tile_idx].height),
50895090
exr_header->requested_pixel_types, data_ptr,
50905091
static_cast<size_t>(data_len), exr_header->compression_type,
5091-
exr_header->line_order,
50925092
exr_image->width, exr_image->height,
50935093
tile_coordinates[0], tile_coordinates[1], exr_header->tile_size_x,
50945094
exr_header->tile_size_y, static_cast<size_t>(pixel_data_size),
@@ -5442,10 +5442,11 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header,
54425442
if (line_no < 0) {
54435443
invalid_data = true;
54445444
} else {
5445+
// Line order is increasing because we read in line offset table order.
54455446
if (!tinyexr::DecodePixelData(
54465447
exr_image->images, exr_header->requested_pixel_types,
54475448
data_ptr, static_cast<size_t>(data_len),
5448-
exr_header->compression_type, exr_header->line_order,
5449+
exr_header->compression_type, /* line_order*/ 0,
54495450
int(data_width), int(data_height), int(data_width), y, line_no,
54505451
num_lines, static_cast<size_t>(pixel_data_size),
54515452
static_cast<size_t>(

0 commit comments

Comments
 (0)