Skip to content

Gain map/PNG gamma issue #2869

@macdavis

Description

@macdavis

It seems the gamma of the P3 SDR base image produced by Adobe Lightroom is 0.455 (inverse of 2.2). PNG decoded from libjxl preserves this data, however, it looks like libavif does not, (Edit: irrelevant, but might also be something to look into) resulting in gain map gamma issue when combining base and alt PNG images (Gain Map Gamma is always equal to 1).

Way to reproduce

  1. Download avif gain map sample file from https://helpx.adobe.com/camera-raw/using/gain-map.html. In this case, I use 01_base_hdr.avif as an example.

  2. avifgainmaputil printmetadata 01_base_hdr.avif

Gain Map Gamma: R 0.25 (as fraction: 268435456/1073741824) G 0.25 (as fraction: 268435456/1073741824) B 0.25 (as fraction: 268435456/1073741824)

  1. avifgainmaputil extractgainmap -q 100 01_base_hdr.avif 01_base_hdr_original_gain_map.jpeg

  2. avifgainmaputil swapbase -y 444 -q 100 --qalpha 100 --qgain-map 100 01_base_hdr.avif 01_base_sdr.avif

  3. avifdec.exe -d 16 01_base_hdr.avif 01_base_hdr.png

  4. avifdec.exe -d 16 01_base_sdr.avif 01_base_sdr.png

  5. avifgainmaputil combine --qgain-map 100 --depth-gain-map 10 --yuv-gain-map 444 -q 100 -y 444 -d 10 --cicp-base 9/16/9 --ignore-profile --cicp-alternate 9/1/9 -s 10 01_base_hdr.png 01_base_sdr.png 01_combined_base_hdr.avif

  6. avifgainmaputil printmetadata 01_combined_base_hdr.avif

Gain Map Gamma: R 1 (as fraction: 1/1) G 1 (as fraction: 1/1) B 1 (as fraction: 1/1)

  1. avifgainmaputil.exe extractgainmap -q 100 01_combined_base_hdr.avif 01_combined_base_hdr_gain_map.jpg

Both gain maps should be quite similar, but they are not, as shown below.

Image
Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions