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 .. flat-table:: SMPTE 170M Chromaticities
62 - White Reference (D65)
69 The red, green and blue chromaticities are also often referred to as the
70 SMPTE C set, so this colorspace is sometimes called SMPTE C as well.
72 The transfer function defined for SMPTE 170M is the same as the one
75 L' = -1.099(-L) :sup:`0.45` + 0.099 for L ≤ -0.018
77 L' = 4.5L for -0.018 < L < 0.018
79 L' = 1.099L :sup:`0.45` - 0.099 for L ≥ 0.018
81 Inverse Transfer function:
83 L = -((L' - 0.099) / -1.099) :sup:`1/0.45` for L' ≤ -0.081
85 L = L' / 4.5 for -0.081 < L' < 0.081
87 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
89 The luminance (Y') and color difference (Cb and Cr) are obtained with
90 the following ``V4L2_YCBCR_ENC_601`` encoding:
92 Y' = 0.299R' + 0.587G' + 0.114B'
94 Cb = -0.169R' - 0.331G' + 0.5B'
96 Cr = 0.5R' - 0.419G' - 0.081B'
98 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
99 [-0.5…0.5]. This conversion to Y'CbCr is identical to the one defined in
100 the :ref:`itu601` standard and this colorspace is sometimes called
101 BT.601 as well, even though BT.601 does not mention any color primaries.
103 The default quantization is limited range, but full range is possible
104 although rarely seen.
109 Colorspace Rec. 709 (V4L2_COLORSPACE_REC709)
110 ============================================
112 The :ref:`itu709` standard defines the colorspace used by HDTV in
113 general. The default transfer function is ``V4L2_XFER_FUNC_709``. The
114 default Y'CbCr encoding is ``V4L2_YCBCR_ENC_709``. The default Y'CbCr
115 quantization is limited range. The chromaticities of the primary colors
116 and the white reference are:
120 .. flat-table:: Rec. 709 Chromaticities
160 - White Reference (D65)
167 The full name of this standard is Rec. ITU-R BT.709-5.
169 Transfer function. Normally L is in the range [0…1], but for the
170 extended gamut xvYCC encoding values outside that range are allowed.
172 L' = -1.099(-L) :sup:`0.45` + 0.099 for L ≤ -0.018
174 L' = 4.5L for -0.018 < L < 0.018
176 L' = 1.099L :sup:`0.45` - 0.099 for L ≥ 0.018
178 Inverse Transfer function:
180 L = -((L' - 0.099) / -1.099) :sup:`1/0.45` for L' ≤ -0.081
182 L = L' / 4.5 for -0.081 < L' < 0.081
184 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
186 The luminance (Y') and color difference (Cb and Cr) are obtained with
187 the following ``V4L2_YCBCR_ENC_709`` encoding:
189 Y' = 0.2126R' + 0.7152G' + 0.0722B'
191 Cb = -0.1146R' - 0.3854G' + 0.5B'
193 Cr = 0.5R' - 0.4542G' - 0.0458B'
195 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
198 The default quantization is limited range, but full range is possible
199 although rarely seen.
201 The ``V4L2_YCBCR_ENC_709`` encoding described above is the default for
202 this colorspace, but it can be overridden with ``V4L2_YCBCR_ENC_601``,
203 in which case the BT.601 Y'CbCr encoding is used.
205 Two additional extended gamut Y'CbCr encodings are also possible with
208 The xvYCC 709 encoding (``V4L2_YCBCR_ENC_XV709``, :ref:`xvycc`) is
209 similar to the Rec. 709 encoding, but it allows for R', G' and B' values
210 that are outside the range [0…1]. The resulting Y', Cb and Cr values are
213 Y' = (219 / 256) * (0.2126R' + 0.7152G' + 0.0722B') + (16 / 256)
215 Cb = (224 / 256) * (-0.1146R' - 0.3854G' + 0.5B')
217 Cr = (224 / 256) * (0.5R' - 0.4542G' - 0.0458B')
219 The xvYCC 601 encoding (``V4L2_YCBCR_ENC_XV601``, :ref:`xvycc`) is
220 similar to the BT.601 encoding, but it allows for R', G' and B' values
221 that are outside the range [0…1]. The resulting Y', Cb and Cr values are
224 Y' = (219 / 256) * (0.299R' + 0.587G' + 0.114B') + (16 / 256)
226 Cb = (224 / 256) * (-0.169R' - 0.331G' + 0.5B')
228 Cr = (224 / 256) * (0.5R' - 0.419G' - 0.081B')
230 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
231 [-0.5…0.5]. The non-standard xvYCC 709 or xvYCC 601 encodings can be
232 used by selecting ``V4L2_YCBCR_ENC_XV709`` or ``V4L2_YCBCR_ENC_XV601``.
233 The xvYCC encodings always use full range quantization.
238 Colorspace sRGB (V4L2_COLORSPACE_SRGB)
239 ======================================
241 The :ref:`srgb` standard defines the colorspace used by most webcams
242 and computer graphics. The default transfer function is
243 ``V4L2_XFER_FUNC_SRGB``. The default Y'CbCr encoding is
244 ``V4L2_YCBCR_ENC_SYCC``. The default Y'CbCr quantization is full range.
245 The chromaticities of the primary colors and the white reference are:
249 .. flat-table:: sRGB Chromaticities
289 - White Reference (D65)
296 These chromaticities are identical to the Rec. 709 colorspace.
298 Transfer function. Note that negative values for L are only used by the
301 L' = -1.055(-L) :sup:`1/2.4` + 0.055 for L < -0.0031308
303 L' = 12.92L for -0.0031308 ≤ L ≤ 0.0031308
305 L' = 1.055L :sup:`1/2.4` - 0.055 for 0.0031308 < L ≤ 1
307 Inverse Transfer function:
309 L = -((-L' + 0.055) / 1.055) :sup:`2.4` for L' < -0.04045
311 L = L' / 12.92 for -0.04045 ≤ L' ≤ 0.04045
313 L = ((L' + 0.055) / 1.055) :sup:`2.4` for L' > 0.04045
315 The luminance (Y') and color difference (Cb and Cr) are obtained with
316 the following ``V4L2_YCBCR_ENC_SYCC`` encoding as defined by
319 Y' = 0.2990R' + 0.5870G' + 0.1140B'
321 Cb = -0.1687R' - 0.3313G' + 0.5B'
323 Cr = 0.5R' - 0.4187G' - 0.0813B'
325 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
326 [-0.5…0.5]. The ``V4L2_YCBCR_ENC_SYCC`` quantization is always full
327 range. Although this Y'CbCr encoding looks very similar to the
328 ``V4L2_YCBCR_ENC_XV601`` encoding, it is not. The
329 ``V4L2_YCBCR_ENC_XV601`` scales and offsets the Y'CbCr values before
330 quantization, but this encoding does not do that.
335 Colorspace Adobe RGB (V4L2_COLORSPACE_ADOBERGB)
336 ===============================================
338 The :ref:`adobergb` standard defines the colorspace used by computer
339 graphics that use the AdobeRGB colorspace. This is also known as the
340 :ref:`oprgb` standard. The default transfer function is
341 ``V4L2_XFER_FUNC_ADOBERGB``. The default Y'CbCr encoding is
342 ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited
343 range. The chromaticities of the primary colors and the white reference
348 .. flat-table:: Adobe RGB Chromaticities
388 - White Reference (D65)
398 L' = L :sup:`1/2.19921875`
400 Inverse Transfer function:
402 L = L' :sup:`2.19921875`
404 The luminance (Y') and color difference (Cb and Cr) are obtained with
405 the following ``V4L2_YCBCR_ENC_601`` encoding:
407 Y' = 0.299R' + 0.587G' + 0.114B'
409 Cb = -0.169R' - 0.331G' + 0.5B'
411 Cr = 0.5R' - 0.419G' - 0.081B'
413 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
414 [-0.5…0.5]. This transform is identical to one defined in SMPTE
415 170M/BT.601. The Y'CbCr quantization is limited range.
420 Colorspace BT.2020 (V4L2_COLORSPACE_BT2020)
421 ===========================================
423 The :ref:`itu2020` standard defines the colorspace used by Ultra-high
424 definition television (UHDTV). The default transfer function is
425 ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is
426 ``V4L2_YCBCR_ENC_BT2020``. The default R'G'B' quantization is limited
427 range (!), and so is the default Y'CbCr quantization. The chromaticities
428 of the primary colors and the white reference are:
432 .. flat-table:: BT.2020 Chromaticities
472 - White Reference (D65)
480 Transfer function (same as Rec. 709):
482 L' = 4.5L for 0 ≤ L < 0.018
484 L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1
486 Inverse Transfer function:
488 L = L' / 4.5 for L' < 0.081
490 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
492 The luminance (Y') and color difference (Cb and Cr) are obtained with
493 the following ``V4L2_YCBCR_ENC_BT2020`` encoding:
495 Y' = 0.2627R' + 0.6780G' + 0.0593B'
497 Cb = -0.1396R' - 0.3604G' + 0.5B'
499 Cr = 0.5R' - 0.4598G' - 0.0402B'
501 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
502 [-0.5…0.5]. The Y'CbCr quantization is limited range.
504 There is also an alternate constant luminance R'G'B' to Yc'CbcCrc
505 (``V4L2_YCBCR_ENC_BT2020_CONST_LUM``) encoding:
509 Yc' = (0.2627R + 0.6780G + 0.0593B)'
513 Cbc = (B' - Yc') / 1.9404
517 Cbc = (B' - Yc') / 1.5816
521 Crc = (R' - Y') / 1.7184
525 Crc = (R' - Y') / 0.9936
527 Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the
528 range [-0.5…0.5]. The Yc'CbcCrc quantization is limited range.
533 Colorspace DCI-P3 (V4L2_COLORSPACE_DCI_P3)
534 ==========================================
536 The :ref:`smpte431` standard defines the colorspace used by cinema
537 projectors that use the DCI-P3 colorspace. The default transfer function
538 is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is
539 ``V4L2_YCBCR_ENC_709``. Note that this colorspace does not specify a
540 Y'CbCr encoding since it is not meant to be encoded to Y'CbCr. So this
541 default Y'CbCr encoding was picked because it is the HDTV encoding. The
542 default Y'CbCr quantization is limited range. The chromaticities of the
543 primary colors and the white reference are:
547 .. flat-table:: DCI-P3 Chromaticities
599 Inverse Transfer function:
603 Y'CbCr encoding is not specified. V4L2 defaults to Rec. 709.
608 Colorspace SMPTE 240M (V4L2_COLORSPACE_SMPTE240M)
609 =================================================
611 The :ref:`smpte240m` standard was an interim standard used during the
612 early days of HDTV (1988-1998). It has been superseded by Rec. 709. The
613 default transfer function is ``V4L2_XFER_FUNC_SMPTE240M``. The default
614 Y'CbCr encoding is ``V4L2_YCBCR_ENC_SMPTE240M``. The default Y'CbCr
615 quantization is limited range. The chromaticities of the primary colors
616 and the white reference are:
620 .. flat-table:: SMPTE 240M Chromaticities
660 - White Reference (D65)
667 These chromaticities are identical to the SMPTE 170M colorspace.
671 L' = 4L for 0 ≤ L < 0.0228
673 L' = 1.1115L :sup:`0.45` - 0.1115 for 0.0228 ≤ L ≤ 1
675 Inverse Transfer function:
677 L = L' / 4 for 0 ≤ L' < 0.0913
679 L = ((L' + 0.1115) / 1.1115) :sup:`1/0.45` for L' ≥ 0.0913
681 The luminance (Y') and color difference (Cb and Cr) are obtained with
682 the following ``V4L2_YCBCR_ENC_SMPTE240M`` encoding:
684 Y' = 0.2122R' + 0.7013G' + 0.0865B'
686 Cb = -0.1161R' - 0.3839G' + 0.5B'
688 Cr = 0.5R' - 0.4451G' - 0.0549B'
690 Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the
691 range [-0.5…0.5]. The Y'CbCr quantization is limited range.
696 Colorspace NTSC 1953 (V4L2_COLORSPACE_470_SYSTEM_M)
697 ===================================================
699 This standard defines the colorspace used by NTSC in 1953. In practice
700 this colorspace is obsolete and SMPTE 170M should be used instead. The
701 default transfer function is ``V4L2_XFER_FUNC_709``. The default Y'CbCr
702 encoding is ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is
703 limited range. The chromaticities of the primary colors and the white
708 .. flat-table:: NTSC 1953 Chromaticities
748 - White Reference (C)
755 Note that this colorspace uses Illuminant C instead of D65 as the white
756 reference. To correctly convert an image in this colorspace to another
757 that uses D65 you need to apply a chromatic adaptation algorithm such as
760 The transfer function was never properly defined for NTSC 1953. The Rec.
761 709 transfer function is recommended in the literature:
763 L' = 4.5L for 0 ≤ L < 0.018
765 L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1
767 Inverse Transfer function:
769 L = L' / 4.5 for L' < 0.081
771 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
773 The luminance (Y') and color difference (Cb and Cr) are obtained with
774 the following ``V4L2_YCBCR_ENC_601`` encoding:
776 Y' = 0.299R' + 0.587G' + 0.114B'
778 Cb = -0.169R' - 0.331G' + 0.5B'
780 Cr = 0.5R' - 0.419G' - 0.081B'
782 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
783 [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is
784 identical to one defined in SMPTE 170M/BT.601.
789 Colorspace EBU Tech. 3213 (V4L2_COLORSPACE_470_SYSTEM_BG)
790 =========================================================
792 The :ref:`tech3213` standard defines the colorspace used by PAL/SECAM
793 in 1975. In practice this colorspace is obsolete and SMPTE 170M should
794 be used instead. The default transfer function is
795 ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is
796 ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited
797 range. The chromaticities of the primary colors and the white reference
802 .. flat-table:: EBU Tech. 3213 Chromaticities
842 - White Reference (D65)
850 The transfer function was never properly defined for this colorspace.
851 The Rec. 709 transfer function is recommended in the literature:
853 L' = 4.5L for 0 ≤ L < 0.018
855 L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1
857 Inverse Transfer function:
859 L = L' / 4.5 for L' < 0.081
861 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
863 The luminance (Y') and color difference (Cb and Cr) are obtained with
864 the following ``V4L2_YCBCR_ENC_601`` encoding:
866 Y' = 0.299R' + 0.587G' + 0.114B'
868 Cb = -0.169R' - 0.331G' + 0.5B'
870 Cr = 0.5R' - 0.419G' - 0.081B'
872 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
873 [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is
874 identical to one defined in SMPTE 170M/BT.601.
879 Colorspace JPEG (V4L2_COLORSPACE_JPEG)
880 ======================================
882 This colorspace defines the colorspace used by most (Motion-)JPEG
883 formats. The chromaticities of the primary colors and the white
884 reference are identical to sRGB. The transfer function use is
885 ``V4L2_XFER_FUNC_SRGB``. The Y'CbCr encoding is ``V4L2_YCBCR_ENC_601``
886 with full range quantization where Y' is scaled to [0…255] and Cb/Cr are
887 scaled to [-128…128] and then clipped to [-128…127].
889 Note that the JPEG standard does not actually store colorspace
890 information. So if something other than sRGB is used, then the driver
891 will have to set that information explicitly. Effectively
892 ``V4L2_COLORSPACE_JPEG`` can be considered to be an abbreviation for
893 ``V4L2_COLORSPACE_SRGB``, ``V4L2_YCBCR_ENC_601`` and
894 ``V4L2_QUANTIZATION_FULL_RANGE``.