Visualisation for HLG to Display sRGB

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:a0bb906d-370f-47ec-bd69-b488a22ebfbc]
[cid:bce04351-5e59-413b-839d-e9c5e48b183b]


--

Simon Thompson MEng CEng MIET
Senior R&D Engineer

BBC Research and Development South Laboratory

Received on Tuesday, 21 September 2021 13:16:34 UTC