요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
********************************
Detailed Colorspace Descriptions
********************************
.. _col-smpte-170m:
Colorspace SMPTE 170M (V4L2_COLORSPACE_SMPTE170M)
=================================================
The :ref:`smpte170m` standard defines the colorspace used by NTSC and
PAL and by SDTV in general. The default transfer function is
``V4L2_XFER_FUNC_709``. 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:
.. flat-table:: SMPTE 170M Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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.
The transfer function defined for SMPTE 170M is the same as the one
defined in Rec. 709.
.. math::
L' = -1.099(-L)^{0.45} + 0.099 \text{, for } L \le-0.018
L' = 4.5L \text{, for } -0.018 < L < 0.018
L' = 1.099L^{0.45} - 0.099 \text{, for } L \ge 0.018
Inverse Transfer function:
.. math::
L = -\left( \frac{L' - 0.099}{-1.099} \right) ^{\frac{1}{0.45}} \text{, for } L' \le -0.081
L = \frac{L'}{4.5} \text{, for } -0.081 < L' < 0.081
L = \left(\frac{L' + 0.099}{1.099}\right)^{\frac{1}{0.45} } \text{, for } L' \ge 0.081
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding:
.. math::
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]. This conversion to Y'CbCr is identical to the one defined in
the :ref:`itu601` 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.
.. _col-rec709:
Colorspace Rec. 709 (V4L2_COLORSPACE_REC709)
============================================
The :ref:`itu709` standard defines the colorspace used by HDTV in
general. The default transfer function is ``V4L2_XFER_FUNC_709``. 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:
.. flat-table:: Rec. 709 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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.
Transfer function. Normally L is in the range [0…1], but for the
extended gamut xvYCC encoding values outside that range are allowed.
.. math::
L' = -1.099(-L)^{0.45} + 0.099 \text{, for } L \le -0.018
L' = 4.5L \text{, for } -0.018 < L < 0.018
L' = 1.099L^{0.45} - 0.099 \text{, for } L \ge 0.018
Inverse Transfer function:
.. math::
L = -\left( \frac{L' - 0.099}{-1.099} \right)^\frac{1}{0.45} \text{, for } L' \le -0.081
L = \frac{L'}{4.5}\text{, for } -0.081 < L' < 0.081
L = \left(\frac{L' + 0.099}{1.099}\right)^{\frac{1}{0.45} } \text{, for } L' \ge 0.081
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_709`` encoding:
.. math::
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:
The xvYCC 709 encoding (``V4L2_YCBCR_ENC_XV709``, :ref:`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 according to the limited range formula:
.. math::
Y' = \frac{219}{256} * (0.2126R' + 0.7152G' + 0.0722B') + \frac{16}{256}
Cb = \frac{224}{256} * (-0.1146R' - 0.3854G' + 0.5B')
Cr = \frac{224}{256} * (0.5R' - 0.4542G' - 0.0458B')
The xvYCC 601 encoding (``V4L2_YCBCR_ENC_XV601``, :ref:`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 according to the limited range formula:
.. math::
Y' = \frac{219}{256} * (0.2990R' + 0.5870G' + 0.1140B') + \frac{16}{256}
Cb = \frac{224}{256} * (-0.1687R' - 0.3313G' + 0.5B')
Cr = \frac{224}{256} * (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] and quantized without further scaling or offsets.
The non-standard xvYCC 709 or xvYCC 601 encodings can be
used by selecting ``V4L2_YCBCR_ENC_XV709`` or ``V4L2_YCBCR_ENC_XV601``.
As seen by the xvYCC formulas these encodings always use limited range quantization,
there is no full range variant. The whole point of these extended gamut encodings
is that values outside the limited range are still valid, although they
map to R', G' and B' values outside the [0…1] range and are therefore outside
the Rec. 709 colorspace gamut.
.. _col-srgb:
Colorspace sRGB (V4L2_COLORSPACE_SRGB)
======================================
The :ref:`srgb` standard defines the colorspace used by most webcams
and computer graphics. The default transfer function is
``V4L2_XFER_FUNC_SRGB``. The default Y'CbCr encoding is
``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited range.
Note that the :ref:`sycc` standard specifies full range quantization,
however all current capture hardware supported by the kernel convert
R'G'B' to limited range Y'CbCr. So choosing full range as the default
would break how applications interpret the quantization range.
The chromaticities of the primary colors and the white reference are:
.. flat-table:: sRGB Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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.
Transfer function. Note that negative values for L are only used by the
Y'CbCr conversion.
.. math::
L' = -1.055(-L)^{\frac{1}{2.4} } + 0.055\text{, for }L < -0.0031308
L' = 12.92L\text{, for }-0.0031308 \le L \le 0.0031308
L' = 1.055L ^{\frac{1}{2.4} } - 0.055\text{, for }0.0031308 < L \le 1
Inverse Transfer function:
.. math::
L = -((-L' + 0.055) / 1.055) ^{2.4}\text{, for }L' < -0.04045
L = L' / 12.92\text{, for }-0.04045 \le L' \le 0.04045
L = ((L' + 0.055) / 1.055) ^{2.4}\text{, for }L' > 0.04045
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding as defined by :ref:`sycc`:
.. math::
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]. This transform is identical to one defined in SMPTE
170M/BT.601. The Y'CbCr quantization is limited range.
.. _col-oprgb:
Colorspace opRGB (V4L2_COLORSPACE_OPRGB)
===============================================
The :ref:`oprgb` standard defines the colorspace used by computer
graphics that use the opRGB colorspace. The default transfer function is
``V4L2_XFER_FUNC_OPRGB``. The default Y'CbCr encoding is
``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited
range.
Note that the :ref:`oprgb` standard specifies full range quantization,
however all current capture hardware supported by the kernel convert
R'G'B' to limited range Y'CbCr. So choosing full range as the default
would break how applications interpret the quantization range.
The chromaticities of the primary colors and the white reference are:
.. flat-table:: opRGB Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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
Transfer function:
.. math::
L' = L ^{\frac{1}{2.19921875}}
Inverse Transfer function:
.. math::
L = L'^{(2.19921875)}
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding:
.. math::
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]. This transform is identical to one defined in SMPTE
170M/BT.601. The Y'CbCr quantization is limited range.
.. _col-bt2020:
Colorspace BT.2020 (V4L2_COLORSPACE_BT2020)
===========================================
The :ref:`itu2020` standard defines the colorspace used by Ultra-high
definition television (UHDTV). The default transfer function is
``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is
``V4L2_YCBCR_ENC_BT2020``. The default Y'CbCr quantization is limited range.
The chromaticities of the primary colors and the white reference are:
.. flat-table:: BT.2020 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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
Transfer function (same as Rec. 709):
.. math::
L' = 4.5L\text{, for }0 \le L < 0.018
L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1
Inverse Transfer function:
.. math::
L = L' / 4.5\text{, for } L' < 0.081
L = \left( \frac{L' + 0.099}{1.099}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081
Please note that while Rec. 709 is defined as the default transfer function
by the :ref:`itu2020` standard, in practice this colorspace is often used
with the :ref:`xf-smpte-2084`. In particular Ultra HD Blu-ray discs use
this combination.
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_BT2020`` encoding:
.. math::
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:
Luma:
.. math::
:nowrap:
\begin{align*}
Yc' = (0.2627R + 0.6780G + 0.0593B)'& \\
B' - Yc' \le 0:& \\
&Cbc = (B' - Yc') / 1.9404 \\
B' - Yc' > 0: & \\
&Cbc = (B' - Yc') / 1.5816 \\
R' - Yc' \le 0:& \\
&Crc = (R' - Y') / 1.7184 \\
R' - Yc' > 0:& \\
&Crc = (R' - Y') / 0.9936
\end{align*}
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.
.. _col-dcip3:
Colorspace DCI-P3 (V4L2_COLORSPACE_DCI_P3)
==========================================
The :ref:`smpte431` standard defines the colorspace used by cinema
projectors that use the DCI-P3 colorspace. The default transfer function
is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is
``V4L2_YCBCR_ENC_709``. The default Y'CbCr quantization is limited range.
.. note::
Note that this colorspace standard does not specify a
Y'CbCr encoding since it is not meant to be encoded to Y'CbCr. So this
default Y'CbCr encoding was picked because it is the HDTV encoding.
The chromaticities of the primary colors and the white reference are:
.. flat-table:: DCI-P3 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - Color
- x
- y
* - Red
- 0.6800
- 0.3200
* - Green
- 0.2650
- 0.6900
* - Blue
- 0.1500
- 0.0600
* - White Reference
- 0.3140
- 0.3510
Transfer function:
.. math::
L' = L^{\frac{1}{2.6}}
Inverse Transfer function:
.. math::
L = L'^{(2.6)}
Y'CbCr encoding is not specified. V4L2 defaults to Rec. 709.
.. _col-smpte-240m:
Colorspace SMPTE 240M (V4L2_COLORSPACE_SMPTE240M)
=================================================
The :ref:`smpte240m` standard was an interim standard used during the
early days of HDTV (1988-1998). It has been superseded by Rec. 709. The
default transfer function is ``V4L2_XFER_FUNC_SMPTE240M``. 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:
.. flat-table:: SMPTE 240M Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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.
Transfer function:
.. math::
L' = 4L\text{, for } 0 \le L < 0.0228
L' = 1.1115L ^{0.45} - 0.1115\text{, for } 0.0228 \le L \le 1
Inverse Transfer function:
.. math::
L = \frac{L'}{4}\text{, for } 0 \le L' < 0.0913
L = \left( \frac{L' + 0.1115}{1.1115}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.0913
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_SMPTE240M`` encoding:
.. math::
Y' = 0.2122R' + 0.7013G' + 0.0865B'
Cb = -0.1161R' - 0.3839G' + 0.5B'
Cr = 0.5R' - 0.4451G' - 0.0549B'
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.
.. _col-sysm:
Colorspace NTSC 1953 (V4L2_COLORSPACE_470_SYSTEM_M)
===================================================
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 transfer function is ``V4L2_XFER_FUNC_709``. 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:
.. flat-table:: NTSC 1953 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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::
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.
The transfer function was never properly defined for NTSC 1953. The Rec.
709 transfer function is recommended in the literature:
.. math::
L' = 4.5L\text{, for } 0 \le L < 0.018
L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1
Inverse Transfer function:
.. math::
L = \frac{L'}{4.5} \text{, for } L' < 0.081
L = \left( \frac{L' + 0.099}{1.099}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding:
.. math::
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 Y'CbCr quantization is limited range. This transform is
identical to one defined in SMPTE 170M/BT.601.
.. _col-sysbg:
Colorspace EBU Tech. 3213 (V4L2_COLORSPACE_470_SYSTEM_BG)
=========================================================
The :ref:`tech3213` standard defines the colorspace used by PAL/SECAM
in 1975. Note that this colorspace is not supported by the HDMI interface.
Instead :ref:`tech3321` recommends that Rec. 709 is used instead for HDMI.
The default transfer function is
``V4L2_XFER_FUNC_709``. 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:
.. flat-table:: EBU Tech. 3213 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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
The transfer function was never properly defined for this colorspace.
The Rec. 709 transfer function is recommended in the literature:
.. math::
L' = 4.5L\text{, for } 0 \le L < 0.018
L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1
Inverse Transfer function:
.. math::
L = \frac{L'}{4.5} \text{, for } L' < 0.081
L = \left(\frac{L' + 0.099}{1.099} \right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding:
.. math::
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 Y'CbCr quantization is limited range. This transform is
identical to one defined in SMPTE 170M/BT.601.
.. _col-jpeg:
Colorspace JPEG (V4L2_COLORSPACE_JPEG)
======================================
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 transfer function use is
``V4L2_XFER_FUNC_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::
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_XFER_FUNC_SRGB``, ``V4L2_YCBCR_ENC_601``
and ``V4L2_QUANTIZATION_FULL_RANGE``.
***************************************
Detailed Transfer Function Descriptions
***************************************
.. _xf-smpte-2084:
Transfer Function SMPTE 2084 (V4L2_XFER_FUNC_SMPTE2084)
=======================================================
The :ref:`smpte2084` standard defines the transfer function used by
High Dynamic Range content.
Constants:
m1 = (2610 / 4096) / 4
m2 = (2523 / 4096) * 128
c1 = 3424 / 4096
c2 = (2413 / 4096) * 32
c3 = (2392 / 4096) * 32
Transfer function:
L' = ((c1 + c2 * L\ :sup:`m1`) / (1 + c3 * L\ :sup:`m1`))\ :sup:`m2`
Inverse Transfer function:
L = (max(L':sup:`1/m2` - c1, 0) / (c2 - c3 *
L'\ :sup:`1/m2`))\ :sup:`1/m1`
Take care when converting between this transfer function and non-HDR transfer
functions: the linear RGB values [0…1] of HDR content map to a luminance range
of 0 to 10000 cd/m\ :sup:`2` whereas the linear RGB values of non-HDR (aka
Standard Dynamic Range or SDR) map to a luminance range of 0 to 100 cd/m\ :sup:`2`.
To go from SDR to HDR you will have to divide L by 100 first. To go in the other
direction you will have to multiply L by 100. Of course, this clamps all
luminance values over 100 cd/m\ :sup:`2` to 100 cd/m\ :sup:`2`.
There are better methods, see e.g. :ref:`colimg` for more in-depth information
about this.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
SMPTE 170M 색공간
1-85`V4L2_COLORSPACE_SMPTE170M`은 NTSC와 PAL, 일반적인 SDTV에 쓰이는 SMPTE 170M 색공간입니다. 기본 전달 함수는 `V4L2_XFER_FUNC_709`, 기본 Y'CbCr 인코딩은 `V4L2_YCBCR_ENC_601`, 기본 양자화는 제한 범위입니다.
SMPTE C라고도 부르는 색공간의 색도와 기본 V4L2 값입니다.
빨강·초록·파랑 색도 좌표 묶음은 SMPTE C set이라고도 하므로 이 색공간 자체를 SMPTE C라고 부르기도 합니다. 전달 함수는 Rec. 709와 동일한 세 구간 함수이며, 0 부근은 `L'=4.5L`, 양·음의 바깥 구간은 지수 0.45를 사용합니다.
역전달 함수는 `L'`의 경계 -0.081과 0.081을 기준으로 선형 구간과 두 지수 구간을 되돌립니다. 원문의 정방향·역방향 수식과 부호 처리는 아래 원문 블록에 그대로 보존됩니다.
`V4L2_YCBCR_ENC_601` 변환은 `Y'=0.2990R'+0.5870G'+0.1140B'`이고 Cb/Cr에는 각각 B'와 R' 계수 0.5를 사용합니다. Y'는 [0,1], Cb와 Cr은 [-0.5,0.5]로 제한됩니다. 이 변환은 ITU BT.601과 같지만 BT.601 자체는 원색 색도를 규정하지 않습니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
********************************
Detailed Colorspace Descriptions
********************************
.. _col-smpte-170m:
Colorspace SMPTE 170M (V4L2_COLORSPACE_SMPTE170M)
=================================================
The :ref:`smpte170m` standard defines the colorspace used by NTSC and
PAL and by SDTV in general. The default transfer function is
``V4L2_XFER_FUNC_709``. 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:
.. flat-table:: SMPTE 170M Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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.
The transfer function defined for SMPTE 170M is the same as the one
defined in Rec. 709.
.. math::
L' = -1.099(-L)^{0.45} + 0.099 \text{, for } L \le-0.018
L' = 4.5L \text{, for } -0.018 < L < 0.018
L' = 1.099L^{0.45} - 0.099 \text{, for } L \ge 0.018
Inverse Transfer function:
.. math::
L = -\left( \frac{L' - 0.099}{-1.099} \right) ^{\frac{1}{0.45}} \text{, for } L' \le -0.081
L = \frac{L'}{4.5} \text{, for } -0.081 < L' < 0.081
L = \left(\frac{L' + 0.099}{1.099}\right)^{\frac{1}{0.45} } \text{, for } L' \ge 0.081
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding:
.. math::
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]. This conversion to Y'CbCr is identical to the one defined in
the :ref:`itu601` 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.
Rec. 709 색공간과 xvYCC
86-202`V4L2_COLORSPACE_REC709`은 HDTV의 일반 색공간인 Rec. ITU-R BT.709-5를 나타냅니다. 기본 전달 함수는 `V4L2_XFER_FUNC_709`, 기본 인코딩은 `V4L2_YCBCR_ENC_709`, 기본 양자화는 제한 범위입니다.
HDTV 색공간의 색도와 기본 V4L2 값입니다.
전달 함수는 SMPTE 170M과 같은 세 구간 함수입니다. 보통 선형 광량 L은 [0,1]이지만 확장 색역 xvYCC에서는 이 범위 밖의 값도 허용합니다.
709 행렬은 `Y'=0.2126R'+0.7152G'+0.0722B'`, `Cb=-0.1146R'-0.3854G'+0.5B'`, `Cr=0.5R'-0.4542G'-0.0458B'`입니다. Y'는 [0,1], Cb/Cr은 [-0.5,0.5]로 제한됩니다. 필요하면 `V4L2_YCBCR_ENC_601`로 BT.601 행렬을 대신 선택할 수 있습니다.
`V4L2_YCBCR_ENC_XV709`과 `V4L2_YCBCR_ENC_XV601`은 각각 709와 601 계수를 사용하되 R'G'B'의 [0,1] 바깥 값을 허용합니다. Y'에는 219/256 배율과 16/256 오프셋을, Cb/Cr에는 224/256 배율을 적용합니다.
두 xvYCC 선택의 행렬과 공통 양자화 특성입니다.
xvYCC 결과는 Y' [0,1], Cb/Cr [-0.5,0.5]로 제한한 뒤 추가 배율이나 오프셋 없이 양자화합니다. 두 확장 인코딩은 항상 제한 범위를 사용하며 전체 범위 변형은 없습니다.
제한 범위 밖의 코드도 xvYCC에서는 유효합니다. 이는 복원된 R'G'B'가 [0,1]을 벗어나 Rec. 709 gamut 밖의 색을 표현하도록 하는 확장 색역의 핵심입니다.
.. _col-rec709:
Colorspace Rec. 709 (V4L2_COLORSPACE_REC709)
============================================
The :ref:`itu709` standard defines the colorspace used by HDTV in
general. The default transfer function is ``V4L2_XFER_FUNC_709``. 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:
.. flat-table:: Rec. 709 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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.
Transfer function. Normally L is in the range [0…1], but for the
extended gamut xvYCC encoding values outside that range are allowed.
.. math::
L' = -1.099(-L)^{0.45} + 0.099 \text{, for } L \le -0.018
L' = 4.5L \text{, for } -0.018 < L < 0.018
L' = 1.099L^{0.45} - 0.099 \text{, for } L \ge 0.018
Inverse Transfer function:
.. math::
L = -\left( \frac{L' - 0.099}{-1.099} \right)^\frac{1}{0.45} \text{, for } L' \le -0.081
L = \frac{L'}{4.5}\text{, for } -0.081 < L' < 0.081
L = \left(\frac{L' + 0.099}{1.099}\right)^{\frac{1}{0.45} } \text{, for } L' \ge 0.081
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_709`` encoding:
.. math::
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:
The xvYCC 709 encoding (``V4L2_YCBCR_ENC_XV709``, :ref:`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 according to the limited range formula:
.. math::
Y' = \frac{219}{256} * (0.2126R' + 0.7152G' + 0.0722B') + \frac{16}{256}
Cb = \frac{224}{256} * (-0.1146R' - 0.3854G' + 0.5B')
Cr = \frac{224}{256} * (0.5R' - 0.4542G' - 0.0458B')
The xvYCC 601 encoding (``V4L2_YCBCR_ENC_XV601``, :ref:`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 according to the limited range formula:
.. math::
Y' = \frac{219}{256} * (0.2990R' + 0.5870G' + 0.1140B') + \frac{16}{256}
Cb = \frac{224}{256} * (-0.1687R' - 0.3313G' + 0.5B')
Cr = \frac{224}{256} * (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] and quantized without further scaling or offsets.
The non-standard xvYCC 709 or xvYCC 601 encodings can be
used by selecting ``V4L2_YCBCR_ENC_XV709`` or ``V4L2_YCBCR_ENC_XV601``.
As seen by the xvYCC formulas these encodings always use limited range quantization,
there is no full range variant. The whole point of these extended gamut encodings
is that values outside the limited range are still valid, although they
map to R', G' and B' values outside the [0…1] range and are therefore outside
the Rec. 709 colorspace gamut.
sRGB 색공간
203-280`V4L2_COLORSPACE_SRGB`은 대부분의 웹캠과 컴퓨터 그래픽에 쓰입니다. 기본 전달 함수는 `V4L2_XFER_FUNC_SRGB`, 기본 Y'CbCr 인코딩은 `V4L2_YCBCR_ENC_601`, 기본 Y'CbCr 양자화는 제한 범위입니다.
색도는 Rec. 709와 같지만 전달 함수와 사용 환경이 다릅니다.
sYCC 표준은 전체 범위 양자화를 규정하지만, 커널이 지원하는 현재 캡처 하드웨어는 R'G'B'를 제한 범위 Y'CbCr로 변환합니다. V4L2가 전체 범위를 기본으로 삼으면 기존 애플리케이션의 범위 해석을 깨뜨리므로 제한 범위를 유지합니다.
sRGB 전달 함수는 |L|이 0.0031308 이하일 때 `L'=12.92L`, 바깥에서는 지수 1/2.4를 사용합니다. 음의 L은 Y'CbCr 변환에서만 쓰며, 역함수의 신호 경계는 ±0.04045입니다.
Y'CbCr 변환은 sYCC가 정의한 BT.601 계수로 SMPTE 170M과 동일합니다. Y'는 [0,1], Cb/Cr은 [-0.5,0.5]로 제한하고 제한 범위로 양자화합니다.
.. _col-srgb:
Colorspace sRGB (V4L2_COLORSPACE_SRGB)
======================================
The :ref:`srgb` standard defines the colorspace used by most webcams
and computer graphics. The default transfer function is
``V4L2_XFER_FUNC_SRGB``. The default Y'CbCr encoding is
``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited range.
Note that the :ref:`sycc` standard specifies full range quantization,
however all current capture hardware supported by the kernel convert
R'G'B' to limited range Y'CbCr. So choosing full range as the default
would break how applications interpret the quantization range.
The chromaticities of the primary colors and the white reference are:
.. flat-table:: sRGB Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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.
Transfer function. Note that negative values for L are only used by the
Y'CbCr conversion.
.. math::
L' = -1.055(-L)^{\frac{1}{2.4} } + 0.055\text{, for }L < -0.0031308
L' = 12.92L\text{, for }-0.0031308 \le L \le 0.0031308
L' = 1.055L ^{\frac{1}{2.4} } - 0.055\text{, for }0.0031308 < L \le 1
Inverse Transfer function:
.. math::
L = -((-L' + 0.055) / 1.055) ^{2.4}\text{, for }L' < -0.04045
L = L' / 12.92\text{, for }-0.04045 \le L' \le 0.04045
L = ((L' + 0.055) / 1.055) ^{2.4}\text{, for }L' > 0.04045
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding as defined by :ref:`sycc`:
.. math::
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]. This transform is identical to one defined in SMPTE
170M/BT.601. The Y'CbCr quantization is limited range.
opRGB 색공간
281-349`V4L2_COLORSPACE_OPRGB`은 opRGB를 사용하는 컴퓨터 그래픽용 색공간입니다. 기본 전달 함수는 `V4L2_XFER_FUNC_OPRGB`, 기본 Y'CbCr 인코딩은 `V4L2_YCBCR_ENC_601`, 기본 양자화는 제한 범위입니다.
Rec. 709보다 넓은 초록 원색을 갖는 opRGB의 정의입니다.
opRGB 표준 자체는 전체 범위를 규정하지만 현재 지원되는 캡처 하드웨어는 제한 범위 Y'CbCr를 만듭니다. 따라서 sRGB와 같은 호환성 이유로 제한 범위를 기본값으로 둡니다.
전달 함수는 `L'=L^(1/2.19921875)`이고 역함수는 `L=L'^2.19921875`입니다. Y'CbCr는 BT.601 계수로 변환하며 Y' [0,1], Cb/Cr [-0.5,0.5]로 제한한 뒤 제한 범위로 양자화합니다.
.. _col-oprgb:
Colorspace opRGB (V4L2_COLORSPACE_OPRGB)
===============================================
The :ref:`oprgb` standard defines the colorspace used by computer
graphics that use the opRGB colorspace. The default transfer function is
``V4L2_XFER_FUNC_OPRGB``. The default Y'CbCr encoding is
``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited
range.
Note that the :ref:`oprgb` standard specifies full range quantization,
however all current capture hardware supported by the kernel convert
R'G'B' to limited range Y'CbCr. So choosing full range as the default
would break how applications interpret the quantization range.
The chromaticities of the primary colors and the white reference are:
.. flat-table:: opRGB Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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
Transfer function:
.. math::
L' = L ^{\frac{1}{2.19921875}}
Inverse Transfer function:
.. math::
L = L'^{(2.19921875)}
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding:
.. math::
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]. This transform is identical to one defined in SMPTE
170M/BT.601. The Y'CbCr quantization is limited range.
BT.2020 색공간
350-442`V4L2_COLORSPACE_BT2020`은 UHDTV용 BT.2020 색공간입니다. 기본 전달 함수는 `V4L2_XFER_FUNC_709`, 기본 인코딩은 비상수 휘도 `V4L2_YCBCR_ENC_BT2020`, 기본 양자화는 제한 범위입니다.
넓은 색역의 UHDTV 색도와 V4L2 기본값입니다.
기본 전달 함수의 정방향·역방향 수식은 Rec. 709와 같습니다. 그러나 실제 BT.2020 콘텐츠는 SMPTE ST 2084 PQ와 함께 쓰이는 경우가 많고, Ultra HD Blu-ray가 대표적인 조합입니다.
비상수 휘도 행렬은 `Y'=0.2627R'+0.6780G'+0.0593B'`, `Cb=-0.1396R'-0.3604G'+0.5B'`, `Cr=0.5R'-0.4598G'-0.0402B'`입니다. Y'와 색차를 각각 [0,1], [-0.5,0.5]로 제한하고 제한 범위로 양자화합니다.
대안인 `V4L2_YCBCR_ENC_BT2020_CONST_LUM`은 선형 R, G, B로 Yc를 만든 뒤 전달 함수를 적용해 Yc'를 얻습니다. B'-Yc'와 R'-Yc'의 부호에 따라 Cbc와 Crc의 분모를 각각 다르게 선택합니다.
비상수 휘도와 상수 휘도 표현의 차이입니다.
상수 휘도 수식의 Yc'는 [0,1], Cbc/Crc는 [-0.5,0.5]로 제한하며 양자화는 제한 범위입니다. Crc 분자에 `Y'`를 쓰는 로컬 v6.18.37 원문 표기를 임의로 교정하지 않고 그대로 보존했습니다.
.. _col-bt2020:
Colorspace BT.2020 (V4L2_COLORSPACE_BT2020)
===========================================
The :ref:`itu2020` standard defines the colorspace used by Ultra-high
definition television (UHDTV). The default transfer function is
``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is
``V4L2_YCBCR_ENC_BT2020``. The default Y'CbCr quantization is limited range.
The chromaticities of the primary colors and the white reference are:
.. flat-table:: BT.2020 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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
Transfer function (same as Rec. 709):
.. math::
L' = 4.5L\text{, for }0 \le L < 0.018
L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1
Inverse Transfer function:
.. math::
L = L' / 4.5\text{, for } L' < 0.081
L = \left( \frac{L' + 0.099}{1.099}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081
Please note that while Rec. 709 is defined as the default transfer function
by the :ref:`itu2020` standard, in practice this colorspace is often used
with the :ref:`xf-smpte-2084`. In particular Ultra HD Blu-ray discs use
this combination.
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_BT2020`` encoding:
.. math::
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:
Luma:
.. math::
:nowrap:
\begin{align*}
Yc' = (0.2627R + 0.6780G + 0.0593B)'& \\
B' - Yc' \le 0:& \\
&Cbc = (B' - Yc') / 1.9404 \\
B' - Yc' > 0: & \\
&Cbc = (B' - Yc') / 1.5816 \\
R' - Yc' \le 0:& \\
&Crc = (R' - Y') / 1.7184 \\
R' - Yc' > 0:& \\
&Crc = (R' - Y') / 0.9936
\end{align*}
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.
DCI-P3 색공간
443-499`V4L2_COLORSPACE_DCI_P3`은 DCI-P3를 사용하는 영화관 프로젝터용 SMPTE 431 색공간입니다. 기본 전달 함수는 `V4L2_XFER_FUNC_DCI_P3`, 기본 Y'CbCr 인코딩은 `V4L2_YCBCR_ENC_709`, 기본 양자화는 제한 범위입니다.
영화 상영용 색도와 V4L2의 Y'CbCr 호환 기본값입니다.
DCI-P3 표준은 본래 Y'CbCr로 인코딩하기 위한 색공간이 아니므로 Y'CbCr 행렬을 규정하지 않습니다. V4L2는 HDTV 인코딩이라는 이유로 Rec. 709 행렬을 기본값으로 선택했습니다.
전달 함수는 `L'=L^(1/2.6)`이며 역함수는 `L=L'^2.6`입니다. 이 절의 Y'CbCr 선택은 DCI-P3 표준의 일부가 아니라 V4L2 API의 기본 동작입니다.
.. _col-dcip3:
Colorspace DCI-P3 (V4L2_COLORSPACE_DCI_P3)
==========================================
The :ref:`smpte431` standard defines the colorspace used by cinema
projectors that use the DCI-P3 colorspace. The default transfer function
is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is
``V4L2_YCBCR_ENC_709``. The default Y'CbCr quantization is limited range.
.. note::
Note that this colorspace standard does not specify a
Y'CbCr encoding since it is not meant to be encoded to Y'CbCr. So this
default Y'CbCr encoding was picked because it is the HDTV encoding.
The chromaticities of the primary colors and the white reference are:
.. flat-table:: DCI-P3 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - Color
- x
- y
* - Red
- 0.6800
- 0.3200
* - Green
- 0.2650
- 0.6900
* - Blue
- 0.1500
- 0.0600
* - White Reference
- 0.3140
- 0.3510
Transfer function:
.. math::
L' = L^{\frac{1}{2.6}}
Inverse Transfer function:
.. math::
L = L'^{(2.6)}
Y'CbCr encoding is not specified. V4L2 defaults to Rec. 709.
SMPTE 240M 색공간
500-567`V4L2_COLORSPACE_SMPTE240M`은 HDTV 초기인 1988~1998년에 사용된 과도기 표준으로, 현재는 Rec. 709가 대체했습니다. 기본 전달 함수와 인코딩은 각각 `V4L2_XFER_FUNC_SMPTE240M`, `V4L2_YCBCR_ENC_SMPTE240M`이며 양자화는 제한 범위입니다.
색도는 SMPTE 170M과 같지만 전달 함수와 행렬이 다릅니다.
전달 함수는 L=0.0228을 경계로 `L'=4L`과 `L'=1.1115L^0.45-0.1115`를 사용합니다. 역함수의 신호 경계는 L'=0.0913입니다.
SMPTE 240M 행렬은 `Y'=0.2122R'+0.7013G'+0.0865B'`, `Cb=-0.1161R'-0.3839G'+0.5B'`, `Cr=0.5R'-0.4451G'-0.0549B'`입니다. Y'와 Cb/Cr를 표준 범위로 제한한 뒤 제한 범위로 양자화합니다.
.. _col-smpte-240m:
Colorspace SMPTE 240M (V4L2_COLORSPACE_SMPTE240M)
=================================================
The :ref:`smpte240m` standard was an interim standard used during the
early days of HDTV (1988-1998). It has been superseded by Rec. 709. The
default transfer function is ``V4L2_XFER_FUNC_SMPTE240M``. 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:
.. flat-table:: SMPTE 240M Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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.
Transfer function:
.. math::
L' = 4L\text{, for } 0 \le L < 0.0228
L' = 1.1115L ^{0.45} - 0.1115\text{, for } 0.0228 \le L \le 1
Inverse Transfer function:
.. math::
L = \frac{L'}{4}\text{, for } 0 \le L' < 0.0913
L = \left( \frac{L' + 0.1115}{1.1115}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.0913
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_SMPTE240M`` encoding:
.. math::
Y' = 0.2122R' + 0.7013G' + 0.0865B'
Cb = -0.1161R' - 0.3839G' + 0.5B'
Cr = 0.5R' - 0.4451G' - 0.0549B'
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.
NTSC 1953 색공간
568-642`V4L2_COLORSPACE_470_SYSTEM_M`은 1953년 NTSC 색공간입니다. 실무에서는 폐기된 것으로 보고 SMPTE 170M을 사용해야 합니다. 기본 전달 함수는 `V4L2_XFER_FUNC_709`, 기본 인코딩은 `V4L2_YCBCR_ENC_601`, 양자화는 제한 범위입니다.
D65가 아닌 Illuminant C를 흰색 기준으로 사용합니다.
Illuminant C 기반 영상을 D65 기반 색공간으로 정확히 변환하려면 Bradford 방식 같은 색순응 알고리즘을 적용해야 합니다.
흰색 기준이 다른 색공간 사이의 변환 순서입니다.
NTSC 1953의 전달 함수는 제대로 정의된 적이 없어 문헌에서 Rec. 709 함수를 권장합니다. 원문의 정방향·역방향 수식은 709의 L=0.018, L'=0.081 경계를 사용합니다.
Y'CbCr 행렬은 BT.601/SMPTE 170M과 동일한 0.2990/0.5870/0.1140 계수입니다. Y' [0,1], Cb/Cr [-0.5,0.5]로 제한하고 제한 범위로 양자화합니다.
.. _col-sysm:
Colorspace NTSC 1953 (V4L2_COLORSPACE_470_SYSTEM_M)
===================================================
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 transfer function is ``V4L2_XFER_FUNC_709``. 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:
.. flat-table:: NTSC 1953 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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::
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.
The transfer function was never properly defined for NTSC 1953. The Rec.
709 transfer function is recommended in the literature:
.. math::
L' = 4.5L\text{, for } 0 \le L < 0.018
L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1
Inverse Transfer function:
.. math::
L = \frac{L'}{4.5} \text{, for } L' < 0.081
L = \left( \frac{L' + 0.099}{1.099}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding:
.. math::
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 Y'CbCr quantization is limited range. This transform is
identical to one defined in SMPTE 170M/BT.601.
EBU Tech. 3213 색공간
643-713`V4L2_COLORSPACE_470_SYSTEM_BG`는 1975년 PAL/SECAM용 EBU Tech. 3213 색공간입니다. HDMI 인터페이스는 이 색공간을 지원하지 않으며 EBU Tech. 3321은 HDMI에서 Rec. 709를 사용하도록 권고합니다.
PAL/SECAM 색도와 V4L2 기본 선택입니다.
이 색공간도 전달 함수가 제대로 정의되지 않았으므로 문헌에서 Rec. 709 함수를 권장합니다. 수식의 선형·지수 구간과 역함수는 BT.2020 기본 전달 함수 절과 같은 709 형태입니다.
Y'CbCr 변환은 SMPTE 170M/BT.601과 동일합니다. Y'는 [0,1], Cb/Cr은 [-0.5,0.5]로 제한하며 제한 범위 양자화를 사용합니다.
.. _col-sysbg:
Colorspace EBU Tech. 3213 (V4L2_COLORSPACE_470_SYSTEM_BG)
=========================================================
The :ref:`tech3213` standard defines the colorspace used by PAL/SECAM
in 1975. Note that this colorspace is not supported by the HDMI interface.
Instead :ref:`tech3321` recommends that Rec. 709 is used instead for HDMI.
The default transfer function is
``V4L2_XFER_FUNC_709``. 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:
.. flat-table:: EBU Tech. 3213 Chromaticities
:header-rows: 1
:stub-columns: 0
:widths: 1 1 2
* - 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
The transfer function was never properly defined for this colorspace.
The Rec. 709 transfer function is recommended in the literature:
.. math::
L' = 4.5L\text{, for } 0 \le L < 0.018
L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1
Inverse Transfer function:
.. math::
L = \frac{L'}{4.5} \text{, for } L' < 0.081
L = \left(\frac{L' + 0.099}{1.099} \right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081
The luminance (Y') and color difference (Cb and Cr) are obtained with
the following ``V4L2_YCBCR_ENC_601`` encoding:
.. math::
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 Y'CbCr quantization is limited range. This transform is
identical to one defined in SMPTE 170M/BT.601.
JPEG 색공간
714-734`V4L2_COLORSPACE_JPEG`은 대부분의 JPEG와 Motion-JPEG 형식에 쓰이는 관례적 색공간입니다. 원색과 흰색 색도는 sRGB와 같고 전달 함수는 `V4L2_XFER_FUNC_SRGB`, Y'CbCr 인코딩은 `V4L2_YCBCR_ENC_601`, 양자화는 전체 범위입니다.
하나의 JPEG 식별자가 축약하는 네 V4L2 값입니다.
전체 범위에서 Y'는 [0,255]로 스케일하고 Cb/Cr은 [-128,128]로 스케일한 뒤 [-128,127]로 클리핑합니다.
JPEG 표준은 실제 파일에 색공간 정보를 저장하지 않습니다. sRGB 이외의 색공간을 썼다면 드라이버가 관련 필드를 명시적으로 설정해야 하며, `V4L2_COLORSPACE_JPEG`은 위 네 값의 축약형으로 이해할 수 있습니다.
.. _col-jpeg:
Colorspace JPEG (V4L2_COLORSPACE_JPEG)
======================================
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 transfer function use is
``V4L2_XFER_FUNC_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::
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_XFER_FUNC_SRGB``, ``V4L2_YCBCR_ENC_601``
and ``V4L2_QUANTIZATION_FULL_RANGE``.
SMPTE ST 2084 전달 함수
735-775`V4L2_XFER_FUNC_SMPTE2084`는 HDR 콘텐츠에 쓰이는 SMPTE ST 2084 전달 함수, 즉 PQ를 나타냅니다.
정방향과 역방향 PQ 수식에 공통으로 쓰이는 상수입니다.
정방향 함수는 L의 m1 제곱을 c1, c2, c3로 구성한 유리식에 넣고 결과를 m2 제곱합니다. 역함수는 L'의 1/m2 제곱에서 c1을 뺀 값을 0 아래로 내려가지 않게 한 뒤, 분모 `c2-c3*L'^(1/m2)`로 나누고 1/m1 제곱합니다.
HDR에서 선형 RGB [0,1]은 0~10000 cd/m² 휘도에 대응하지만 SDR의 선형 RGB [0,1]은 0~100 cd/m²에 대응합니다. 같은 정규화 값이라도 절대 휘도 의미가 100배 다릅니다.
원문이 제시하는 기초 변환과 손실 지점입니다.
이 단순 배율 변환은 HDR의 밝은 세부를 잘라냅니다. 문서는 더 깊은 색 영상 처리와 톤 매핑 방법을 `colimg` 절에서 확인하도록 안내합니다.
***************************************
Detailed Transfer Function Descriptions
***************************************
.. _xf-smpte-2084:
Transfer Function SMPTE 2084 (V4L2_XFER_FUNC_SMPTE2084)
=======================================================
The :ref:`smpte2084` standard defines the transfer function used by
High Dynamic Range content.
Constants:
m1 = (2610 / 4096) / 4
m2 = (2523 / 4096) * 128
c1 = 3424 / 4096
c2 = (2413 / 4096) * 32
c3 = (2392 / 4096) * 32
Transfer function:
L' = ((c1 + c2 * L\ :sup:`m1`) / (1 + c3 * L\ :sup:`m1`))\ :sup:`m2`
Inverse Transfer function:
L = (max(L':sup:`1/m2` - c1, 0) / (c2 - c3 *
L'\ :sup:`1/m2`))\ :sup:`1/m1`
Take care when converting between this transfer function and non-HDR transfer
functions: the linear RGB values [0…1] of HDR content map to a luminance range
of 0 to 10000 cd/m\ :sup:`2` whereas the linear RGB values of non-HDR (aka
Standard Dynamic Range or SDR) map to a luminance range of 0 to 100 cd/m\ :sup:`2`.
To go from SDR to HDR you will have to divide L by 100 first. To go in the other
direction you will have to multiply L by 100. Of course, this clamps all
luminance values over 100 cd/m\ :sup:`2` to 100 cd/m\ :sup:`2`.
There are better methods, see e.g. :ref:`colimg` for more in-depth information
about this.
요약·해설
colorspaces-details.rst:1-775V4L2 색공간 식별자가 실제로 뜻하는 색도 좌표, 전달 함수, Y'CbCr 행렬과 양자화 관례를 표준별로 풀어 쓴 문서입니다. 색공간 이름만 비교하지 않고 기본 V4L2 필드와 예외, 확장 색역과 HDR 절대 휘도까지 함께 확인해야 정확한 변환이 가능합니다.