ColorWeb-CG icon indicating copy to clipboard operation
ColorWeb-CG copied to clipboard

Standardize tone mapping applied when rendering HDR content to an SDR canvas

Open ccameron-chromium opened this issue 8 months ago • 2 comments

Suppose there exists HDR content either as a ITU-R BT.2100 video or ISO 22028-5 image. It has:

  • Rec2020 primaries
  • HLG or PQ transfer function
  • Optional metadata specifying
    • Content color volume
    • Content light level info
    • Mastering display color volume
    • Nominal diffuse white level

Suppose that that image is required to be converted to an SDR target, e.g, because it is being drawn (using drawImage) to a 2D SDR canvas.

In this process, a tone mapping from HDR to SDR must be performed. This issue is to standardize that tone mapping.

Note: This is a subset of the HTML issue Standardize rendering of PQ and HLG HDR image content. That issue attempts to render to a space defined by an HDR headroom. This issue is just to an SDR space.

Scope

Before considering the tone mapping to be performed, we should first establish a more limited scope for the problem.

  • The target of the tone mapping must be an SDR space with Rec2020 primaries and a linear transfer function, with where 0,0,0 is 'black' and 1,1,1 is 'white'
    • This is converting to pixels to be handled by standard (usually ICC based) SDR color management
    • This is not converting to nits to be displayed on an SDR display
  • The source of the tone mapping is luminance on the ITU-R BT.2100 reference display
    • Both HLG and PQ are converted to this display and then the same tone mapping is applied to both
  • Gamut mapping to a narrower gamut is explicitly not to be addressed
    • The browser is to handle gamut mapping the resulting Rec2020 image as it would handle any other Rec2020 SDR image
    • Some algorithms might have a gamut mapping-like step to get a result in Rec2020 RGB space
  • The tone mapping algorithm is to be a global tone map (not a local tone map)
  • The tone mapping algorithm is to be parameterized only by the HDR metadata
    • It is independent of monitor it is to be viewed on and the viewing environment

Test images

Some test images are available here:

  • https://people.csail.mit.edu/ericchan/hdr/hdr.php
  • https://developer.apple.com/documentation/uikit/images_and_pdf/supporting_hdr_images_in_your_app

Candidate Algorithms

Several of these candidates have been implemented here.

ccameron-chromium avatar Nov 01 '23 21:11 ccameron-chromium

As well as natural images can we please include some generated images with a range of colours and sweeps to ensure that candidate solutions can be evaluated in terms of colour accuracy, discontinuities etc.

Examples could include the TruVision LUT stress test image, Macbeth colours, colour bars etc. It's also important that any solution correctly displays memory colours such as the entire range of skin tone, sky, grass etc.

simontWork avatar Nov 02 '23 16:11 simontWork

OpenEXR has a collection of HDR test images that may be useful for this context. There is an assortment of patterns as well as natural images, and images intended to stress test or break things.

https://openexr.com/en/latest/_test_images/index.html

Myndex avatar Nov 02 '23 23:11 Myndex