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