RE: Visualisation for HLG to Display sRGB

Hi Chetan,

Thanks for the reply.  The transform is a simplified implementation suitable for use in browsers.  It is exploiting the well-established backwards-compatible property of the HLG system, so does not need further tone-mapping to SDR.

There is no single mathematically correct transform from HDR to SDR – video products all do this in a different way.  The transforms in use have different design aims.  This transform is designed to allow an HDR signal to be shown on an SDR monitor, with a percentage of the SDR signal range used for compressed HDR highlights.  This transform has the added step of changing colour space to sRGB/Rec709.  It’s intended as a minimum option which vendors could improve upon.

This transform is utilising the shape of the HLG curve to implement the tone mapping – the HLG curve acts like a well-defined camera knee (a technique used in live production to compress highlights to ensure that some detail is maintained, even if it’s relative brightness is too low).  In an HLG monitor, the curve is removed and the highlights shown at high brightness, in an SDR monitor it is assumed that the video signal is an SDR signal and the video shown with compressed highlights).

The two images show the difference between using gamma 2.2 and gamma 2.0 (which Lars pointed out was easier to implement).

Best Regards

Simon




Simon Thompson
Senior R&D Engineer

BBC Research & Development

From: Chetan Nanda <cnanda@adobe.com>
Sent: 22 September 2021 05:13
To: Simon Thompson - NM <Simon.Thompson2@bbc.co.uk>; public-colorweb@w3.org
Subject: Re: Visualisation for HLG to Display sRGB

Hi Simon / Lars,

Thanks for sharing the maths over mail.
I am confused by the purpose of this transform as this is not mathematically correct.

I see the following issues:

  1.  Using plain gamma for HLG and sRGB.
  2.  Rendering produced by this math will be different from rendering done by video products that are using mathematically correct transform.
  3.  How HDR (HLG) tonemapped to SDR display using this transform?
  4.  How graphics white (or display peak brightness) be handled by the proposed transform.

Thanks,
Chetan Nanda
From: Simon Thompson - NM <Simon.Thompson2@bbc.co.uk<mailto:Simon.Thompson2@bbc.co.uk>>
Date: Tuesday, 21 September 2021 at 6:46 PM
To: "public-colorweb@w3.org<mailto:public-colorweb@w3.org>" <public-colorweb@w3.org<mailto:public-colorweb@w3.org>>
Subject: Visualisation for HLG to Display sRGB
Resent from: <public-colorweb@w3.org<mailto:public-colorweb@w3.org>>
Resent date: Tuesday, 21 September 2021 at 6:46 PM



Hi all,



Apologies if you've received this twice, yesterday's attempt seemed to fail..



As promised, here’s the first part of the visualisation of colour transforms that I promised last week. In previous emails, Lars and I were discussing whether a simplification may be possible by using a gamma value of 2.0 in the BT.2100 HLG to Display sRGB conversions (i.e. for use when displaying an HDR image on an sRGB display) rather than 2.2. This is NOT the same as the transform of HLG to the extended sRGB working space.



def displayRenderingREC2100HLGtoSRGBdisplay(R, G, B, mat2020to709, gamma, int8Vals=False):

    if (int8Vals):

        R = R / 255.0

        G = G / 255.0

        B = B / 255.0

    r1 = pow(R, gamma)

    g1 = pow(G, gamma)

    b1 = pow(B, gamma)

    (r2, g2, b2) = cs.applyMatrix(r1, g1, b1, mat2020to709)

    if(r2 > 0.0):

        r3 = pow(r2, 1.0/gamma)

    else:

        r3 = -1.0 * pow(-1.0 * r2, 1.0 / gamma)

    if(g2 > 0.0):

        g3 = pow(g2, 1.0/gamma)

    else:

        g3 = -1.0 * pow(-1.0 * g2, 1.0 / gamma)

    if(b2 > 0.0):

        b3 = pow(b2, 1.0/gamma)

    else:

        b3 = -1.0 * pow(-1.0 * b2, 1.0 / gamma)

    if (int8Vals):

        r3 = round(255.0 * r3, 0)

        g3 = round(255.0 * g3, 0)

        b3 = round(255.0 * b3, 0)

    return (r3, g3, b3)



I’ve attached two images to the email – please note that the above code will end up with values above 255 and below 0 (or above 1.0 and below 0.0 if int8Vals is false) and will need to be legalised to the sRGB gamut. I have used a crude clip as this should present the worst case scenario.



The first image has 2 sets of HLG EBU colour bars converted to sRGB, the top has an ideal gamma of 2.2, the bottom 2.0. The only differences I can see are in the primaries and secondaries at 100% level HLG (the top row) – this suggests that the effect will only really be visible in the very saturated highlights.



The second image is a Hong Kong street scene with lots of artificial lighting (top 2.2, bottom 2.0) – again only the very brightest, most saturated colours are affected.



I think therefore we can update the draft with text as follows:



The correct gamma value for use with the BT.2100 HLG to sRGB Display Rendering Function is 2.2. Where required for reasons of processing speed or hardware limitations, a value of 2.0 may be acceptable in non-critical applications.



Furthermore, by first converting any image/canvas in the proposed extended sRGB working space to BT.2100 HLG, this conversion can then also be used to provide an sRGB Display Rendering of that extended sRGB working space.

[cid:image001.jpg@01D7AF98.3D9BF600]
[cid:image002.jpg@01D7AF98.3D9BF600]


--

Simon Thompson MEng CEng MIET
Senior R&D Engineer

BBC Research and Development South Laboratory

Received on Wednesday, 22 September 2021 11:17:53 UTC