blob: a97fc28e039d98bde1daf23685c3719f8c4f84c2 [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
3****************************
4Defining Colorspaces in V4L2
5****************************
6
7In V4L2 colorspaces are defined by four values. The first is the
8colorspace identifier (enum :ref:`v4l2_colorspace <v4l2-colorspace>`)
9which defines the chromaticities, the default transfer function, the
10default Y'CbCr encoding and the default quantization method. The second
11is the transfer function identifier (enum
12:ref:`v4l2_xfer_func <v4l2-xfer-func>`) to specify non-standard
13transfer functions. The third is the Y'CbCr encoding identifier (enum
14:ref:`v4l2_ycbcr_encoding <v4l2-ycbcr-encoding>`) to specify
15non-standard Y'CbCr encodings and the fourth is the quantization
16identifier (enum :ref:`v4l2_quantization <v4l2-quantization>`) to
17specify non-standard quantization methods. Most of the time only the
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -030018colorspace field of struct :c:type:`v4l2_pix_format`
19or struct :c:type:`v4l2_pix_format_mplane`
Mauro Carvalho Chehab706f8a92016-07-10 11:57:43 -030020needs to be filled in.
21
Mauro Carvalho Chehabb6b6e672016-08-15 17:49:50 -030022.. note::
23
24 The default R'G'B' quantization is full range for all
Mauro Carvalho Chehab706f8a92016-07-10 11:57:43 -030025 colorspaces except for BT.2020 which uses limited range R'G'B'
26 quantization.
Markus Heiser5377d912016-06-30 15:18:56 +020027
Mauro Carvalho Chehab83eaeb82016-08-17 11:47:21 -030028.. tabularcolumns:: |p{6.0cm}|p{11.5cm}|
Markus Heiser5377d912016-06-30 15:18:56 +020029
30.. _v4l2-colorspace:
31
32.. flat-table:: V4L2 Colorspaces
33 :header-rows: 1
34 :stub-columns: 0
35
36
37 - .. row 1
38
39 - Identifier
40
41 - Details
42
43 - .. row 2
44
45 - ``V4L2_COLORSPACE_DEFAULT``
46
47 - The default colorspace. This can be used by applications to let
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030048 the driver fill in the colorspace.
Markus Heiser5377d912016-06-30 15:18:56 +020049
50 - .. row 3
51
52 - ``V4L2_COLORSPACE_SMPTE170M``
53
54 - See :ref:`col-smpte-170m`.
55
56 - .. row 4
57
58 - ``V4L2_COLORSPACE_REC709``
59
60 - See :ref:`col-rec709`.
61
62 - .. row 5
63
64 - ``V4L2_COLORSPACE_SRGB``
65
66 - See :ref:`col-srgb`.
67
68 - .. row 6
69
70 - ``V4L2_COLORSPACE_ADOBERGB``
71
72 - See :ref:`col-adobergb`.
73
74 - .. row 7
75
76 - ``V4L2_COLORSPACE_BT2020``
77
78 - See :ref:`col-bt2020`.
79
80 - .. row 8
81
82 - ``V4L2_COLORSPACE_DCI_P3``
83
84 - See :ref:`col-dcip3`.
85
86 - .. row 9
87
88 - ``V4L2_COLORSPACE_SMPTE240M``
89
90 - See :ref:`col-smpte-240m`.
91
92 - .. row 10
93
94 - ``V4L2_COLORSPACE_470_SYSTEM_M``
95
96 - See :ref:`col-sysm`.
97
98 - .. row 11
99
100 - ``V4L2_COLORSPACE_470_SYSTEM_BG``
101
102 - See :ref:`col-sysbg`.
103
104 - .. row 12
105
106 - ``V4L2_COLORSPACE_JPEG``
107
108 - See :ref:`col-jpeg`.
109
110 - .. row 13
111
112 - ``V4L2_COLORSPACE_RAW``
113
114 - The raw colorspace. This is used for raw image capture where the
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300115 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
118 device.
Markus Heiser5377d912016-06-30 15:18:56 +0200119
120
121
122.. _v4l2-xfer-func:
123
124.. flat-table:: V4L2 Transfer Function
125 :header-rows: 1
126 :stub-columns: 0
127
128
129 - .. row 1
130
131 - Identifier
132
133 - Details
134
135 - .. row 2
136
137 - ``V4L2_XFER_FUNC_DEFAULT``
138
139 - Use the default transfer function as defined by the colorspace.
140
141 - .. row 3
142
143 - ``V4L2_XFER_FUNC_709``
144
145 - Use the Rec. 709 transfer function.
146
147 - .. row 4
148
149 - ``V4L2_XFER_FUNC_SRGB``
150
151 - Use the sRGB transfer function.
152
153 - .. row 5
154
155 - ``V4L2_XFER_FUNC_ADOBERGB``
156
157 - Use the AdobeRGB transfer function.
158
159 - .. row 6
160
161 - ``V4L2_XFER_FUNC_SMPTE240M``
162
163 - Use the SMPTE 240M transfer function.
164
165 - .. row 7
166
167 - ``V4L2_XFER_FUNC_NONE``
168
169 - Do not use a transfer function (i.e. use linear RGB values).
170
171 - .. row 8
172
173 - ``V4L2_XFER_FUNC_DCI_P3``
174
175 - Use the DCI-P3 transfer function.
176
177 - .. row 9
178
179 - ``V4L2_XFER_FUNC_SMPTE2084``
180
181 - Use the SMPTE 2084 transfer function.
182
183
184
185.. _v4l2-ycbcr-encoding:
186
Mauro Carvalho Chehab83eaeb82016-08-17 11:47:21 -0300187.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
188
Markus Heiser5377d912016-06-30 15:18:56 +0200189.. flat-table:: V4L2 Y'CbCr Encodings
190 :header-rows: 1
191 :stub-columns: 0
192
193
194 - .. row 1
195
196 - Identifier
197
198 - Details
199
200 - .. row 2
201
202 - ``V4L2_YCBCR_ENC_DEFAULT``
203
204 - Use the default Y'CbCr encoding as defined by the colorspace.
205
206 - .. row 3
207
208 - ``V4L2_YCBCR_ENC_601``
209
210 - Use the BT.601 Y'CbCr encoding.
211
212 - .. row 4
213
214 - ``V4L2_YCBCR_ENC_709``
215
216 - Use the Rec. 709 Y'CbCr encoding.
217
218 - .. row 5
219
220 - ``V4L2_YCBCR_ENC_XV601``
221
222 - Use the extended gamut xvYCC BT.601 encoding.
223
224 - .. row 6
225
226 - ``V4L2_YCBCR_ENC_XV709``
227
228 - Use the extended gamut xvYCC Rec. 709 encoding.
229
230 - .. row 7
231
Markus Heiser5377d912016-06-30 15:18:56 +0200232 - ``V4L2_YCBCR_ENC_BT2020``
233
234 - Use the default non-constant luminance BT.2020 Y'CbCr encoding.
235
Hans Verkuildda3aea2016-08-04 06:09:03 -0300236 - .. row 8
Markus Heiser5377d912016-06-30 15:18:56 +0200237
238 - ``V4L2_YCBCR_ENC_BT2020_CONST_LUM``
239
240 - Use the constant luminance BT.2020 Yc'CbcCrc encoding.
241
Hans Verkuildda3aea2016-08-04 06:09:03 -0300242 - .. row 9
Hans Verkuil0a07ab92016-07-12 11:31:15 -0300243
244 - ``V4L2_YCBCR_ENC_SMPTE_240M``
245
246 - Use the SMPTE 240M Y'CbCr encoding.
247
Markus Heiser5377d912016-06-30 15:18:56 +0200248
249
250.. _v4l2-quantization:
251
Mauro Carvalho Chehab83eaeb82016-08-17 11:47:21 -0300252.. tabularcolumns:: |p{6.5cm}|p{11.0cm}|
253
Markus Heiser5377d912016-06-30 15:18:56 +0200254.. flat-table:: V4L2 Quantization Methods
255 :header-rows: 1
256 :stub-columns: 0
257
258
259 - .. row 1
260
261 - Identifier
262
263 - Details
264
265 - .. row 2
266
267 - ``V4L2_QUANTIZATION_DEFAULT``
268
269 - Use the default quantization encoding as defined by the
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300270 colorspace. This is always full range for R'G'B' (except for the
271 BT.2020 colorspace) and usually limited range for Y'CbCr.
Markus Heiser5377d912016-06-30 15:18:56 +0200272
273 - .. row 3
274
275 - ``V4L2_QUANTIZATION_FULL_RANGE``
276
277 - Use the full range quantization encoding. I.e. the range [01] is
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300278 mapped to [0255] (with possible clipping to [1254] to avoid the
279 0x00 and 0xff values). Cb and Cr are mapped from [-0.50.5] to
280 [0255] (with possible clipping to [1254] to avoid the 0x00 and
281 0xff values).
Markus Heiser5377d912016-06-30 15:18:56 +0200282
283 - .. row 4
284
285 - ``V4L2_QUANTIZATION_LIM_RANGE``
286
287 - Use the limited range quantization encoding. I.e. the range [01]
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300288 is mapped to [16235]. Cb and Cr are mapped from [-0.50.5] to
289 [16240].