w3c / ColorWeb-CG

repo for the Color on the Web Community Group
47 stars 21 forks source link

rec2100-pq to srgb function uses Rec. 709 gamma (2.4) instead of sRGB gamma (2.2) #110

Closed palemieux closed 8 months ago

palemieux commented 8 months ago
From Lars:
Why is PQ to srgb using gamma 2.4 while HLG uses 2.2? 2.2 is usually the better fit for sRGB. But maybe you want 709 brightness levels?

Originally posted by @palemieux in https://github.com/w3c/ColorWeb-CG/issues/106#issuecomment-1768982979

Myndex commented 8 months ago

I was under the impression that to go from PQ to an SDR like sRGB, you needed to use the metadata? I didn't see meta being used, though I may not be looking at the right code?

As for gamma... while 2.4 is the defined display gamma for Rec709 in BT1886, the encoding gamma is roughly ~1.9 ... though actually, the encoding gamma is more like "adjust picture to satisfaction while viewing through a 2.4 display".

In other words, a given display gamma for a given ambient environment does not itself dictate the gamma used for encoding.

As for 2.2

Yes, 2.2 is more appropriate for sRGB if coming from a linear (gamma 1.0) source, as it is display referred and specified at 2.2 (simple gamma for display)... Tho this assumes that things like gamut mapping or volume per metadata adjustments are completed.

For encoding, it is the piecewise that is specified in the IEC sRGB standard, not simple gamma (simple 2.2 for reference display, but not encoding). But if simple gamma is chosen for conputational efficiency, then by all means. Encoding with 1/2.4 and then display in a reference sRGB display at 2.2 may be brighter than expected.

From linear, encoding with 1/2.2 or 0.4545 is most efficient, there is a small discrepancy in darker area—but if using 0.4545 and monitoring through a reference display, it is self-correcting.

(i.e. use the same encoding gamma as was used for the display chain of the workspace).

swick commented 8 months ago

The metadata can be used to improve gamut and tone mapping by decreasing the distance of the mappings. Metadata doesn't have to be used though and even the existence is entirely optional.