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