Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apple's
HDRGainMapHeadroomis already a linear ratio, but the XMP parser applies the conversion from log2 space used for AdobeGainMapMax. For the existingapple_gainmap_new.jpgfixture, this turns a headroom of 4.532783 into 23.147476, causing excessive HDR gain and carrying the wrong value into re-encoded metadata.This change reads the Apple value directly while preserving Adobe's logarithmic conversion and the older Apple EXIF fallback. It also corrects the fixture expectation and adds a focused regression test.
Apple describes headroom as the HDR-to-SDR luminance ratio in Applying Apple HDR effect to your photos. ImageIO reports the same linear values for the tested Apple JPEGs.
The regression fails before this change and passes afterward. The full local suite passes (1,097 passed, 224 skipped), as do the focused ASan/UBSan checks. Together with #484, all 49 JPEG tests pass. I also tested two Apple-only iPhone JPEGs through libvips and ImageMagick; both retain the corrected headroom. ISO and XMP JPEG outputs decode successfully.
This is independent of #484's color-space flag fix. It does not change the gain-map reconstruction formula or add Apple HEIC support.