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
77 L' = -1.099(-L) :sup:`0.45` + 0.099 for L ≤ -0.018
79 L' = 4.5L for -0.018 < L < 0.018
81 L' = 1.099L :sup:`0.45` - 0.099 for L ≥ 0.018
83 Inverse Transfer function:
85 L = -((L' - 0.099) / -1.099) :sup:`1/0.45` for L' ≤ -0.081
87 L = L' / 4.5 for -0.081 < L' < 0.081
89 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
91 The luminance (Y') and color difference (Cb and Cr) are obtained with
92 the following ``V4L2_YCBCR_ENC_601`` encoding:
94 Y' = 0.299R' + 0.587G' + 0.114B'
96 Cb = -0.169R' - 0.331G' + 0.5B'
98 Cr = 0.5R' - 0.419G' - 0.081B'
100 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
101 [-0.5…0.5]. This conversion to Y'CbCr is identical to the one defined in
102 the :ref:`itu601` standard and this colorspace is sometimes called
103 BT.601 as well, even though BT.601 does not mention any color primaries.
105 The default quantization is limited range, but full range is possible
106 although rarely seen.
111 Colorspace Rec. 709 (V4L2_COLORSPACE_REC709)
112 ============================================
114 The :ref:`itu709` standard defines the colorspace used by HDTV in
115 general. The default transfer function is ``V4L2_XFER_FUNC_709``. The
116 default Y'CbCr encoding is ``V4L2_YCBCR_ENC_709``. The default Y'CbCr
117 quantization is limited range. The chromaticities of the primary colors
118 and the white reference are:
122 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
124 .. flat-table:: Rec. 709 Chromaticities
164 - White Reference (D65)
171 The full name of this standard is Rec. ITU-R BT.709-5.
173 Transfer function. Normally L is in the range [0…1], but for the
174 extended gamut xvYCC encoding values outside that range are allowed.
176 L' = -1.099(-L) :sup:`0.45` + 0.099 for L ≤ -0.018
178 L' = 4.5L for -0.018 < L < 0.018
180 L' = 1.099L :sup:`0.45` - 0.099 for L ≥ 0.018
182 Inverse Transfer function:
184 L = -((L' - 0.099) / -1.099) :sup:`1/0.45` for L' ≤ -0.081
186 L = L' / 4.5 for -0.081 < L' < 0.081
188 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
190 The luminance (Y') and color difference (Cb and Cr) are obtained with
191 the following ``V4L2_YCBCR_ENC_709`` encoding:
193 Y' = 0.2126R' + 0.7152G' + 0.0722B'
195 Cb = -0.1146R' - 0.3854G' + 0.5B'
197 Cr = 0.5R' - 0.4542G' - 0.0458B'
199 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
202 The default quantization is limited range, but full range is possible
203 although rarely seen.
205 The ``V4L2_YCBCR_ENC_709`` encoding described above is the default for
206 this colorspace, but it can be overridden with ``V4L2_YCBCR_ENC_601``,
207 in which case the BT.601 Y'CbCr encoding is used.
209 Two additional extended gamut Y'CbCr encodings are also possible with
212 The xvYCC 709 encoding (``V4L2_YCBCR_ENC_XV709``, :ref:`xvycc`) is
213 similar to the Rec. 709 encoding, but it allows for R', G' and B' values
214 that are outside the range [0…1]. The resulting Y', Cb and Cr values are
217 Y' = (219 / 256) * (0.2126R' + 0.7152G' + 0.0722B') + (16 / 256)
219 Cb = (224 / 256) * (-0.1146R' - 0.3854G' + 0.5B')
221 Cr = (224 / 256) * (0.5R' - 0.4542G' - 0.0458B')
223 The xvYCC 601 encoding (``V4L2_YCBCR_ENC_XV601``, :ref:`xvycc`) is
224 similar to the BT.601 encoding, but it allows for R', G' and B' values
225 that are outside the range [0…1]. The resulting Y', Cb and Cr values are
228 Y' = (219 / 256) * (0.299R' + 0.587G' + 0.114B') + (16 / 256)
230 Cb = (224 / 256) * (-0.169R' - 0.331G' + 0.5B')
232 Cr = (224 / 256) * (0.5R' - 0.419G' - 0.081B')
234 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
235 [-0.5…0.5]. The non-standard xvYCC 709 or xvYCC 601 encodings can be
236 used by selecting ``V4L2_YCBCR_ENC_XV709`` or ``V4L2_YCBCR_ENC_XV601``.
237 The xvYCC encodings always use full range quantization.
242 Colorspace sRGB (V4L2_COLORSPACE_SRGB)
243 ======================================
245 The :ref:`srgb` standard defines the colorspace used by most webcams
246 and computer graphics. The default transfer function is
247 ``V4L2_XFER_FUNC_SRGB``. The default Y'CbCr encoding is
248 ``V4L2_YCBCR_ENC_SYCC``. The default Y'CbCr quantization is full range.
249 The chromaticities of the primary colors and the white reference are:
253 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
255 .. flat-table:: sRGB Chromaticities
295 - White Reference (D65)
302 These chromaticities are identical to the Rec. 709 colorspace.
304 Transfer function. Note that negative values for L are only used by the
307 L' = -1.055(-L) :sup:`1/2.4` + 0.055 for L < -0.0031308
309 L' = 12.92L for -0.0031308 ≤ L ≤ 0.0031308
311 L' = 1.055L :sup:`1/2.4` - 0.055 for 0.0031308 < L ≤ 1
313 Inverse Transfer function:
315 L = -((-L' + 0.055) / 1.055) :sup:`2.4` for L' < -0.04045
317 L = L' / 12.92 for -0.04045 ≤ L' ≤ 0.04045
319 L = ((L' + 0.055) / 1.055) :sup:`2.4` for L' > 0.04045
321 The luminance (Y') and color difference (Cb and Cr) are obtained with
322 the following ``V4L2_YCBCR_ENC_SYCC`` encoding as defined by
325 Y' = 0.2990R' + 0.5870G' + 0.1140B'
327 Cb = -0.1687R' - 0.3313G' + 0.5B'
329 Cr = 0.5R' - 0.4187G' - 0.0813B'
331 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
332 [-0.5…0.5]. The ``V4L2_YCBCR_ENC_SYCC`` quantization is always full
333 range. Although this Y'CbCr encoding looks very similar to the
334 ``V4L2_YCBCR_ENC_XV601`` encoding, it is not. The
335 ``V4L2_YCBCR_ENC_XV601`` scales and offsets the Y'CbCr values before
336 quantization, but this encoding does not do that.
341 Colorspace Adobe RGB (V4L2_COLORSPACE_ADOBERGB)
342 ===============================================
344 The :ref:`adobergb` standard defines the colorspace used by computer
345 graphics that use the AdobeRGB colorspace. This is also known as the
346 :ref:`oprgb` standard. The default transfer function is
347 ``V4L2_XFER_FUNC_ADOBERGB``. The default Y'CbCr encoding is
348 ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited
349 range. The chromaticities of the primary colors and the white reference
354 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
356 .. flat-table:: Adobe RGB Chromaticities
396 - White Reference (D65)
406 L' = L :sup:`1/2.19921875`
408 Inverse Transfer function:
410 L = L' :sup:`2.19921875`
412 The luminance (Y') and color difference (Cb and Cr) are obtained with
413 the following ``V4L2_YCBCR_ENC_601`` encoding:
415 Y' = 0.299R' + 0.587G' + 0.114B'
417 Cb = -0.169R' - 0.331G' + 0.5B'
419 Cr = 0.5R' - 0.419G' - 0.081B'
421 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
422 [-0.5…0.5]. This transform is identical to one defined in SMPTE
423 170M/BT.601. The Y'CbCr quantization is limited range.
428 Colorspace BT.2020 (V4L2_COLORSPACE_BT2020)
429 ===========================================
431 The :ref:`itu2020` standard defines the colorspace used by Ultra-high
432 definition television (UHDTV). The default transfer function is
433 ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is
434 ``V4L2_YCBCR_ENC_BT2020``. The default R'G'B' quantization is limited
435 range (!), and so is the default Y'CbCr quantization. The chromaticities
436 of the primary colors and the white reference are:
440 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
442 .. flat-table:: BT.2020 Chromaticities
482 - White Reference (D65)
490 Transfer function (same as Rec. 709):
492 L' = 4.5L for 0 ≤ L < 0.018
494 L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1
496 Inverse Transfer function:
498 L = L' / 4.5 for L' < 0.081
500 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
502 The luminance (Y') and color difference (Cb and Cr) are obtained with
503 the following ``V4L2_YCBCR_ENC_BT2020`` encoding:
505 Y' = 0.2627R' + 0.6780G' + 0.0593B'
507 Cb = -0.1396R' - 0.3604G' + 0.5B'
509 Cr = 0.5R' - 0.4598G' - 0.0402B'
511 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
512 [-0.5…0.5]. The Y'CbCr quantization is limited range.
514 There is also an alternate constant luminance R'G'B' to Yc'CbcCrc
515 (``V4L2_YCBCR_ENC_BT2020_CONST_LUM``) encoding:
519 Yc' = (0.2627R + 0.6780G + 0.0593B)'
523 Cbc = (B' - Yc') / 1.9404
527 Cbc = (B' - Yc') / 1.5816
531 Crc = (R' - Y') / 1.7184
535 Crc = (R' - Y') / 0.9936
537 Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the
538 range [-0.5…0.5]. The Yc'CbcCrc quantization is limited range.
543 Colorspace DCI-P3 (V4L2_COLORSPACE_DCI_P3)
544 ==========================================
546 The :ref:`smpte431` standard defines the colorspace used by cinema
547 projectors that use the DCI-P3 colorspace. The default transfer function
548 is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is
549 ``V4L2_YCBCR_ENC_709``.
553 Note that this colorspace does not specify a
554 Y'CbCr encoding since it is not meant to be encoded to Y'CbCr. So this
555 default Y'CbCr encoding was picked because it is the HDTV encoding. The
556 default Y'CbCr quantization is limited range. The chromaticities of the
557 primary colors and the white reference are:
561 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
563 .. flat-table:: DCI-P3 Chromaticities
615 Inverse Transfer function:
619 Y'CbCr encoding is not specified. V4L2 defaults to Rec. 709.
624 Colorspace SMPTE 240M (V4L2_COLORSPACE_SMPTE240M)
625 =================================================
627 The :ref:`smpte240m` standard was an interim standard used during the
628 early days of HDTV (1988-1998). It has been superseded by Rec. 709. The
629 default transfer function is ``V4L2_XFER_FUNC_SMPTE240M``. The default
630 Y'CbCr encoding is ``V4L2_YCBCR_ENC_SMPTE240M``. The default Y'CbCr
631 quantization is limited range. The chromaticities of the primary colors
632 and the white reference are:
636 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
638 .. flat-table:: SMPTE 240M Chromaticities
678 - White Reference (D65)
685 These chromaticities are identical to the SMPTE 170M colorspace.
689 L' = 4L for 0 ≤ L < 0.0228
691 L' = 1.1115L :sup:`0.45` - 0.1115 for 0.0228 ≤ L ≤ 1
693 Inverse Transfer function:
695 L = L' / 4 for 0 ≤ L' < 0.0913
697 L = ((L' + 0.1115) / 1.1115) :sup:`1/0.45` for L' ≥ 0.0913
699 The luminance (Y') and color difference (Cb and Cr) are obtained with
700 the following ``V4L2_YCBCR_ENC_SMPTE240M`` encoding:
702 Y' = 0.2122R' + 0.7013G' + 0.0865B'
704 Cb = -0.1161R' - 0.3839G' + 0.5B'
706 Cr = 0.5R' - 0.4451G' - 0.0549B'
708 Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the
709 range [-0.5…0.5]. The Y'CbCr quantization is limited range.
714 Colorspace NTSC 1953 (V4L2_COLORSPACE_470_SYSTEM_M)
715 ===================================================
717 This standard defines the colorspace used by NTSC in 1953. In practice
718 this colorspace is obsolete and SMPTE 170M should be used instead. The
719 default transfer function is ``V4L2_XFER_FUNC_709``. The default Y'CbCr
720 encoding is ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is
721 limited range. The chromaticities of the primary colors and the white
726 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
728 .. flat-table:: NTSC 1953 Chromaticities
768 - White Reference (C)
777 This colorspace uses Illuminant C instead of D65 as the white
778 reference. To correctly convert an image in this colorspace to another
779 that uses D65 you need to apply a chromatic adaptation algorithm such as
782 The transfer function was never properly defined for NTSC 1953. The Rec.
783 709 transfer function is recommended in the literature:
785 L' = 4.5L for 0 ≤ L < 0.018
787 L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1
789 Inverse Transfer function:
791 L = L' / 4.5 for L' < 0.081
793 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
795 The luminance (Y') and color difference (Cb and Cr) are obtained with
796 the following ``V4L2_YCBCR_ENC_601`` encoding:
798 Y' = 0.299R' + 0.587G' + 0.114B'
800 Cb = -0.169R' - 0.331G' + 0.5B'
802 Cr = 0.5R' - 0.419G' - 0.081B'
804 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
805 [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is
806 identical to one defined in SMPTE 170M/BT.601.
811 Colorspace EBU Tech. 3213 (V4L2_COLORSPACE_470_SYSTEM_BG)
812 =========================================================
814 The :ref:`tech3213` standard defines the colorspace used by PAL/SECAM
815 in 1975. In practice this colorspace is obsolete and SMPTE 170M should
816 be used instead. The default transfer function is
817 ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is
818 ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited
819 range. The chromaticities of the primary colors and the white reference
824 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
826 .. flat-table:: EBU Tech. 3213 Chromaticities
866 - White Reference (D65)
874 The transfer function was never properly defined for this colorspace.
875 The Rec. 709 transfer function is recommended in the literature:
877 L' = 4.5L for 0 ≤ L < 0.018
879 L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1
881 Inverse Transfer function:
883 L = L' / 4.5 for L' < 0.081
885 L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081
887 The luminance (Y') and color difference (Cb and Cr) are obtained with
888 the following ``V4L2_YCBCR_ENC_601`` encoding:
890 Y' = 0.299R' + 0.587G' + 0.114B'
892 Cb = -0.169R' - 0.331G' + 0.5B'
894 Cr = 0.5R' - 0.419G' - 0.081B'
896 Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range
897 [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is
898 identical to one defined in SMPTE 170M/BT.601.
903 Colorspace JPEG (V4L2_COLORSPACE_JPEG)
904 ======================================
906 This colorspace defines the colorspace used by most (Motion-)JPEG
907 formats. The chromaticities of the primary colors and the white
908 reference are identical to sRGB. The transfer function use is
909 ``V4L2_XFER_FUNC_SRGB``. The Y'CbCr encoding is ``V4L2_YCBCR_ENC_601``
910 with full range quantization where Y' is scaled to [0…255] and Cb/Cr are
911 scaled to [-128…128] and then clipped to [-128…127].
915 The JPEG standard does not actually store colorspace
916 information. So if something other than sRGB is used, then the driver
917 will have to set that information explicitly. Effectively
918 ``V4L2_COLORSPACE_JPEG`` can be considered to be an abbreviation for
919 ``V4L2_COLORSPACE_SRGB``, ``V4L2_YCBCR_ENC_601`` and
920 ``V4L2_QUANTIZATION_FULL_RANGE``.