Skip to content

Commit

Permalink
fix secondary image size compute in dual encoding
Browse files Browse the repository at this point in the history
when iso and xmp are enabled together, the size of secondary image does
not include the jpeg app2 marker size.

fixes google#342

Test: ./ultrahdr_app
  • Loading branch information
ram-mohan committed Dec 20, 2024
1 parent 4cb4626 commit 27813d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/jpegr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,12 +1160,12 @@ uhdr_error_info_t JpegR::appendGainMap(uhdr_compressed_image_t* sdr_intent_compr
iso_secondary_length = 2 + isoNameSpaceLength + iso_secondary_data.size();
}

size_t secondary_image_size = 2 /* 2 bytes length of APP1 sign */ + gainmap_compressed->data_sz;
size_t secondary_image_size = gainmap_compressed->data_sz;
if (kWriteXmpMetadata) {
secondary_image_size += xmp_secondary_length;
secondary_image_size += 2 /* 2 bytes length of APP1 sign */ + xmp_secondary_length;
}
if (kWriteIso21496_1Metadata) {
secondary_image_size += iso_secondary_length;
secondary_image_size += 2 /* 2 bytes length of APP2 sign */ + iso_secondary_length;
}

// Check if EXIF package presents in the JPEG input.
Expand Down

0 comments on commit 27813d4

Please sign in to comment.