V4L2_COLORSPACE_SMPTE170M
)V4L2_COLORSPACE_REC709
)V4L2_COLORSPACE_SRGB
)V4L2_COLORSPACE_ADOBERGB
)V4L2_COLORSPACE_BT2020
)V4L2_COLORSPACE_SMPTE240M
)V4L2_COLORSPACE_470_SYSTEM_M
)V4L2_COLORSPACE_470_SYSTEM_BG
)V4L2_COLORSPACE_JPEG
)The [SMPTE 170M] standard defines the colorspace used by NTSC and PAL and by SDTV
in general. The default Y'CbCr encoding is V4L2_YCBCR_ENC_601
.
The default Y'CbCr quantization is limited range. The chromaticities of the primary colors and
the white reference are:
Table 2.7. SMPTE 170M Chromaticities
Color | x | y |
---|---|---|
Red | 0.630 | 0.340 |
Green | 0.310 | 0.595 |
Blue | 0.155 | 0.070 |
White Reference (D65) | 0.3127 | 0.3290 |
The red, green and blue chromaticities are also often referred to as the SMPTE C set, so this colorspace is sometimes called SMPTE C as well.
L' = -1.099(-L)0.45 + 0.099 for L ≤ -0.018
L' = 4.5L for -0.018 < L < 0.018
L' = 1.099L0.45 - 0.099 for L ≥ 0.018
L = -((L' - 0.099) / -1.099)1/0.45 for L' ≤ -0.081
L = L' / 4.5 for -0.081 < L' < 0.081
L = ((L' + 0.099) / 1.099)1/0.45 for L' ≥ 0.081
V4L2_YCBCR_ENC_601
encoding:Y' = 0.299R' + 0.587G' + 0.114B'
Cb = -0.169R' - 0.331G' + 0.5B'
Cr = 0.5R' - 0.419G' - 0.081B'
Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. This conversion to Y'CbCr is identical to the one defined in the [ITU BT.601] standard and this colorspace is sometimes called BT.601 as well, even though BT.601 does not mention any color primaries.
The default quantization is limited range, but full range is possible although rarely seen.
The [ITU BT.709] standard defines the colorspace used by HDTV in general. The default
Y'CbCr encoding is V4L2_YCBCR_ENC_709
. The default Y'CbCr quantization is
limited range. The chromaticities of the primary colors and the white reference are:
Table 2.8. Rec. 709 Chromaticities
Color | x | y |
---|---|---|
Red | 0.640 | 0.330 |
Green | 0.300 | 0.600 |
Blue | 0.150 | 0.060 |
White Reference (D65) | 0.3127 | 0.3290 |
The full name of this standard is Rec. ITU-R BT.709-5.
L' = -1.099(-L)0.45 + 0.099 for L ≤ -0.018
L' = 4.5L for -0.018 < L < 0.018
L' = 1.099L0.45 - 0.099 for L ≥ 0.018
L = -((L' - 0.099) / -1.099)1/0.45 for L' ≤ -0.081
L = L' / 4.5 for -0.081 < L' < 0.081
L = ((L' + 0.099) / 1.099)1/0.45 for L' ≥ 0.081
V4L2_YCBCR_ENC_709
encoding:Y' = 0.2126R' + 0.7152G' + 0.0722B'
Cb = -0.1146R' - 0.3854G' + 0.5B'
Cr = 0.5R' - 0.4542G' - 0.0458B'
Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5].
The default quantization is limited range, but full range is possible although rarely seen.
The V4L2_YCBCR_ENC_709
encoding described above is the default
for this colorspace, but it can be overridden with V4L2_YCBCR_ENC_601
, in which
case the BT.601 Y'CbCr encoding is used.
Two additional extended gamut Y'CbCr encodings are also possible with this colorspace:
V4L2_YCBCR_ENC_XV709
, [xvYCC])
is similar to the Rec. 709 encoding, but it allows for R', G' and B' values that are outside the range
[0…1]. The resulting Y', Cb and Cr values are scaled and offset:Y' = (219 / 256) * (0.2126R' + 0.7152G' + 0.0722B') + (16 / 256)
Cb = (224 / 256) * (-0.1146R' - 0.3854G' + 0.5B')
Cr = (224 / 256) * (0.5R' - 0.4542G' - 0.0458B')
V4L2_YCBCR_ENC_XV601
, [xvYCC]) is similar
to the BT.601 encoding, but it allows for R', G' and B' values that are outside the range
[0…1]. The resulting Y', Cb and Cr values are scaled and offset:Y' = (219 / 256) * (0.299R' + 0.587G' + 0.114B') + (16 / 256)
Cb = (224 / 256) * (-0.169R' - 0.331G' + 0.5B')
Cr = (224 / 256) * (0.5R' - 0.419G' - 0.081B')
Y' is clamped to the range [0…1] and Cb and Cr are clamped
to the range [-0.5…0.5]. The non-standard xvYCC 709 or xvYCC 601 encodings can be used by
selecting V4L2_YCBCR_ENC_XV709
or V4L2_YCBCR_ENC_XV601
.
The xvYCC encodings always use full range quantization.
The [sRGB] standard defines the colorspace used by most webcams and computer graphics. The
default Y'CbCr encoding is V4L2_YCBCR_ENC_SYCC
. The default Y'CbCr quantization
is full range. The chromaticities of the primary colors and the white reference are:
Table 2.9. sRGB Chromaticities
Color | x | y |
---|---|---|
Red | 0.640 | 0.330 |
Green | 0.300 | 0.600 |
Blue | 0.150 | 0.060 |
White Reference (D65) | 0.3127 | 0.3290 |
These chromaticities are identical to the Rec. 709 colorspace.
L' = -1.055(-L)1/2.4 + 0.055 for L < -0.0031308
L' = 12.92L for -0.0031308 ≤ L ≤ 0.0031308
L' = 1.055L1/2.4 - 0.055 for 0.0031308 < L ≤ 1
L = -((-L' + 0.055) / 1.055)2.4 for L' < -0.04045
L = L' / 12.92 for -0.04045 ≤ L' ≤ 0.04045
L = ((L' + 0.055) / 1.055)2.4 for L' > 0.04045
V4L2_YCBCR_ENC_SYCC
encoding as defined by [sYCC]:Y' = 0.2990R' + 0.5870G' + 0.1140B'
Cb = -0.1687R' - 0.3313G' + 0.5B'
Cr = 0.5R' - 0.4187G' - 0.0813B'
Y' is clamped to the range [0…1] and Cb and Cr are clamped
to the range [-0.5…0.5]. The V4L2_YCBCR_ENC_SYCC
quantization is always
full range. Although this Y'CbCr encoding looks very similar to the V4L2_YCBCR_ENC_XV601
encoding, it is not. The V4L2_YCBCR_ENC_XV601
scales and offsets the Y'CbCr
values before quantization, but this encoding does not do that.
The [AdobeRGB] standard defines the colorspace used by computer graphics
that use the AdobeRGB colorspace. This is also known as the [opRGB] standard.
The default Y'CbCr encoding is V4L2_YCBCR_ENC_601
. The default Y'CbCr
quantization is limited range. The chromaticities of the primary colors and the white reference
are:
Table 2.10. Adobe RGB Chromaticities
Color | x | y |
---|---|---|
Red | 0.6400 | 0.3300 |
Green | 0.2100 | 0.7100 |
Blue | 0.1500 | 0.0600 |
White Reference (D65) | 0.3127 | 0.3290 |
L' = L1/2.19921875
L = L'2.19921875
V4L2_YCBCR_ENC_601
encoding:Y' = 0.299R' + 0.587G' + 0.114B'
Cb = -0.169R' - 0.331G' + 0.5B'
Cr = 0.5R' - 0.419G' - 0.081B'
Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. This transform is identical to one defined in SMPTE 170M/BT.601. The Y'CbCr quantization is limited range.
The [ITU BT.2020] standard defines the colorspace used by Ultra-high definition
television (UHDTV). The default Y'CbCr encoding is V4L2_YCBCR_ENC_BT2020
.
The default R'G'B' quantization is limited range (!), and so is the default Y'CbCr quantization.
The chromaticities of the primary colors and the white reference are:
Table 2.11. BT.2020 Chromaticities
Color | x | y |
---|---|---|
Red | 0.708 | 0.292 |
Green | 0.170 | 0.797 |
Blue | 0.131 | 0.046 |
White Reference (D65) | 0.3127 | 0.3290 |
L' = 4.5L for 0 ≤ L < 0.018
L' = 1.099L0.45 - 0.099 for 0.018 ≤ L ≤ 1
L = L' / 4.5 for L' < 0.081
L = ((L' + 0.099) / 1.099)1/0.45 for L' ≥ 0.081
V4L2_YCBCR_ENC_BT2020
encoding:Y' = 0.2627R' + 0.6780G' + 0.0593B'
Cb = -0.1396R' - 0.3604G' + 0.5B'
Cr = 0.5R' - 0.4598G' - 0.0402B'
Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. The Y'CbCr quantization is limited range.
There is also an alternate constant luminance R'G'B' to Yc'CbcCrc
(V4L2_YCBCR_ENC_BT2020_CONST_LUM
) encoding:
Yc' = (0.2627R + 0.6780G + 0.0593B)'
Cbc = (B' - Yc') / 1.9404
Cbc = (B' - Yc') / 1.5816
Crc = (R' - Y') / 1.7184
Crc = (R' - Y') / 0.9936
Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the range [-0.5…0.5]. The Yc'CbcCrc quantization is limited range.
The [SMPTE 240M] standard was an interim standard used during the early days of HDTV (1988-1998).
It has been superseded by Rec. 709. The default Y'CbCr encoding is V4L2_YCBCR_ENC_SMPTE240M
.
The default Y'CbCr quantization is limited range. The chromaticities of the primary colors and the
white reference are:
Table 2.12. SMPTE 240M Chromaticities
Color | x | y |
---|---|---|
Red | 0.630 | 0.340 |
Green | 0.310 | 0.595 |
Blue | 0.155 | 0.070 |
White Reference (D65) | 0.3127 | 0.3290 |
These chromaticities are identical to the SMPTE 170M colorspace.
L' = 4L for 0 ≤ L < 0.0228
L' = 1.1115L0.45 - 0.1115 for 0.0228 ≤ L ≤ 1
L = L' / 4 for 0 ≤ L' < 0.0913
L = ((L' + 0.1115) / 1.1115)1/0.45 for L' ≥ 0.0913
V4L2_YCBCR_ENC_SMPTE240M
encoding:Y' = 0.2122R' + 0.7013G' + 0.0865B'
Cb = -0.1161R' - 0.3839G' + 0.5B'
Cr = 0.5R' - 0.4451G' - 0.0549B'
Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the range [-0.5…0.5]. The Y'CbCr quantization is limited range.
This standard defines the colorspace used by NTSC in 1953. In practice this
colorspace is obsolete and SMPTE 170M should be used instead. The default Y'CbCr encoding
is V4L2_YCBCR_ENC_601
. The default Y'CbCr quantization is limited range.
The chromaticities of the primary colors and the white reference are:
Table 2.13. NTSC 1953 Chromaticities
Color | x | y |
---|---|---|
Red | 0.67 | 0.33 |
Green | 0.21 | 0.71 |
Blue | 0.14 | 0.08 |
White Reference (C) | 0.310 | 0.316 |
Note that this colorspace uses Illuminant C instead of D65 as the white reference. To correctly convert an image in this colorspace to another that uses D65 you need to apply a chromatic adaptation algorithm such as the Bradford method.
L' = 4.5L for 0 ≤ L < 0.018
L' = 1.099L0.45 - 0.099 for 0.018 ≤ L ≤ 1
L = L' / 4.5 for L' < 0.081
L = ((L' + 0.099) / 1.099)1/0.45 for L' ≥ 0.081
V4L2_YCBCR_ENC_601
encoding:Y' = 0.299R' + 0.587G' + 0.114B'
Cb = -0.169R' - 0.331G' + 0.5B'
Cr = 0.5R' - 0.419G' - 0.081B'
Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is identical to one defined in SMPTE 170M/BT.601.
The [EBU Tech 3213] standard defines the colorspace used by PAL/SECAM in 1975. In practice this
colorspace is obsolete and SMPTE 170M should be used instead. The default Y'CbCr encoding
is V4L2_YCBCR_ENC_601
. The default Y'CbCr quantization is limited range.
The chromaticities of the primary colors and the white reference are:
Table 2.14. EBU Tech. 3213 Chromaticities
Color | x | y |
---|---|---|
Red | 0.64 | 0.33 |
Green | 0.29 | 0.60 |
Blue | 0.15 | 0.06 |
White Reference (D65) | 0.3127 | 0.3290 |
L' = 4.5L for 0 ≤ L < 0.018
L' = 1.099L0.45 - 0.099 for 0.018 ≤ L ≤ 1
L = L' / 4.5 for L' < 0.081
L = ((L' + 0.099) / 1.099)1/0.45 for L' ≥ 0.081
V4L2_YCBCR_ENC_601
encoding:Y' = 0.299R' + 0.587G' + 0.114B'
Cb = -0.169R' - 0.331G' + 0.5B'
Cr = 0.5R' - 0.419G' - 0.081B'
Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is identical to one defined in SMPTE 170M/BT.601.
This colorspace defines the colorspace used by most (Motion-)JPEG formats. The chromaticities
of the primary colors and the white reference are identical to sRGB. The Y'CbCr encoding is
V4L2_YCBCR_ENC_601
with full range quantization where
Y' is scaled to [0…255] and Cb/Cr are scaled to [-128…128] and
then clipped to [-128…127].
Note that the JPEG standard does not actually store colorspace information.
So if something other than sRGB is used, then the driver will have to set that information
explicitly. Effectively V4L2_COLORSPACE_JPEG
can be considered to be
an abbreviation for V4L2_COLORSPACE_SRGB
, V4L2_YCBCR_ENC_601
and V4L2_QUANTIZATION_FULL_RANGE
.