1 .. -*- coding: utf-8; mode: rst -*-
3 ****************************
4 Defining Colorspaces in V4L2
5 ****************************
7 In V4L2 colorspaces are defined by four values. The first is the
8 colorspace identifier (enum :c:type:`v4l2_colorspace`)
9 which defines the chromaticities, the default transfer function, the
10 default Y'CbCr encoding and the default quantization method. The second
11 is the transfer function identifier (enum
12 :c:type:`v4l2_xfer_func`) to specify non-standard
13 transfer functions. The third is the Y'CbCr encoding identifier (enum
14 :c:type:`v4l2_ycbcr_encoding`) to specify
15 non-standard Y'CbCr encodings and the fourth is the quantization
16 identifier (enum :c:type:`v4l2_quantization`) to
17 specify non-standard quantization methods. Most of the time only the
18 colorspace field of struct :c:type:`v4l2_pix_format`
19 or struct :c:type:`v4l2_pix_format_mplane`
20 needs to be filled in.
24 The default R'G'B' quantization is full range for all
25 colorspaces except for BT.2020 which uses limited range R'G'B'
28 .. tabularcolumns:: |p{6.0cm}|p{11.5cm}|
30 .. c:type:: v4l2_colorspace
32 .. flat-table:: V4L2 Colorspaces
45 - ``V4L2_COLORSPACE_DEFAULT``
47 - The default colorspace. This can be used by applications to let
48 the driver fill in the colorspace.
52 - ``V4L2_COLORSPACE_SMPTE170M``
54 - See :ref:`col-smpte-170m`.
58 - ``V4L2_COLORSPACE_REC709``
60 - See :ref:`col-rec709`.
64 - ``V4L2_COLORSPACE_SRGB``
66 - See :ref:`col-srgb`.
70 - ``V4L2_COLORSPACE_ADOBERGB``
72 - See :ref:`col-adobergb`.
76 - ``V4L2_COLORSPACE_BT2020``
78 - See :ref:`col-bt2020`.
82 - ``V4L2_COLORSPACE_DCI_P3``
84 - See :ref:`col-dcip3`.
88 - ``V4L2_COLORSPACE_SMPTE240M``
90 - See :ref:`col-smpte-240m`.
94 - ``V4L2_COLORSPACE_470_SYSTEM_M``
96 - See :ref:`col-sysm`.
100 - ``V4L2_COLORSPACE_470_SYSTEM_BG``
102 - See :ref:`col-sysbg`.
106 - ``V4L2_COLORSPACE_JPEG``
108 - See :ref:`col-jpeg`.
112 - ``V4L2_COLORSPACE_RAW``
114 - The raw colorspace. This is used for raw image capture where the
115 image is minimally processed and is using the internal colorspace
116 of the device. The software that processes an image using this
117 'colorspace' will have to know the internals of the capture
122 .. c:type:: v4l2_xfer_func
124 .. flat-table:: V4L2 Transfer Function
137 - ``V4L2_XFER_FUNC_DEFAULT``
139 - Use the default transfer function as defined by the colorspace.
143 - ``V4L2_XFER_FUNC_709``
145 - Use the Rec. 709 transfer function.
149 - ``V4L2_XFER_FUNC_SRGB``
151 - Use the sRGB transfer function.
155 - ``V4L2_XFER_FUNC_ADOBERGB``
157 - Use the AdobeRGB transfer function.
161 - ``V4L2_XFER_FUNC_SMPTE240M``
163 - Use the SMPTE 240M transfer function.
167 - ``V4L2_XFER_FUNC_NONE``
169 - Do not use a transfer function (i.e. use linear RGB values).
173 - ``V4L2_XFER_FUNC_DCI_P3``
175 - Use the DCI-P3 transfer function.
179 - ``V4L2_XFER_FUNC_SMPTE2084``
181 - Use the SMPTE 2084 transfer function.
185 .. c:type:: v4l2_ycbcr_encoding
187 .. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
189 .. flat-table:: V4L2 Y'CbCr Encodings
202 - ``V4L2_YCBCR_ENC_DEFAULT``
204 - Use the default Y'CbCr encoding as defined by the colorspace.
208 - ``V4L2_YCBCR_ENC_601``
210 - Use the BT.601 Y'CbCr encoding.
214 - ``V4L2_YCBCR_ENC_709``
216 - Use the Rec. 709 Y'CbCr encoding.
220 - ``V4L2_YCBCR_ENC_XV601``
222 - Use the extended gamut xvYCC BT.601 encoding.
226 - ``V4L2_YCBCR_ENC_XV709``
228 - Use the extended gamut xvYCC Rec. 709 encoding.
232 - ``V4L2_YCBCR_ENC_BT2020``
234 - Use the default non-constant luminance BT.2020 Y'CbCr encoding.
238 - ``V4L2_YCBCR_ENC_BT2020_CONST_LUM``
240 - Use the constant luminance BT.2020 Yc'CbcCrc encoding.
244 - ``V4L2_YCBCR_ENC_SMPTE_240M``
246 - Use the SMPTE 240M Y'CbCr encoding.
250 .. c:type:: v4l2_quantization
252 .. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
254 .. flat-table:: V4L2 Quantization Methods
267 - ``V4L2_QUANTIZATION_DEFAULT``
269 - Use the default quantization encoding as defined by the
270 colorspace. This is always full range for R'G'B' (except for the
271 BT.2020 colorspace) and usually limited range for Y'CbCr.
275 - ``V4L2_QUANTIZATION_FULL_RANGE``
277 - Use the full range quantization encoding. I.e. the range [0…1] is
278 mapped to [0…255] (with possible clipping to [1…254] to avoid the
279 0x00 and 0xff values). Cb and Cr are mapped from [-0.5…0.5] to
280 [0…255] (with possible clipping to [1…254] to avoid the 0x00 and
285 - ``V4L2_QUANTIZATION_LIM_RANGE``
287 - Use the limited range quantization encoding. I.e. the range [0…1]
288 is mapped to [16…235]. Cb and Cr are mapped from [-0.5…0.5] to