Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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