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
38 * - ``V4L2_COLORSPACE_DEFAULT``
39 - The default colorspace. This can be used by applications to let
40 the driver fill in the colorspace.
41 * - ``V4L2_COLORSPACE_SMPTE170M``
42 - See :ref:`col-smpte-170m`.
43 * - ``V4L2_COLORSPACE_REC709``
44 - See :ref:`col-rec709`.
45 * - ``V4L2_COLORSPACE_SRGB``
46 - See :ref:`col-srgb`.
47 * - ``V4L2_COLORSPACE_ADOBERGB``
48 - See :ref:`col-adobergb`.
49 * - ``V4L2_COLORSPACE_BT2020``
50 - See :ref:`col-bt2020`.
51 * - ``V4L2_COLORSPACE_DCI_P3``
52 - See :ref:`col-dcip3`.
53 * - ``V4L2_COLORSPACE_SMPTE240M``
54 - See :ref:`col-smpte-240m`.
55 * - ``V4L2_COLORSPACE_470_SYSTEM_M``
56 - See :ref:`col-sysm`.
57 * - ``V4L2_COLORSPACE_470_SYSTEM_BG``
58 - See :ref:`col-sysbg`.
59 * - ``V4L2_COLORSPACE_JPEG``
60 - See :ref:`col-jpeg`.
61 * - ``V4L2_COLORSPACE_RAW``
62 - The raw colorspace. This is used for raw image capture where the
63 image is minimally processed and is using the internal colorspace
64 of the device. The software that processes an image using this
65 'colorspace' will have to know the internals of the capture
70 .. c:type:: v4l2_xfer_func
72 .. flat-table:: V4L2 Transfer Function
78 * - ``V4L2_XFER_FUNC_DEFAULT``
79 - Use the default transfer function as defined by the colorspace.
80 * - ``V4L2_XFER_FUNC_709``
81 - Use the Rec. 709 transfer function.
82 * - ``V4L2_XFER_FUNC_SRGB``
83 - Use the sRGB transfer function.
84 * - ``V4L2_XFER_FUNC_ADOBERGB``
85 - Use the AdobeRGB transfer function.
86 * - ``V4L2_XFER_FUNC_SMPTE240M``
87 - Use the SMPTE 240M transfer function.
88 * - ``V4L2_XFER_FUNC_NONE``
89 - Do not use a transfer function (i.e. use linear RGB values).
90 * - ``V4L2_XFER_FUNC_DCI_P3``
91 - Use the DCI-P3 transfer function.
92 * - ``V4L2_XFER_FUNC_SMPTE2084``
93 - Use the SMPTE 2084 transfer function.
97 .. c:type:: v4l2_ycbcr_encoding
99 .. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
101 .. flat-table:: V4L2 Y'CbCr Encodings
107 * - ``V4L2_YCBCR_ENC_DEFAULT``
108 - Use the default Y'CbCr encoding as defined by the colorspace.
109 * - ``V4L2_YCBCR_ENC_601``
110 - Use the BT.601 Y'CbCr encoding.
111 * - ``V4L2_YCBCR_ENC_709``
112 - Use the Rec. 709 Y'CbCr encoding.
113 * - ``V4L2_YCBCR_ENC_XV601``
114 - Use the extended gamut xvYCC BT.601 encoding.
115 * - ``V4L2_YCBCR_ENC_XV709``
116 - Use the extended gamut xvYCC Rec. 709 encoding.
117 * - ``V4L2_YCBCR_ENC_BT2020``
118 - Use the default non-constant luminance BT.2020 Y'CbCr encoding.
119 * - ``V4L2_YCBCR_ENC_BT2020_CONST_LUM``
120 - Use the constant luminance BT.2020 Yc'CbcCrc encoding.
121 * - ``V4L2_YCBCR_ENC_SMPTE_240M``
122 - Use the SMPTE 240M Y'CbCr encoding.
126 .. c:type:: v4l2_quantization
128 .. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
130 .. flat-table:: V4L2 Quantization Methods
136 * - ``V4L2_QUANTIZATION_DEFAULT``
137 - Use the default quantization encoding as defined by the
138 colorspace. This is always full range for R'G'B' (except for the
139 BT.2020 colorspace) and usually limited range for Y'CbCr.
140 * - ``V4L2_QUANTIZATION_FULL_RANGE``
141 - Use the full range quantization encoding. I.e. the range [0…1] is
142 mapped to [0…255] (with possible clipping to [1…254] to avoid the
143 0x00 and 0xff values). Cb and Cr are mapped from [-0.5…0.5] to
144 [0…255] (with possible clipping to [1…254] to avoid the 0x00 and
146 * - ``V4L2_QUANTIZATION_LIM_RANGE``
147 - Use the limited range quantization encoding. I.e. the range [0…1]
148 is mapped to [16…235]. Cb and Cr are mapped from [-0.5…0.5] to