staging/color-management: replace two-piece TF

ICC-based calibrated print workflows have generally used the sRGB
two-piece transfer characteristic. The CRT era monitors were exclusively
power curve, but print workflows used software calibration to meet the
two-piece curve. Everyone else used the monitor native transfer
characteristic.

Acknowledge that both ways exist, and allow describing both as what they
are.

Mesa is already using "srgb" if it is available, for programs that
actually expect gamma22. Exposing "srgb" with its literal definition
would make a compositor (KWin has been named) appear regressing in
picture quality. The same with "ext_srgb" as Mesa used to map
VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT to it, probably incorrectly.

sRGB is specified to use a power-law 2.2 display, and reality is not
consistent. Some compositors take srgb to mean gamma22 already, so there
is practical ambiguity.  There are also endless discussions about which
one sRGB actually is and when: power-law 2.2 or the piece-wise function.
Monitors are manufactured both ways and they are often even switchable
between the two. Therefore deprecate the "srgb" value, it is too easy to
pick and assume one behavior while someone else assumes the other
behavior.

Additionally, extending the range beyond 1.0 would significantly diverge
between srgb and gamma22 because of the different exponent. Assuming
that ext_srgb is identical to srgb for [0.0, 1.0] would conflict with a
compositor that takes srgb as gamma22 but implements ext_srgb by the
piece-wise function.

Given that monitors with the piece-wise function exist or are calibrated
to it, and materials are prepared on them, add a new value explicitly
for the sRGB piece-wise function. Its name deliberately does not include
"srgb".

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2025-09-01 14:49:46 +03:00 committed by Pekka Paalanen
parent e2bacdd2ab
commit 70442afc16
2 changed files with 31 additions and 9 deletions

View file

@ -53,6 +53,22 @@ The above are specified by [ITU-R BT.1886].
Note, that $`E < 0`$ and $`E > 1`$ are possible with limited range
quantization, as required by e.g. the calibration method in [ITU-R BT.814].
### `compound_power_2_4`
```math
O = \begin{cases}
\frac{E}{12.92}, & 0 \leq E < 0.04045\\
\left( \frac{E + 0.055}{1.055} \right)^{2.4}, & 0.04045 \leq E \leq 1
\end{cases}
```
The above is the IEC 61966-2-1 piece-wise transfer function,
as recorded in [Khronos Data Format Specification][KDFS] 1.4.0
Section 13.3, and restricted to the unit range.
```math
L = (L_W - L_B)O + L_B
```
### `gamma22`
@ -125,3 +141,4 @@ L = 10'000\ \mathrm{cd/m²} \cdot O + L_B
[ITU-R BT.814]: https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/specs.md#itu-r-bt814
[ITU-R BT.1886]: https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/specs.md#itu-r-bt1886
[ITU-R BT.2100]: https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/specs.md#itu-r-bt2100
[KDFS]: https://registry.khronos.org/DataFormat/

View file

@ -288,8 +288,7 @@
- United States Federal Communications Commission (2003) Title 47 Code
of Federal Regulations 73.682 (a) (20)
- Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM
Note: an sRGB display (IEC 61966-2-1) uses this transfer function.
- IEC 61966-2-1 (reference display)
</description>
</entry>
<entry name="gamma28" value="3">
@ -326,18 +325,18 @@
- IEC 61966-2-4
</description>
</entry>
<entry name="srgb" value="9">
<description summary="sRGB piece-wise transfer function">
<entry name="srgb" value="9" deprecated-since="2">
<description summary="Deprecated (ambiguous sRGB transfer function)">
Transfer characteristics as defined by
- IEC 61966-2-1 sRGB
Note: This is not appropriate for describing sRGB material.
sRGB material is intended to be viewed on an sRGB display, and
that is described by gamma22.
As a rule of thumb, use gamma22 for video, motion picture and
computer graphics, or compound_power_2_4 for ICC calibrated print
workflows.
</description>
</entry>
<entry name="ext_srgb" value="10">
<description summary="Extended sRGB piece-wise transfer function">
<entry name="ext_srgb" value="10" deprecated-since="2">
<description summary="Deprecated (Extended sRGB piece-wise transfer function)">
Transfer characteristics as defined by
- IEC 61966-2-1 sYCC
</description>
@ -387,6 +386,12 @@
ARIB STD-B67 or BT.2100.
</description>
</entry>
<entry name="compound_power_2_4" value="14" since="2">
<description summary="IEC 61966-2-1 encoding function">
Encoding characteristics as defined by IEC 61966-2-1, for displays
that invert the encoding function.
</description>
</entry>
</enum>
<request name="get_output">