Visualisation for HLG to/from extended sRGB working space

Hi all,

Please find attached some further examples of the proposed transforms, this time looking at transforming both sRGB and HLG to and from the extended sRGB working space and the effect of overlaying SDR and HDR elements on the sRGB display rendering.


Conversion of sRGB/extended sRGB to HLG

SrgbtoHlgScaler = 0.26496256042100724  # HLG Diffuse White
systemGamma = 1.0

def convertExtendedSRGBtoREC2100HLG(R, G, B, mat709to2020, int8Vals=False):
    if(int8Vals):
        R = R / 255.0
        G = G / 255.0
        B = B / 255.0
    (r1, g1, b1) = tf.srgb_eotf(R, G, B)  # convert to linear RGB Normalised Display Light (values may be outside range 0 - 1)
    (r2, g2, b2) = cs.applyMatrix(r1, g1, b1, mat709to2020)  # Convert from BT.709/sRGB Primaries to BT.2100 Primaries
    r3 = SrgbtoHlgScaler * r2   # Scale to HLG output signal range
    g3 = SrgbtoHlgScaler * g2
    b3 = SrgbtoHlgScaler * b2
    (r4, g4, b4) = tf.hlg_inverse_eotf(r3, g3, b3, systemGamma)  # Convert to HLG Non-linear Signal (straightforward as systemGamma = 1.0)
    if(int8Vals):
        r4 = round(255.0 * r4, 0)
        g4 = round(255.0 * g4, 0)
        b4 = round(255.0 * b4, 0)
    return (r4, g4, b4)



This conversion places the white level of the SDR sRGB at 75% signal level within the HLG and correctly changes the colour space from sRGB to BT.2100/BT.2020. Looking at the conversion using a set of HLG colour bars and a set of sRGB colour bars, we can see that the white luminance is the same as the 75% HLG colour bars.  The chrominance is simiar to the BT.709 equivalent bars present below the HLG bars in the test signal.  (The EBU Bars have been converted to Full Range to match the sRGB Bar range)



[cid:360285ad-8c57-4a68-8f52-82c315a49e99]

When used with a real-life image we can see that the colour bars luminance is similar in level to the street signs whilst allowing specular highlights and artificial lighting to be above this level.
[cid:168afeec-a557-408d-b55b-e874ac328e14]


Reversability - Conversion of sRGB/extended sRGB to HLG and back to extended sRGB


HlgtoSrgbScaler = 1.0 / 0.26496256042100724

def convertREC2100HLGtoExtendedSRGB(R, G, B, mat2020to709, int8Vals=False):
    if (int8Vals):
        R = R / 255.0
        G = G / 255.0
        B = B / 255.0
    (r1, g1, b1) = tf.hlg_eotf(R, G, B, systemGamma)  # Convert to Linear Display Light (simple as systemGamma = 1.0)
    r2 = HlgtoSrgbScaler * r1  # Scale to extended sRGB signal Range
    g2 = HlgtoSrgbScaler * g1
    b2 = HlgtoSrgbScaler * b1
    (r3, g3, b3) = cs.applyMatrix(r2, g2, b2, mat2020to709)  # Convert from BT.2100 primaries to BT.709/sRGB Primaries
    (r4, g4, b4) = tf.srgb_inverse_eotf(r3, g3, b3)  # Convert to non-linear extended sRGB (values may exist outside 0-1 range)
    if (int8Vals):
        r4 = round(255.0 * r4, 0)
        g4 = round(255.0 * g4, 0)
        b4 = round(255.0 * b4, 0)
    return (r4, g4, b4)

We can see that the process is reversible by looking at this image which shows the sRGB colour bars converted to HLG and then back to sRGB. (Please note that this is not the transform for rendering to an sRGB diplay - it is to the extended sRGB Working Space)

[cid:1550bba1-e840-400f-999b-b4a822ea0510]


Rendering for display on sRGB monitors

Using the code sent through on Monday last, I have then rendered the street scene with an overlay, again you can see that the highlights are preserved, the diffuse white levels match those in the posters in the street scene and the colours are comparable.

[cid:1b828ccb-017e-446b-b704-9465420161bb]

Conclusion and Further work.


  *   These transforms allow a relatively simple transform between HLG and the extended sRGB working space.
  *   This transform is reversible
  *   If it's decided to use linear extended sRGB as a colour working space, the transforms are even easier.
  *   The Transform to HLG from extended sRGB allows any image stores in the extended sRGB working space to be mapped to HLG for rendering on an HLG display
  *   The sRGB Display Rendering transform to allow viewing of HLG on an sRGB monitor maintains the HDR highlight detail without clipping
  *   The transform from extended sRGB working space to HLG followed by the sRGB Display Rendering transform allows viewing of any image in extended sRGB to be viewed on an sRGB display with maintained HDR highlight detail without clipping
  *   The transforms should be extended with input from Dolby to include PQ
  *   Some work on understanding the tone-mapping requirements of Microsoft Windows and Apple OSX is required



--

Simon Thompson MEng CEng MIET
Senior R&D Engineer

BBC Research and Development South Laboratory

Received on Monday, 27 September 2021 14:27:53 UTC