[Webkit-unassigned] [Bug 245858] HDR data is clipped in AVIF images

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 22 04:16:31 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=245858

Christopher Cameron <ccameron at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ccameron at chromium.org

--- Comment #10 from Christopher Cameron <ccameron at chromium.org> ---
The following test program shows the core issue:
https://github.com/ccameron-chromium/test-programs/blob/main/hlg-tone-map-simple.mm

That test program has 3 gradients:
- a CAMetalLayer that applies the HLG toLinear function
- a CAMetalLayer that applies to HLG toLinear function and sets its CAEDRMetalLayer to HLG
- an AVSampleBufferDisplayLayer that is HLG

The bottom two gradients looks the same, but the top one ramps up too quickly and then saturates.

In the top one, we're just applying the HLG inverse OETF directly to the pixel values, giving us values in the range [0, 12]. The HDR-to-SDR ratio of the display is not taken into account, so it will clip wherever we hit the EDR limit (pixel value 0.5 on SDR screens). This is what it appears is happening with HLG images in STP.

In the middle one, we're applying the HLG inverse OETF, and then setting CAEDRMetadata -- this uses the full display range.

In the bottom one, we tell AVSampleBufferDisplayLayer "do your thing", and it does the same thing as the middle layer.

The difficulty here is that when CoreGraphics is drawing HLG images, it needs to "bake in" the tone mapping that would ordinarily be applied by CoreAnimation. This also means that if the viewing conditions change, the image must be re-drawn using CG.

Another test page for this is:
https://ccameron-chromium.github.io/hdr-jpeg/index.html

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221122/cb765c81/attachment.htm>


More information about the webkit-unassigned mailing list