1 .. -*- coding: utf-8; mode: rst -*-
3 ********************************
4 Detailed Colorspace Descriptions
5 ********************************
10 Colorspace SMPTE 170M (V4L2_COLORSPACE_SMPTE170M)
11 =================================================
13 The :ref:`smpte170m` standard defines the colorspace used by NTSC and
14 PAL and by SDTV in general. The default transfer function is
15 ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is
16 ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited
17 range. The chromaticities of the primary colors and the white reference
22 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
24 .. flat-table:: SMPTE 170M Chromaticities
64 - White Reference (D65)
71 The red, green and blue chromaticities are also often referred to as the
72 SMPTE C set, so this colorspace is sometimes called SMPTE C as well.
74 The transfer function defined for SMPTE 170M is the same as the one
79 L' = -1.099(-L)^{0.45} + 0.099 \text{, for } L \le-0.018
81 L' = 4.5L \text{, for } -0.018 < L < 0.018
83 L' = 1.099L^{0.45} - 0.099 \text{, for } L \ge 0.018
85 Inverse Transfer function:
89 L = -\left( \frac{L' - 0.099}{-1.099} \right) ^{\frac{1}{0.45}} \text{, for } L' \le -0.081
91 L = \frac{L'}{4.5} \text{, for } -0.081 < L' < 0.081
93 L = \left(\frac{L' + 0.099}{1.099}\right)^{\frac{1}{0.45} } \text{, for } L' \ge 0.081
95 The luminance (Y') and color difference (Cb and Cr) are obtained with
96 the following ``V4L2_YCBCR_ENC_601`` encoding:
100 Y' = 0.2990R' + 0.5870G' + 0.1140B'
102 Cb = -0.1687R' - 0.3313G' + 0.5B'
104 Cr = 0.5R' - 0.4187G' - 0.0813B'
106 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
107 [-0.5…0.5]. This conversion to Y'CbCr is identical to the one defined in
108 the :ref:`itu601` standard and this colorspace is sometimes called
109 BT.601 as well, even though BT.601 does not mention any color primaries.
111 The default quantization is limited range, but full range is possible
112 although rarely seen.
117 Colorspace Rec. 709 (V4L2_COLORSPACE_REC709)
118 ============================================
120 The :ref:`itu709` standard defines the colorspace used by HDTV in
121 general. The default transfer function is ``V4L2_XFER_FUNC_709``. The
122 default Y'CbCr encoding is ``V4L2_YCBCR_ENC_709``. The default Y'CbCr
123 quantization is limited range. The chromaticities of the primary colors
124 and the white reference are:
128 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
130 .. flat-table:: Rec. 709 Chromaticities
170 - White Reference (D65)
177 The full name of this standard is Rec. ITU-R BT.709-5.
179 Transfer function. Normally L is in the range [0…1], but for the
180 extended gamut xvYCC encoding values outside that range are allowed.
184 L' = -1.099(-L)^{0.45} + 0.099 \text{, for } L \le -0.018
186 L' = 4.5L \text{, for } -0.018 < L < 0.018
188 L' = 1.099L^{0.45} - 0.099 \text{, for } L \ge 0.018
190 Inverse Transfer function:
194 L = -\left( \frac{L' - 0.099}{-1.099} \right)^\frac{1}{0.45} \text{, for } L' \le -0.081
196 L = \frac{L'}{4.5}\text{, for } -0.081 < L' < 0.081
198 L = \left(\frac{L' + 0.099}{1.099}\right)^{\frac{1}{0.45} } \text{, for } L' \ge 0.081
200 The luminance (Y') and color difference (Cb and Cr) are obtained with
201 the following ``V4L2_YCBCR_ENC_709`` encoding:
205 Y' = 0.2126R' + 0.7152G' + 0.0722B'
207 Cb = -0.1146R' - 0.3854G' + 0.5B'
209 Cr = 0.5R' - 0.4542G' - 0.0458B'
211 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
214 The default quantization is limited range, but full range is possible
215 although rarely seen.
217 The ``V4L2_YCBCR_ENC_709`` encoding described above is the default for
218 this colorspace, but it can be overridden with ``V4L2_YCBCR_ENC_601``,
219 in which case the BT.601 Y'CbCr encoding is used.
221 Two additional extended gamut Y'CbCr encodings are also possible with
224 The xvYCC 709 encoding (``V4L2_YCBCR_ENC_XV709``, :ref:`xvycc`) is
225 similar to the Rec. 709 encoding, but it allows for R', G' and B' values
226 that are outside the range [0…1]. The resulting Y', Cb and Cr values are
231 Y' = \frac{219}{256} * (0.2126R' + 0.7152G' + 0.0722B') + \frac{16}{256}
233 Cb = \frac{224}{256} * (-0.1146R' - 0.3854G' + 0.5B')
235 Cr = \frac{224}{256} * (0.5R' - 0.4542G' - 0.0458B')
237 The xvYCC 601 encoding (``V4L2_YCBCR_ENC_XV601``, :ref:`xvycc`) is
238 similar to the BT.601 encoding, but it allows for R', G' and B' values
239 that are outside the range [0…1]. The resulting Y', Cb and Cr values are
244 Y' = \frac{219}{256} * (0.2990R' + 0.5870G' + 0.1140B') + \frac{16}{256}
246 Cb = \frac{224}{256} * (-0.1687R' - 0.3313G' + 0.5B')
248 Cr = \frac{224}{256} * (0.5R' - 0.4187G' - 0.0813B')
250 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
251 [-0.5…0.5]. The non-standard xvYCC 709 or xvYCC 601 encodings can be
252 used by selecting ``V4L2_YCBCR_ENC_XV709`` or ``V4L2_YCBCR_ENC_XV601``.
253 The xvYCC encodings always use full range quantization.
258 Colorspace sRGB (V4L2_COLORSPACE_SRGB)
259 ======================================
261 The :ref:`srgb` standard defines the colorspace used by most webcams
262 and computer graphics. The default transfer function is
263 ``V4L2_XFER_FUNC_SRGB``. The default Y'CbCr encoding is
264 ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is full range.
265 The chromaticities of the primary colors and the white reference are:
269 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
271 .. flat-table:: sRGB Chromaticities
311 - White Reference (D65)
318 These chromaticities are identical to the Rec. 709 colorspace.
320 Transfer function. Note that negative values for L are only used by the
325 L' = -1.055(-L)^{\frac{1}{2.4} } + 0.055\text{, for }L < -0.0031308
327 L' = 12.92L\text{, for }-0.0031308 \le L \le 0.0031308
329 L' = 1.055L ^{\frac{1}{2.4} } - 0.055\text{, for }0.0031308 < L \le 1
331 Inverse Transfer function:
335 L = -((-L' + 0.055) / 1.055) ^{2.4}\text{, for }L' < -0.04045
337 L = L' / 12.92\text{, for }-0.04045 \le L' \le 0.04045
339 L = ((L' + 0.055) / 1.055) ^{2.4}\text{, for }L' > 0.04045
341 The luminance (Y') and color difference (Cb and Cr) are obtained with
342 the following ``V4L2_YCBCR_ENC_601`` encoding as defined by :ref:`sycc`:
346 Y' = 0.2990R' + 0.5870G' + 0.1140B'
348 Cb = -0.1687R' - 0.3313G' + 0.5B'
350 Cr = 0.5R' - 0.4187G' - 0.0813B'
352 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
353 [-0.5…0.5]. This transform is identical to one defined in SMPTE
354 170M/BT.601. The Y'CbCr quantization is full range.
359 Colorspace Adobe RGB (V4L2_COLORSPACE_ADOBERGB)
360 ===============================================
362 The :ref:`adobergb` standard defines the colorspace used by computer
363 graphics that use the AdobeRGB colorspace. This is also known as the
364 :ref:`oprgb` standard. The default transfer function is
365 ``V4L2_XFER_FUNC_ADOBERGB``. The default Y'CbCr encoding is
366 ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is full
367 range. The chromaticities of the primary colors and the white reference
372 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
374 .. flat-table:: Adobe RGB Chromaticities
414 - White Reference (D65)
426 L' = L ^{\frac{1}{2.19921875}}
428 Inverse Transfer function:
432 L = L'^{(2.19921875)}
434 The luminance (Y') and color difference (Cb and Cr) are obtained with
435 the following ``V4L2_YCBCR_ENC_601`` encoding:
439 Y' = 0.2990R' + 0.5870G' + 0.1140B'
441 Cb = -0.1687R' - 0.3313G' + 0.5B'
443 Cr = 0.5R' - 0.4187G' - 0.0813B'
445 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
446 [-0.5…0.5]. This transform is identical to one defined in SMPTE
447 170M/BT.601. The Y'CbCr quantization is full range.
452 Colorspace BT.2020 (V4L2_COLORSPACE_BT2020)
453 ===========================================
455 The :ref:`itu2020` standard defines the colorspace used by Ultra-high
456 definition television (UHDTV). The default transfer function is
457 ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is
458 ``V4L2_YCBCR_ENC_BT2020``. The default R'G'B' quantization is limited
459 range (!), and so is the default Y'CbCr quantization. The chromaticities
460 of the primary colors and the white reference are:
464 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
466 .. flat-table:: BT.2020 Chromaticities
506 - White Reference (D65)
514 Transfer function (same as Rec. 709):
518 L' = 4.5L\text{, for }0 \le L < 0.018
520 L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1
522 Inverse Transfer function:
526 L = L' / 4.5\text{, for } L' < 0.081
528 L = \left( \frac{L' + 0.099}{1.099}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081
530 The luminance (Y') and color difference (Cb and Cr) are obtained with
531 the following ``V4L2_YCBCR_ENC_BT2020`` encoding:
535 Y' = 0.2627R' + 0.6780G' + 0.0593B'
537 Cb = -0.1396R' - 0.3604G' + 0.5B'
539 Cr = 0.5R' - 0.4598G' - 0.0402B'
541 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
542 [-0.5…0.5]. The Y'CbCr quantization is limited range.
544 There is also an alternate constant luminance R'G'B' to Yc'CbcCrc
545 (``V4L2_YCBCR_ENC_BT2020_CONST_LUM``) encoding:
553 Yc' = (0.2627R + 0.6780G + 0.0593B)'& \\
555 &Cbc = (B' - Yc') / 1.9404 \\
557 &Cbc = (B' - Yc') / 1.5816 \\
559 &Crc = (R' - Y') / 1.7184 \\
561 &Crc = (R' - Y') / 0.9936
564 Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the
565 range [-0.5…0.5]. The Yc'CbcCrc quantization is limited range.
570 Colorspace DCI-P3 (V4L2_COLORSPACE_DCI_P3)
571 ==========================================
573 The :ref:`smpte431` standard defines the colorspace used by cinema
574 projectors that use the DCI-P3 colorspace. The default transfer function
575 is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is
576 ``V4L2_YCBCR_ENC_709``. The default Y'CbCr quantization is limited range.
580 Note that this colorspace standard does not specify a
581 Y'CbCr encoding since it is not meant to be encoded to Y'CbCr. So this
582 default Y'CbCr encoding was picked because it is the HDTV encoding.
584 The chromaticities of the primary colors and the white reference are:
588 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
590 .. flat-table:: DCI-P3 Chromaticities
642 L' = L^{\frac{1}{2.6}}
644 Inverse Transfer function:
650 Y'CbCr encoding is not specified. V4L2 defaults to Rec. 709.
655 Colorspace SMPTE 240M (V4L2_COLORSPACE_SMPTE240M)
656 =================================================
658 The :ref:`smpte240m` standard was an interim standard used during the
659 early days of HDTV (1988-1998). It has been superseded by Rec. 709. The
660 default transfer function is ``V4L2_XFER_FUNC_SMPTE240M``. The default
661 Y'CbCr encoding is ``V4L2_YCBCR_ENC_SMPTE240M``. The default Y'CbCr
662 quantization is limited range. The chromaticities of the primary colors
663 and the white reference are:
667 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
669 .. flat-table:: SMPTE 240M Chromaticities
709 - White Reference (D65)
716 These chromaticities are identical to the SMPTE 170M colorspace.
722 L' = 4L\text{, for } 0 \le L < 0.0228
724 L' = 1.1115L ^{0.45} - 0.1115\text{, for } 0.0228 \le L \le 1
726 Inverse Transfer function:
730 L = \frac{L'}{4}\text{, for } 0 \le L' < 0.0913
732 L = \left( \frac{L' + 0.1115}{1.1115}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.0913
734 The luminance (Y') and color difference (Cb and Cr) are obtained with
735 the following ``V4L2_YCBCR_ENC_SMPTE240M`` encoding:
739 Y' = 0.2122R' + 0.7013G' + 0.0865B'
741 Cb = -0.1161R' - 0.3839G' + 0.5B'
743 Cr = 0.5R' - 0.4451G' - 0.0549B'
745 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the
746 range [-0.5…0.5]. The Y'CbCr quantization is limited range.
751 Colorspace NTSC 1953 (V4L2_COLORSPACE_470_SYSTEM_M)
752 ===================================================
754 This standard defines the colorspace used by NTSC in 1953. In practice
755 this colorspace is obsolete and SMPTE 170M should be used instead. The
756 default transfer function is ``V4L2_XFER_FUNC_709``. The default Y'CbCr
757 encoding is ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is
758 limited range. The chromaticities of the primary colors and the white
763 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
765 .. flat-table:: NTSC 1953 Chromaticities
805 - White Reference (C)
814 This colorspace uses Illuminant C instead of D65 as the white
815 reference. To correctly convert an image in this colorspace to another
816 that uses D65 you need to apply a chromatic adaptation algorithm such as
819 The transfer function was never properly defined for NTSC 1953. The Rec.
820 709 transfer function is recommended in the literature:
824 L' = 4.5L\text{, for } 0 \le L < 0.018
826 L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1
828 Inverse Transfer function:
832 L = \frac{L'}{4.5} \text{, for } L' < 0.081
834 L = \left( \frac{L' + 0.099}{1.099}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081
836 The luminance (Y') and color difference (Cb and Cr) are obtained with
837 the following ``V4L2_YCBCR_ENC_601`` encoding:
841 Y' = 0.2990R' + 0.5870G' + 0.1140B'
843 Cb = -0.1687R' - 0.3313G' + 0.5B'
845 Cr = 0.5R' - 0.4187G' - 0.0813B'
847 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
848 [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is
849 identical to one defined in SMPTE 170M/BT.601.
854 Colorspace EBU Tech. 3213 (V4L2_COLORSPACE_470_SYSTEM_BG)
855 =========================================================
857 The :ref:`tech3213` standard defines the colorspace used by PAL/SECAM
858 in 1975. In practice this colorspace is obsolete and SMPTE 170M should
859 be used instead. The default transfer function is
860 ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is
861 ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited
862 range. The chromaticities of the primary colors and the white reference
867 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
869 .. flat-table:: EBU Tech. 3213 Chromaticities
909 - White Reference (D65)
917 The transfer function was never properly defined for this colorspace.
918 The Rec. 709 transfer function is recommended in the literature:
922 L' = 4.5L\text{, for } 0 \le L < 0.018
924 L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1
926 Inverse Transfer function:
930 L = \frac{L'}{4.5} \text{, for } L' < 0.081
932 L = \left(\frac{L' + 0.099}{1.099} \right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081
934 The luminance (Y') and color difference (Cb and Cr) are obtained with
935 the following ``V4L2_YCBCR_ENC_601`` encoding:
939 Y' = 0.2990R' + 0.5870G' + 0.1140B'
941 Cb = -0.1687R' - 0.3313G' + 0.5B'
943 Cr = 0.5R' - 0.4187G' - 0.0813B'
945 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
946 [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is
947 identical to one defined in SMPTE 170M/BT.601.
952 Colorspace JPEG (V4L2_COLORSPACE_JPEG)
953 ======================================
955 This colorspace defines the colorspace used by most (Motion-)JPEG
956 formats. The chromaticities of the primary colors and the white
957 reference are identical to sRGB. The transfer function use is
958 ``V4L2_XFER_FUNC_SRGB``. The Y'CbCr encoding is ``V4L2_YCBCR_ENC_601``
959 with full range quantization where Y' is scaled to [0…255] and Cb/Cr are
960 scaled to [-128…128] and then clipped to [-128…127].
964 The JPEG standard does not actually store colorspace
965 information. So if something other than sRGB is used, then the driver
966 will have to set that information explicitly. Effectively
967 ``V4L2_COLORSPACE_JPEG`` can be considered to be an abbreviation for
968 ``V4L2_COLORSPACE_SRGB``, ``V4L2_YCBCR_ENC_601`` and
969 ``V4L2_QUANTIZATION_FULL_RANGE``.