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