Commit | Line | Data |
---|---|---|
5377d91f MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
3 | **************************** | |
4 | Defining Colorspaces in V4L2 | |
5 | **************************** | |
6 | ||
7 | In V4L2 colorspaces are defined by four values. The first is the | |
8 | colorspace identifier (enum :ref:`v4l2_colorspace <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 | :ref:`v4l2_xfer_func <v4l2-xfer-func>`) to specify non-standard | |
13 | transfer functions. The third is the Y'CbCr encoding identifier (enum | |
14 | :ref:`v4l2_ycbcr_encoding <v4l2-ycbcr-encoding>`) to specify | |
15 | non-standard Y'CbCr encodings and the fourth is the quantization | |
16 | identifier (enum :ref:`v4l2_quantization <v4l2-quantization>`) to | |
17 | specify non-standard quantization methods. Most of the time only the | |
18 | colorspace field of struct :ref:`v4l2_pix_format <v4l2-pix-format>` | |
19 | or struct :ref:`v4l2_pix_format_mplane <v4l2-pix-format-mplane>` | |
20 | needs to be filled in. Note that the default R'G'B' quantization is full | |
21 | range for all colorspaces except for BT.2020 which uses limited range | |
22 | R'G'B' quantization. | |
23 | ||
24 | ||
25 | .. _v4l2-colorspace: | |
26 | ||
27 | .. flat-table:: V4L2 Colorspaces | |
28 | :header-rows: 1 | |
29 | :stub-columns: 0 | |
30 | ||
31 | ||
32 | - .. row 1 | |
33 | ||
34 | - Identifier | |
35 | ||
36 | - Details | |
37 | ||
38 | - .. row 2 | |
39 | ||
40 | - ``V4L2_COLORSPACE_DEFAULT`` | |
41 | ||
42 | - The default colorspace. This can be used by applications to let | |
0579e6e3 | 43 | the driver fill in the colorspace. |
5377d91f MH |
44 | |
45 | - .. row 3 | |
46 | ||
47 | - ``V4L2_COLORSPACE_SMPTE170M`` | |
48 | ||
49 | - See :ref:`col-smpte-170m`. | |
50 | ||
51 | - .. row 4 | |
52 | ||
53 | - ``V4L2_COLORSPACE_REC709`` | |
54 | ||
55 | - See :ref:`col-rec709`. | |
56 | ||
57 | - .. row 5 | |
58 | ||
59 | - ``V4L2_COLORSPACE_SRGB`` | |
60 | ||
61 | - See :ref:`col-srgb`. | |
62 | ||
63 | - .. row 6 | |
64 | ||
65 | - ``V4L2_COLORSPACE_ADOBERGB`` | |
66 | ||
67 | - See :ref:`col-adobergb`. | |
68 | ||
69 | - .. row 7 | |
70 | ||
71 | - ``V4L2_COLORSPACE_BT2020`` | |
72 | ||
73 | - See :ref:`col-bt2020`. | |
74 | ||
75 | - .. row 8 | |
76 | ||
77 | - ``V4L2_COLORSPACE_DCI_P3`` | |
78 | ||
79 | - See :ref:`col-dcip3`. | |
80 | ||
81 | - .. row 9 | |
82 | ||
83 | - ``V4L2_COLORSPACE_SMPTE240M`` | |
84 | ||
85 | - See :ref:`col-smpte-240m`. | |
86 | ||
87 | - .. row 10 | |
88 | ||
89 | - ``V4L2_COLORSPACE_470_SYSTEM_M`` | |
90 | ||
91 | - See :ref:`col-sysm`. | |
92 | ||
93 | - .. row 11 | |
94 | ||
95 | - ``V4L2_COLORSPACE_470_SYSTEM_BG`` | |
96 | ||
97 | - See :ref:`col-sysbg`. | |
98 | ||
99 | - .. row 12 | |
100 | ||
101 | - ``V4L2_COLORSPACE_JPEG`` | |
102 | ||
103 | - See :ref:`col-jpeg`. | |
104 | ||
105 | - .. row 13 | |
106 | ||
107 | - ``V4L2_COLORSPACE_RAW`` | |
108 | ||
109 | - The raw colorspace. This is used for raw image capture where the | |
0579e6e3 MCC |
110 | image is minimally processed and is using the internal colorspace |
111 | of the device. The software that processes an image using this | |
112 | 'colorspace' will have to know the internals of the capture | |
113 | device. | |
5377d91f MH |
114 | |
115 | ||
116 | ||
117 | .. _v4l2-xfer-func: | |
118 | ||
119 | .. flat-table:: V4L2 Transfer Function | |
120 | :header-rows: 1 | |
121 | :stub-columns: 0 | |
122 | ||
123 | ||
124 | - .. row 1 | |
125 | ||
126 | - Identifier | |
127 | ||
128 | - Details | |
129 | ||
130 | - .. row 2 | |
131 | ||
132 | - ``V4L2_XFER_FUNC_DEFAULT`` | |
133 | ||
134 | - Use the default transfer function as defined by the colorspace. | |
135 | ||
136 | - .. row 3 | |
137 | ||
138 | - ``V4L2_XFER_FUNC_709`` | |
139 | ||
140 | - Use the Rec. 709 transfer function. | |
141 | ||
142 | - .. row 4 | |
143 | ||
144 | - ``V4L2_XFER_FUNC_SRGB`` | |
145 | ||
146 | - Use the sRGB transfer function. | |
147 | ||
148 | - .. row 5 | |
149 | ||
150 | - ``V4L2_XFER_FUNC_ADOBERGB`` | |
151 | ||
152 | - Use the AdobeRGB transfer function. | |
153 | ||
154 | - .. row 6 | |
155 | ||
156 | - ``V4L2_XFER_FUNC_SMPTE240M`` | |
157 | ||
158 | - Use the SMPTE 240M transfer function. | |
159 | ||
160 | - .. row 7 | |
161 | ||
162 | - ``V4L2_XFER_FUNC_NONE`` | |
163 | ||
164 | - Do not use a transfer function (i.e. use linear RGB values). | |
165 | ||
166 | - .. row 8 | |
167 | ||
168 | - ``V4L2_XFER_FUNC_DCI_P3`` | |
169 | ||
170 | - Use the DCI-P3 transfer function. | |
171 | ||
172 | - .. row 9 | |
173 | ||
174 | - ``V4L2_XFER_FUNC_SMPTE2084`` | |
175 | ||
176 | - Use the SMPTE 2084 transfer function. | |
177 | ||
178 | ||
179 | ||
180 | .. _v4l2-ycbcr-encoding: | |
181 | ||
182 | .. flat-table:: V4L2 Y'CbCr Encodings | |
183 | :header-rows: 1 | |
184 | :stub-columns: 0 | |
185 | ||
186 | ||
187 | - .. row 1 | |
188 | ||
189 | - Identifier | |
190 | ||
191 | - Details | |
192 | ||
193 | - .. row 2 | |
194 | ||
195 | - ``V4L2_YCBCR_ENC_DEFAULT`` | |
196 | ||
197 | - Use the default Y'CbCr encoding as defined by the colorspace. | |
198 | ||
199 | - .. row 3 | |
200 | ||
201 | - ``V4L2_YCBCR_ENC_601`` | |
202 | ||
203 | - Use the BT.601 Y'CbCr encoding. | |
204 | ||
205 | - .. row 4 | |
206 | ||
207 | - ``V4L2_YCBCR_ENC_709`` | |
208 | ||
209 | - Use the Rec. 709 Y'CbCr encoding. | |
210 | ||
211 | - .. row 5 | |
212 | ||
213 | - ``V4L2_YCBCR_ENC_XV601`` | |
214 | ||
215 | - Use the extended gamut xvYCC BT.601 encoding. | |
216 | ||
217 | - .. row 6 | |
218 | ||
219 | - ``V4L2_YCBCR_ENC_XV709`` | |
220 | ||
221 | - Use the extended gamut xvYCC Rec. 709 encoding. | |
222 | ||
223 | - .. row 7 | |
224 | ||
225 | - ``V4L2_YCBCR_ENC_SYCC`` | |
226 | ||
227 | - Use the extended gamut sYCC encoding. | |
228 | ||
229 | - .. row 8 | |
230 | ||
231 | - ``V4L2_YCBCR_ENC_BT2020`` | |
232 | ||
233 | - Use the default non-constant luminance BT.2020 Y'CbCr encoding. | |
234 | ||
235 | - .. row 9 | |
236 | ||
237 | - ``V4L2_YCBCR_ENC_BT2020_CONST_LUM`` | |
238 | ||
239 | - Use the constant luminance BT.2020 Yc'CbcCrc encoding. | |
240 | ||
241 | ||
242 | ||
243 | .. _v4l2-quantization: | |
244 | ||
245 | .. flat-table:: V4L2 Quantization Methods | |
246 | :header-rows: 1 | |
247 | :stub-columns: 0 | |
248 | ||
249 | ||
250 | - .. row 1 | |
251 | ||
252 | - Identifier | |
253 | ||
254 | - Details | |
255 | ||
256 | - .. row 2 | |
257 | ||
258 | - ``V4L2_QUANTIZATION_DEFAULT`` | |
259 | ||
260 | - Use the default quantization encoding as defined by the | |
0579e6e3 MCC |
261 | colorspace. This is always full range for R'G'B' (except for the |
262 | BT.2020 colorspace) and usually limited range for Y'CbCr. | |
5377d91f MH |
263 | |
264 | - .. row 3 | |
265 | ||
266 | - ``V4L2_QUANTIZATION_FULL_RANGE`` | |
267 | ||
268 | - Use the full range quantization encoding. I.e. the range [0…1] is | |
0579e6e3 MCC |
269 | mapped to [0…255] (with possible clipping to [1…254] to avoid the |
270 | 0x00 and 0xff values). Cb and Cr are mapped from [-0.5…0.5] to | |
271 | [0…255] (with possible clipping to [1…254] to avoid the 0x00 and | |
272 | 0xff values). | |
5377d91f MH |
273 | |
274 | - .. row 4 | |
275 | ||
276 | - ``V4L2_QUANTIZATION_LIM_RANGE`` | |
277 | ||
278 | - Use the limited range quantization encoding. I.e. the range [0…1] | |
0579e6e3 MCC |
279 | is mapped to [16…235]. Cb and Cr are mapped from [-0.5…0.5] to |
280 | [16…240]. |