Skip to content

Commit ea518da

Browse files
ram-mohanDichenZhang1
authored andcommitted
fix secondary image size compute in dual encoding
when iso and xmp are enabled together, the size of secondary image does not include the jpeg app2 marker size. fixes #342 Test: ./ultrahdr_app
1 parent 4cb4626 commit ea518da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/src/jpegr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,12 +1160,12 @@ uhdr_error_info_t JpegR::appendGainMap(uhdr_compressed_image_t* sdr_intent_compr
11601160
iso_secondary_length = 2 + isoNameSpaceLength + iso_secondary_data.size();
11611161
}
11621162

1163-
size_t secondary_image_size = 2 /* 2 bytes length of APP1 sign */ + gainmap_compressed->data_sz;
1163+
size_t secondary_image_size = gainmap_compressed->data_sz;
11641164
if (kWriteXmpMetadata) {
1165-
secondary_image_size += xmp_secondary_length;
1165+
secondary_image_size += 2 /* 2 bytes length of APP1 sign */ + xmp_secondary_length;
11661166
}
11671167
if (kWriteIso21496_1Metadata) {
1168-
secondary_image_size += iso_secondary_length;
1168+
secondary_image_size += 2 /* 2 bytes length of APP2 sign */ + iso_secondary_length;
11691169
}
11701170

11711171
// Check if EXIF package presents in the JPEG input.

0 commit comments

Comments
 (0)