Commit | Line | Data |
---|---|---|
5377d91f MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
3 | ******************************** | |
4 | Detailed Colorspace Descriptions | |
5 | ******************************** | |
6 | ||
7 | ||
8 | .. _col-smpte-170m: | |
9 | ||
10 | Colorspace SMPTE 170M (V4L2_COLORSPACE_SMPTE170M) | |
11 | ================================================= | |
12 | ||
13 | The :ref:`smpte170m` standard defines the colorspace used by NTSC and | |
14 | PAL and by SDTV in general. The default transfer function is | |
15 | ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is | |
16 | ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited | |
17 | range. The chromaticities of the primary colors and the white reference | |
18 | are: | |
19 | ||
20 | ||
21 | ||
22 | .. flat-table:: SMPTE 170M Chromaticities | |
23 | :header-rows: 1 | |
24 | :stub-columns: 0 | |
25 | :widths: 1 1 2 | |
26 | ||
27 | ||
28 | - .. row 1 | |
29 | ||
30 | - Color | |
31 | ||
32 | - x | |
33 | ||
34 | - y | |
35 | ||
36 | - .. row 2 | |
37 | ||
38 | - Red | |
39 | ||
40 | - 0.630 | |
41 | ||
42 | - 0.340 | |
43 | ||
44 | - .. row 3 | |
45 | ||
46 | - Green | |
47 | ||
48 | - 0.310 | |
49 | ||
50 | - 0.595 | |
51 | ||
52 | - .. row 4 | |
53 | ||
54 | - Blue | |
55 | ||
56 | - 0.155 | |
57 | ||
58 | - 0.070 | |
59 | ||
60 | - .. row 5 | |
61 | ||
62 | - White Reference (D65) | |
63 | ||
64 | - 0.3127 | |
65 | ||
66 | - 0.3290 | |
67 | ||
68 | ||
69 | The red, green and blue chromaticities are also often referred to as the | |
70 | SMPTE C set, so this colorspace is sometimes called SMPTE C as well. | |
71 | ||
72 | The transfer function defined for SMPTE 170M is the same as the one | |
73 | defined in Rec. 709. | |
7f1bd7cd MCC |
74 | |
75 | L' = -1.099(-L) :sup:`0.45` + 0.099 for L ≤ -0.018 | |
5377d91f MH |
76 | |
77 | L' = 4.5L for -0.018 < L < 0.018 | |
78 | ||
7f1bd7cd | 79 | L' = 1.099L :sup:`0.45` - 0.099 for L ≥ 0.018 |
5377d91f MH |
80 | |
81 | Inverse Transfer function: | |
7f1bd7cd MCC |
82 | |
83 | L = -((L' - 0.099) / -1.099) :sup:`1/0.45` for L' ≤ -0.081 | |
5377d91f MH |
84 | |
85 | L = L' / 4.5 for -0.081 < L' < 0.081 | |
86 | ||
7f1bd7cd | 87 | L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 |
5377d91f MH |
88 | |
89 | The luminance (Y') and color difference (Cb and Cr) are obtained with | |
90 | the following ``V4L2_YCBCR_ENC_601`` encoding: | |
7f1bd7cd | 91 | |
5377d91f MH |
92 | Y' = 0.299R' + 0.587G' + 0.114B' |
93 | ||
94 | Cb = -0.169R' - 0.331G' + 0.5B' | |
95 | ||
96 | Cr = 0.5R' - 0.419G' - 0.081B' | |
97 | ||
98 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | |
99 | [-0.5…0.5]. This conversion to Y'CbCr is identical to the one defined in | |
100 | the :ref:`itu601` standard and this colorspace is sometimes called | |
101 | BT.601 as well, even though BT.601 does not mention any color primaries. | |
102 | ||
103 | The default quantization is limited range, but full range is possible | |
104 | although rarely seen. | |
105 | ||
106 | ||
107 | .. _col-rec709: | |
108 | ||
109 | Colorspace Rec. 709 (V4L2_COLORSPACE_REC709) | |
110 | ============================================ | |
111 | ||
112 | The :ref:`itu709` standard defines the colorspace used by HDTV in | |
113 | general. The default transfer function is ``V4L2_XFER_FUNC_709``. The | |
114 | default Y'CbCr encoding is ``V4L2_YCBCR_ENC_709``. The default Y'CbCr | |
115 | quantization is limited range. The chromaticities of the primary colors | |
116 | and the white reference are: | |
117 | ||
118 | ||
119 | ||
120 | .. flat-table:: Rec. 709 Chromaticities | |
121 | :header-rows: 1 | |
122 | :stub-columns: 0 | |
123 | :widths: 1 1 2 | |
124 | ||
125 | ||
126 | - .. row 1 | |
127 | ||
128 | - Color | |
129 | ||
130 | - x | |
131 | ||
132 | - y | |
133 | ||
134 | - .. row 2 | |
135 | ||
136 | - Red | |
137 | ||
138 | - 0.640 | |
139 | ||
140 | - 0.330 | |
141 | ||
142 | - .. row 3 | |
143 | ||
144 | - Green | |
145 | ||
146 | - 0.300 | |
147 | ||
148 | - 0.600 | |
149 | ||
150 | - .. row 4 | |
151 | ||
152 | - Blue | |
153 | ||
154 | - 0.150 | |
155 | ||
156 | - 0.060 | |
157 | ||
158 | - .. row 5 | |
159 | ||
160 | - White Reference (D65) | |
161 | ||
162 | - 0.3127 | |
163 | ||
164 | - 0.3290 | |
165 | ||
166 | ||
167 | The full name of this standard is Rec. ITU-R BT.709-5. | |
168 | ||
169 | Transfer function. Normally L is in the range [0…1], but for the | |
170 | extended gamut xvYCC encoding values outside that range are allowed. | |
7f1bd7cd MCC |
171 | |
172 | L' = -1.099(-L) :sup:`0.45` + 0.099 for L ≤ -0.018 | |
5377d91f MH |
173 | |
174 | L' = 4.5L for -0.018 < L < 0.018 | |
175 | ||
7f1bd7cd | 176 | L' = 1.099L :sup:`0.45` - 0.099 for L ≥ 0.018 |
5377d91f MH |
177 | |
178 | Inverse Transfer function: | |
7f1bd7cd MCC |
179 | |
180 | L = -((L' - 0.099) / -1.099) :sup:`1/0.45` for L' ≤ -0.081 | |
5377d91f MH |
181 | |
182 | L = L' / 4.5 for -0.081 < L' < 0.081 | |
183 | ||
7f1bd7cd | 184 | L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 |
5377d91f MH |
185 | |
186 | The luminance (Y') and color difference (Cb and Cr) are obtained with | |
187 | the following ``V4L2_YCBCR_ENC_709`` encoding: | |
7f1bd7cd | 188 | |
5377d91f MH |
189 | Y' = 0.2126R' + 0.7152G' + 0.0722B' |
190 | ||
191 | Cb = -0.1146R' - 0.3854G' + 0.5B' | |
192 | ||
193 | Cr = 0.5R' - 0.4542G' - 0.0458B' | |
194 | ||
195 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | |
196 | [-0.5…0.5]. | |
197 | ||
198 | The default quantization is limited range, but full range is possible | |
199 | although rarely seen. | |
200 | ||
201 | The ``V4L2_YCBCR_ENC_709`` encoding described above is the default for | |
202 | this colorspace, but it can be overridden with ``V4L2_YCBCR_ENC_601``, | |
203 | in which case the BT.601 Y'CbCr encoding is used. | |
204 | ||
205 | Two additional extended gamut Y'CbCr encodings are also possible with | |
206 | this colorspace: | |
207 | ||
208 | The xvYCC 709 encoding (``V4L2_YCBCR_ENC_XV709``, :ref:`xvycc`) is | |
209 | similar to the Rec. 709 encoding, but it allows for R', G' and B' values | |
210 | that are outside the range [0…1]. The resulting Y', Cb and Cr values are | |
211 | scaled and offset: | |
7f1bd7cd | 212 | |
5377d91f MH |
213 | Y' = (219 / 256) * (0.2126R' + 0.7152G' + 0.0722B') + (16 / 256) |
214 | ||
215 | Cb = (224 / 256) * (-0.1146R' - 0.3854G' + 0.5B') | |
216 | ||
217 | Cr = (224 / 256) * (0.5R' - 0.4542G' - 0.0458B') | |
218 | ||
219 | The xvYCC 601 encoding (``V4L2_YCBCR_ENC_XV601``, :ref:`xvycc`) is | |
220 | similar to the BT.601 encoding, but it allows for R', G' and B' values | |
221 | that are outside the range [0…1]. The resulting Y', Cb and Cr values are | |
222 | scaled and offset: | |
7f1bd7cd | 223 | |
5377d91f MH |
224 | Y' = (219 / 256) * (0.299R' + 0.587G' + 0.114B') + (16 / 256) |
225 | ||
226 | Cb = (224 / 256) * (-0.169R' - 0.331G' + 0.5B') | |
227 | ||
228 | Cr = (224 / 256) * (0.5R' - 0.419G' - 0.081B') | |
229 | ||
230 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | |
231 | [-0.5…0.5]. The non-standard xvYCC 709 or xvYCC 601 encodings can be | |
232 | used by selecting ``V4L2_YCBCR_ENC_XV709`` or ``V4L2_YCBCR_ENC_XV601``. | |
233 | The xvYCC encodings always use full range quantization. | |
234 | ||
235 | ||
236 | .. _col-srgb: | |
237 | ||
238 | Colorspace sRGB (V4L2_COLORSPACE_SRGB) | |
239 | ====================================== | |
240 | ||
241 | The :ref:`srgb` standard defines the colorspace used by most webcams | |
242 | and computer graphics. The default transfer function is | |
243 | ``V4L2_XFER_FUNC_SRGB``. The default Y'CbCr encoding is | |
244 | ``V4L2_YCBCR_ENC_SYCC``. The default Y'CbCr quantization is full range. | |
245 | The chromaticities of the primary colors and the white reference are: | |
246 | ||
247 | ||
248 | ||
249 | .. flat-table:: sRGB Chromaticities | |
250 | :header-rows: 1 | |
251 | :stub-columns: 0 | |
252 | :widths: 1 1 2 | |
253 | ||
254 | ||
255 | - .. row 1 | |
256 | ||
257 | - Color | |
258 | ||
259 | - x | |
260 | ||
261 | - y | |
262 | ||
263 | - .. row 2 | |
264 | ||
265 | - Red | |
266 | ||
267 | - 0.640 | |
268 | ||
269 | - 0.330 | |
270 | ||
271 | - .. row 3 | |
272 | ||
273 | - Green | |
274 | ||
275 | - 0.300 | |
276 | ||
277 | - 0.600 | |
278 | ||
279 | - .. row 4 | |
280 | ||
281 | - Blue | |
282 | ||
283 | - 0.150 | |
284 | ||
285 | - 0.060 | |
286 | ||
287 | - .. row 5 | |
288 | ||
289 | - White Reference (D65) | |
290 | ||
291 | - 0.3127 | |
292 | ||
293 | - 0.3290 | |
294 | ||
295 | ||
296 | These chromaticities are identical to the Rec. 709 colorspace. | |
297 | ||
298 | Transfer function. Note that negative values for L are only used by the | |
299 | Y'CbCr conversion. | |
7f1bd7cd MCC |
300 | |
301 | L' = -1.055(-L) :sup:`1/2.4` + 0.055 for L < -0.0031308 | |
5377d91f MH |
302 | |
303 | L' = 12.92L for -0.0031308 ≤ L ≤ 0.0031308 | |
304 | ||
7f1bd7cd | 305 | L' = 1.055L :sup:`1/2.4` - 0.055 for 0.0031308 < L ≤ 1 |
5377d91f MH |
306 | |
307 | Inverse Transfer function: | |
7f1bd7cd MCC |
308 | |
309 | L = -((-L' + 0.055) / 1.055) :sup:`2.4` for L' < -0.04045 | |
5377d91f MH |
310 | |
311 | L = L' / 12.92 for -0.04045 ≤ L' ≤ 0.04045 | |
312 | ||
7f1bd7cd | 313 | L = ((L' + 0.055) / 1.055) :sup:`2.4` for L' > 0.04045 |
5377d91f MH |
314 | |
315 | The luminance (Y') and color difference (Cb and Cr) are obtained with | |
316 | the following ``V4L2_YCBCR_ENC_SYCC`` encoding as defined by | |
317 | :ref:`sycc`: | |
7f1bd7cd | 318 | |
5377d91f MH |
319 | Y' = 0.2990R' + 0.5870G' + 0.1140B' |
320 | ||
321 | Cb = -0.1687R' - 0.3313G' + 0.5B' | |
322 | ||
323 | Cr = 0.5R' - 0.4187G' - 0.0813B' | |
324 | ||
325 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | |
326 | [-0.5…0.5]. The ``V4L2_YCBCR_ENC_SYCC`` quantization is always full | |
327 | range. Although this Y'CbCr encoding looks very similar to the | |
328 | ``V4L2_YCBCR_ENC_XV601`` encoding, it is not. The | |
329 | ``V4L2_YCBCR_ENC_XV601`` scales and offsets the Y'CbCr values before | |
330 | quantization, but this encoding does not do that. | |
331 | ||
332 | ||
333 | .. _col-adobergb: | |
334 | ||
335 | Colorspace Adobe RGB (V4L2_COLORSPACE_ADOBERGB) | |
336 | =============================================== | |
337 | ||
338 | The :ref:`adobergb` standard defines the colorspace used by computer | |
339 | graphics that use the AdobeRGB colorspace. This is also known as the | |
340 | :ref:`oprgb` standard. The default transfer function is | |
341 | ``V4L2_XFER_FUNC_ADOBERGB``. The default Y'CbCr encoding is | |
342 | ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited | |
343 | range. The chromaticities of the primary colors and the white reference | |
344 | are: | |
345 | ||
346 | ||
347 | ||
348 | .. flat-table:: Adobe RGB Chromaticities | |
349 | :header-rows: 1 | |
350 | :stub-columns: 0 | |
351 | :widths: 1 1 2 | |
352 | ||
353 | ||
354 | - .. row 1 | |
355 | ||
356 | - Color | |
357 | ||
358 | - x | |
359 | ||
360 | - y | |
361 | ||
362 | - .. row 2 | |
363 | ||
364 | - Red | |
365 | ||
366 | - 0.6400 | |
367 | ||
368 | - 0.3300 | |
369 | ||
370 | - .. row 3 | |
371 | ||
372 | - Green | |
373 | ||
374 | - 0.2100 | |
375 | ||
376 | - 0.7100 | |
377 | ||
378 | - .. row 4 | |
379 | ||
380 | - Blue | |
381 | ||
382 | - 0.1500 | |
383 | ||
384 | - 0.0600 | |
385 | ||
386 | - .. row 5 | |
387 | ||
388 | - White Reference (D65) | |
389 | ||
390 | - 0.3127 | |
391 | ||
392 | - 0.3290 | |
393 | ||
394 | ||
395 | ||
396 | Transfer function: | |
7f1bd7cd MCC |
397 | |
398 | L' = L :sup:`1/2.19921875` | |
5377d91f MH |
399 | |
400 | Inverse Transfer function: | |
7f1bd7cd MCC |
401 | |
402 | L = L' :sup:`2.19921875` | |
5377d91f MH |
403 | |
404 | The luminance (Y') and color difference (Cb and Cr) are obtained with | |
405 | the following ``V4L2_YCBCR_ENC_601`` encoding: | |
7f1bd7cd | 406 | |
5377d91f MH |
407 | Y' = 0.299R' + 0.587G' + 0.114B' |
408 | ||
409 | Cb = -0.169R' - 0.331G' + 0.5B' | |
410 | ||
411 | Cr = 0.5R' - 0.419G' - 0.081B' | |
412 | ||
413 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | |
414 | [-0.5…0.5]. This transform is identical to one defined in SMPTE | |
415 | 170M/BT.601. The Y'CbCr quantization is limited range. | |
416 | ||
417 | ||
418 | .. _col-bt2020: | |
419 | ||
420 | Colorspace BT.2020 (V4L2_COLORSPACE_BT2020) | |
421 | =========================================== | |
422 | ||
423 | The :ref:`itu2020` standard defines the colorspace used by Ultra-high | |
424 | definition television (UHDTV). The default transfer function is | |
425 | ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is | |
426 | ``V4L2_YCBCR_ENC_BT2020``. The default R'G'B' quantization is limited | |
427 | range (!), and so is the default Y'CbCr quantization. The chromaticities | |
428 | of the primary colors and the white reference are: | |
429 | ||
430 | ||
431 | ||
432 | .. flat-table:: BT.2020 Chromaticities | |
433 | :header-rows: 1 | |
434 | :stub-columns: 0 | |
435 | :widths: 1 1 2 | |
436 | ||
437 | ||
438 | - .. row 1 | |
439 | ||
440 | - Color | |
441 | ||
442 | - x | |
443 | ||
444 | - y | |
445 | ||
446 | - .. row 2 | |
447 | ||
448 | - Red | |
449 | ||
450 | - 0.708 | |
451 | ||
452 | - 0.292 | |
453 | ||
454 | - .. row 3 | |
455 | ||
456 | - Green | |
457 | ||
458 | - 0.170 | |
459 | ||
460 | - 0.797 | |
461 | ||
462 | - .. row 4 | |
463 | ||
464 | - Blue | |
465 | ||
466 | - 0.131 | |
467 | ||
468 | - 0.046 | |
469 | ||
470 | - .. row 5 | |
471 | ||
472 | - White Reference (D65) | |
473 | ||
474 | - 0.3127 | |
475 | ||
476 | - 0.3290 | |
477 | ||
478 | ||
479 | ||
480 | Transfer function (same as Rec. 709): | |
7f1bd7cd | 481 | |
5377d91f MH |
482 | L' = 4.5L for 0 ≤ L < 0.018 |
483 | ||
7f1bd7cd | 484 | L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1 |
5377d91f MH |
485 | |
486 | Inverse Transfer function: | |
7f1bd7cd | 487 | |
5377d91f MH |
488 | L = L' / 4.5 for L' < 0.081 |
489 | ||
7f1bd7cd | 490 | L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 |
5377d91f MH |
491 | |
492 | The luminance (Y') and color difference (Cb and Cr) are obtained with | |
493 | the following ``V4L2_YCBCR_ENC_BT2020`` encoding: | |
7f1bd7cd | 494 | |
5377d91f MH |
495 | Y' = 0.2627R' + 0.6780G' + 0.0593B' |
496 | ||
497 | Cb = -0.1396R' - 0.3604G' + 0.5B' | |
498 | ||
499 | Cr = 0.5R' - 0.4598G' - 0.0402B' | |
500 | ||
501 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | |
502 | [-0.5…0.5]. The Y'CbCr quantization is limited range. | |
503 | ||
504 | There is also an alternate constant luminance R'G'B' to Yc'CbcCrc | |
505 | (``V4L2_YCBCR_ENC_BT2020_CONST_LUM``) encoding: | |
506 | ||
507 | Luma: | |
7f1bd7cd | 508 | |
5377d91f MH |
509 | Yc' = (0.2627R + 0.6780G + 0.0593B)' |
510 | ||
511 | B' - Yc' ≤ 0: | |
7f1bd7cd | 512 | |
5377d91f MH |
513 | Cbc = (B' - Yc') / 1.9404 |
514 | ||
515 | B' - Yc' > 0: | |
7f1bd7cd | 516 | |
5377d91f MH |
517 | Cbc = (B' - Yc') / 1.5816 |
518 | ||
519 | R' - Yc' ≤ 0: | |
7f1bd7cd | 520 | |
5377d91f MH |
521 | Crc = (R' - Y') / 1.7184 |
522 | ||
523 | R' - Yc' > 0: | |
7f1bd7cd | 524 | |
5377d91f MH |
525 | Crc = (R' - Y') / 0.9936 |
526 | ||
527 | Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the | |
528 | range [-0.5…0.5]. The Yc'CbcCrc quantization is limited range. | |
529 | ||
530 | ||
531 | .. _col-dcip3: | |
532 | ||
533 | Colorspace DCI-P3 (V4L2_COLORSPACE_DCI_P3) | |
534 | ========================================== | |
535 | ||
536 | The :ref:`smpte431` standard defines the colorspace used by cinema | |
537 | projectors that use the DCI-P3 colorspace. The default transfer function | |
538 | is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is | |
706f8a99 MCC |
539 | ``V4L2_YCBCR_ENC_709``. |
540 | ||
b6b6e678 MCC |
541 | .. note:: |
542 | ||
543 | Note that this colorspace does not specify a | |
706f8a99 MCC |
544 | Y'CbCr encoding since it is not meant to be encoded to Y'CbCr. So this |
545 | default Y'CbCr encoding was picked because it is the HDTV encoding. The | |
546 | default Y'CbCr quantization is limited range. The chromaticities of the | |
547 | primary colors and the white reference are: | |
5377d91f MH |
548 | |
549 | ||
550 | ||
551 | .. flat-table:: DCI-P3 Chromaticities | |
552 | :header-rows: 1 | |
553 | :stub-columns: 0 | |
554 | :widths: 1 1 2 | |
555 | ||
556 | ||
557 | - .. row 1 | |
558 | ||
559 | - Color | |
560 | ||
561 | - x | |
562 | ||
563 | - y | |
564 | ||
565 | - .. row 2 | |
566 | ||
567 | - Red | |
568 | ||
569 | - 0.6800 | |
570 | ||
571 | - 0.3200 | |
572 | ||
573 | - .. row 3 | |
574 | ||
575 | - Green | |
576 | ||
577 | - 0.2650 | |
578 | ||
579 | - 0.6900 | |
580 | ||
581 | - .. row 4 | |
582 | ||
583 | - Blue | |
584 | ||
585 | - 0.1500 | |
586 | ||
587 | - 0.0600 | |
588 | ||
589 | - .. row 5 | |
590 | ||
591 | - White Reference | |
592 | ||
593 | - 0.3140 | |
594 | ||
595 | - 0.3510 | |
596 | ||
597 | ||
598 | ||
599 | Transfer function: | |
7f1bd7cd MCC |
600 | |
601 | L' = L :sup:`1/2.6` | |
5377d91f MH |
602 | |
603 | Inverse Transfer function: | |
7f1bd7cd MCC |
604 | |
605 | L = L' :sup:`2.6` | |
5377d91f MH |
606 | |
607 | Y'CbCr encoding is not specified. V4L2 defaults to Rec. 709. | |
608 | ||
609 | ||
610 | .. _col-smpte-240m: | |
611 | ||
612 | Colorspace SMPTE 240M (V4L2_COLORSPACE_SMPTE240M) | |
613 | ================================================= | |
614 | ||
615 | The :ref:`smpte240m` standard was an interim standard used during the | |
616 | early days of HDTV (1988-1998). It has been superseded by Rec. 709. The | |
617 | default transfer function is ``V4L2_XFER_FUNC_SMPTE240M``. The default | |
618 | Y'CbCr encoding is ``V4L2_YCBCR_ENC_SMPTE240M``. The default Y'CbCr | |
619 | quantization is limited range. The chromaticities of the primary colors | |
620 | and the white reference are: | |
621 | ||
622 | ||
623 | ||
624 | .. flat-table:: SMPTE 240M Chromaticities | |
625 | :header-rows: 1 | |
626 | :stub-columns: 0 | |
627 | :widths: 1 1 2 | |
628 | ||
629 | ||
630 | - .. row 1 | |
631 | ||
632 | - Color | |
633 | ||
634 | - x | |
635 | ||
636 | - y | |
637 | ||
638 | - .. row 2 | |
639 | ||
640 | - Red | |
641 | ||
642 | - 0.630 | |
643 | ||
644 | - 0.340 | |
645 | ||
646 | - .. row 3 | |
647 | ||
648 | - Green | |
649 | ||
650 | - 0.310 | |
651 | ||
652 | - 0.595 | |
653 | ||
654 | - .. row 4 | |
655 | ||
656 | - Blue | |
657 | ||
658 | - 0.155 | |
659 | ||
660 | - 0.070 | |
661 | ||
662 | - .. row 5 | |
663 | ||
664 | - White Reference (D65) | |
665 | ||
666 | - 0.3127 | |
667 | ||
668 | - 0.3290 | |
669 | ||
670 | ||
671 | These chromaticities are identical to the SMPTE 170M colorspace. | |
672 | ||
673 | Transfer function: | |
7f1bd7cd | 674 | |
5377d91f MH |
675 | L' = 4L for 0 ≤ L < 0.0228 |
676 | ||
7f1bd7cd | 677 | L' = 1.1115L :sup:`0.45` - 0.1115 for 0.0228 ≤ L ≤ 1 |
5377d91f MH |
678 | |
679 | Inverse Transfer function: | |
7f1bd7cd | 680 | |
5377d91f MH |
681 | L = L' / 4 for 0 ≤ L' < 0.0913 |
682 | ||
7f1bd7cd | 683 | L = ((L' + 0.1115) / 1.1115) :sup:`1/0.45` for L' ≥ 0.0913 |
5377d91f MH |
684 | |
685 | The luminance (Y') and color difference (Cb and Cr) are obtained with | |
686 | the following ``V4L2_YCBCR_ENC_SMPTE240M`` encoding: | |
7f1bd7cd | 687 | |
5377d91f MH |
688 | Y' = 0.2122R' + 0.7013G' + 0.0865B' |
689 | ||
690 | Cb = -0.1161R' - 0.3839G' + 0.5B' | |
691 | ||
692 | Cr = 0.5R' - 0.4451G' - 0.0549B' | |
693 | ||
694 | Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the | |
695 | range [-0.5…0.5]. The Y'CbCr quantization is limited range. | |
696 | ||
697 | ||
698 | .. _col-sysm: | |
699 | ||
700 | Colorspace NTSC 1953 (V4L2_COLORSPACE_470_SYSTEM_M) | |
701 | =================================================== | |
702 | ||
703 | This standard defines the colorspace used by NTSC in 1953. In practice | |
704 | this colorspace is obsolete and SMPTE 170M should be used instead. The | |
705 | default transfer function is ``V4L2_XFER_FUNC_709``. The default Y'CbCr | |
706 | encoding is ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is | |
707 | limited range. The chromaticities of the primary colors and the white | |
708 | reference are: | |
709 | ||
710 | ||
711 | ||
712 | .. flat-table:: NTSC 1953 Chromaticities | |
713 | :header-rows: 1 | |
714 | :stub-columns: 0 | |
715 | :widths: 1 1 2 | |
716 | ||
717 | ||
718 | - .. row 1 | |
719 | ||
720 | - Color | |
721 | ||
722 | - x | |
723 | ||
724 | - y | |
725 | ||
726 | - .. row 2 | |
727 | ||
728 | - Red | |
729 | ||
730 | - 0.67 | |
731 | ||
732 | - 0.33 | |
733 | ||
734 | - .. row 3 | |
735 | ||
736 | - Green | |
737 | ||
738 | - 0.21 | |
739 | ||
740 | - 0.71 | |
741 | ||
742 | - .. row 4 | |
743 | ||
744 | - Blue | |
745 | ||
746 | - 0.14 | |
747 | ||
748 | - 0.08 | |
749 | ||
750 | - .. row 5 | |
751 | ||
752 | - White Reference (C) | |
753 | ||
754 | - 0.310 | |
755 | ||
756 | - 0.316 | |
757 | ||
758 | ||
b6b6e678 MCC |
759 | .. note:: |
760 | ||
761 | This colorspace uses Illuminant C instead of D65 as the white | |
706f8a99 MCC |
762 | reference. To correctly convert an image in this colorspace to another |
763 | that uses D65 you need to apply a chromatic adaptation algorithm such as | |
764 | the Bradford method. | |
5377d91f MH |
765 | |
766 | The transfer function was never properly defined for NTSC 1953. The Rec. | |
767 | 709 transfer function is recommended in the literature: | |
7f1bd7cd | 768 | |
5377d91f MH |
769 | L' = 4.5L for 0 ≤ L < 0.018 |
770 | ||
7f1bd7cd | 771 | L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1 |
5377d91f MH |
772 | |
773 | Inverse Transfer function: | |
7f1bd7cd | 774 | |
5377d91f MH |
775 | L = L' / 4.5 for L' < 0.081 |
776 | ||
7f1bd7cd | 777 | L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 |
5377d91f MH |
778 | |
779 | The luminance (Y') and color difference (Cb and Cr) are obtained with | |
780 | the following ``V4L2_YCBCR_ENC_601`` encoding: | |
7f1bd7cd | 781 | |
5377d91f MH |
782 | Y' = 0.299R' + 0.587G' + 0.114B' |
783 | ||
784 | Cb = -0.169R' - 0.331G' + 0.5B' | |
785 | ||
786 | Cr = 0.5R' - 0.419G' - 0.081B' | |
787 | ||
788 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | |
789 | [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is | |
790 | identical to one defined in SMPTE 170M/BT.601. | |
791 | ||
792 | ||
793 | .. _col-sysbg: | |
794 | ||
795 | Colorspace EBU Tech. 3213 (V4L2_COLORSPACE_470_SYSTEM_BG) | |
796 | ========================================================= | |
797 | ||
798 | The :ref:`tech3213` standard defines the colorspace used by PAL/SECAM | |
799 | in 1975. In practice this colorspace is obsolete and SMPTE 170M should | |
800 | be used instead. The default transfer function is | |
801 | ``V4L2_XFER_FUNC_709``. The default Y'CbCr encoding is | |
802 | ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited | |
803 | range. The chromaticities of the primary colors and the white reference | |
804 | are: | |
805 | ||
806 | ||
807 | ||
808 | .. flat-table:: EBU Tech. 3213 Chromaticities | |
809 | :header-rows: 1 | |
810 | :stub-columns: 0 | |
811 | :widths: 1 1 2 | |
812 | ||
813 | ||
814 | - .. row 1 | |
815 | ||
816 | - Color | |
817 | ||
818 | - x | |
819 | ||
820 | - y | |
821 | ||
822 | - .. row 2 | |
823 | ||
824 | - Red | |
825 | ||
826 | - 0.64 | |
827 | ||
828 | - 0.33 | |
829 | ||
830 | - .. row 3 | |
831 | ||
832 | - Green | |
833 | ||
834 | - 0.29 | |
835 | ||
836 | - 0.60 | |
837 | ||
838 | - .. row 4 | |
839 | ||
840 | - Blue | |
841 | ||
842 | - 0.15 | |
843 | ||
844 | - 0.06 | |
845 | ||
846 | - .. row 5 | |
847 | ||
848 | - White Reference (D65) | |
849 | ||
850 | - 0.3127 | |
851 | ||
852 | - 0.3290 | |
853 | ||
854 | ||
855 | ||
856 | The transfer function was never properly defined for this colorspace. | |
857 | The Rec. 709 transfer function is recommended in the literature: | |
7f1bd7cd | 858 | |
5377d91f MH |
859 | L' = 4.5L for 0 ≤ L < 0.018 |
860 | ||
7f1bd7cd | 861 | L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1 |
5377d91f MH |
862 | |
863 | Inverse Transfer function: | |
7f1bd7cd | 864 | |
5377d91f MH |
865 | L = L' / 4.5 for L' < 0.081 |
866 | ||
7f1bd7cd | 867 | L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 |
5377d91f MH |
868 | |
869 | The luminance (Y') and color difference (Cb and Cr) are obtained with | |
870 | the following ``V4L2_YCBCR_ENC_601`` encoding: | |
7f1bd7cd | 871 | |
5377d91f MH |
872 | Y' = 0.299R' + 0.587G' + 0.114B' |
873 | ||
874 | Cb = -0.169R' - 0.331G' + 0.5B' | |
875 | ||
876 | Cr = 0.5R' - 0.419G' - 0.081B' | |
877 | ||
878 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | |
879 | [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is | |
880 | identical to one defined in SMPTE 170M/BT.601. | |
881 | ||
882 | ||
883 | .. _col-jpeg: | |
884 | ||
885 | Colorspace JPEG (V4L2_COLORSPACE_JPEG) | |
886 | ====================================== | |
887 | ||
888 | This colorspace defines the colorspace used by most (Motion-)JPEG | |
889 | formats. The chromaticities of the primary colors and the white | |
890 | reference are identical to sRGB. The transfer function use is | |
891 | ``V4L2_XFER_FUNC_SRGB``. The Y'CbCr encoding is ``V4L2_YCBCR_ENC_601`` | |
892 | with full range quantization where Y' is scaled to [0…255] and Cb/Cr are | |
893 | scaled to [-128…128] and then clipped to [-128…127]. | |
894 | ||
b6b6e678 MCC |
895 | .. note:: |
896 | ||
897 | The JPEG standard does not actually store colorspace | |
706f8a99 MCC |
898 | information. So if something other than sRGB is used, then the driver |
899 | will have to set that information explicitly. Effectively | |
900 | ``V4L2_COLORSPACE_JPEG`` can be considered to be an abbreviation for | |
901 | ``V4L2_COLORSPACE_SRGB``, ``V4L2_YCBCR_ENC_601`` and | |
902 | ``V4L2_QUANTIZATION_FULL_RANGE``. |