1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2.. c:namespace:: V4L 3 4.. _pixfmt-rgb: 5 6*********** 7RGB Formats 8*********** 9 10These formats encode each pixel as a triplet of RGB values. They are packed 11formats, meaning that the RGB values for one pixel are stored consecutively in 12memory and each pixel consumes an integer number of bytes. When the number of 13bits required to store a pixel is not aligned to a byte boundary, the data is 14padded with additional bits to fill the remaining byte. 15 16The formats differ by the number of bits per RGB component (typically but not 17always the same for all components), the order of components in memory, and the 18presence of an alpha component or additional padding bits. 19 20The usage and value of the alpha bits in formats that support them (named ARGB 21or a permutation thereof, collectively referred to as alpha formats) depend on 22the device type and hardware operation. :ref:`Capture <capture>` devices 23(including capture queues of mem-to-mem devices) fill the alpha component in 24memory. When the device captures an alpha channel the alpha component will have 25a meaningful value. Otherwise, when the device doesn't capture an alpha channel 26but can set the alpha bit to a user-configurable value, the 27:ref:`V4L2_CID_ALPHA_COMPONENT <v4l2-alpha-component>` control is used to 28specify that alpha value, and the alpha component of all pixels will be set to 29the value specified by that control. Otherwise a corresponding format without 30an alpha component (XRGB or XBGR) must be used instead of an alpha format. 31 32:ref:`Output <output>` devices (including output queues of mem-to-mem devices 33and :ref:`video output overlay <osd>` devices) read the alpha component from 34memory. When the device processes the alpha channel the alpha component must be 35filled with meaningful values by applications. Otherwise a corresponding format 36without an alpha component (XRGB or XBGR) must be used instead of an alpha 37format. 38 39Formats that contain padding bits are named XRGB (or a permutation thereof). 40The padding bits contain undefined values and must be ignored by applications, 41devices and drivers, for both :ref:`capture` and :ref:`output` devices. 42 43.. note:: 44 45 - In all the tables that follow, bit 7 is the most significant bit in a byte. 46 - 'r', 'g' and 'b' denote bits of the red, green and blue components 47 respectively. 'a' denotes bits of the alpha component (if supported by the 48 format), and 'x' denotes padding bits. 49 50 51Less Than 8 Bits Per Component 52============================== 53 54These formats store an RGB triplet in one, two or four bytes. They are named 55based on the order of the RGB components as seen in a 8-, 16- or 32-bit word, 56which is then stored in memory in little endian byte order (unless otherwise 57noted by the presence of bit 31 in the 4CC value), and on the number of bits 58for each component. For instance, the RGB565 format stores a pixel in a 16-bit 59word [15:0] laid out at as [R\ :sub:`4` R\ :sub:`3` R\ :sub:`2` R\ :sub:`1` 60R\ :sub:`0` G\ :sub:`5` G\ :sub:`4` G\ :sub:`3` G\ :sub:`2` G\ :sub:`1` 61G\ :sub:`0` B\ :sub:`4` B\ :sub:`3` B\ :sub:`2` B\ :sub:`1` B\ :sub:`0`], and 62stored in memory in two bytes, [R\ :sub:`4` R\ :sub:`3` R\ :sub:`2` R\ :sub:`1` 63R\ :sub:`0` G\ :sub:`5` G\ :sub:`4` G\ :sub:`3`] followed by [G\ :sub:`2` 64G\ :sub:`1` G\ :sub:`0` B\ :sub:`4` B\ :sub:`3` B\ :sub:`2` B\ :sub:`1` 65B\ :sub:`0`]. 66 67.. raw:: latex 68 69 \begingroup 70 \tiny 71 \setlength{\tabcolsep}{2pt} 72 73.. tabularcolumns:: |p{2.8cm}|p{2.0cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| 74 75 76.. flat-table:: RGB Formats With Less Than 8 Bits Per Component 77 :header-rows: 2 78 :stub-columns: 0 79 80 * - Identifier 81 - Code 82 - :cspan:`7` Byte 0 in memory 83 - :cspan:`7` Byte 1 84 - :cspan:`7` Byte 2 85 - :cspan:`7` Byte 3 86 * - 87 - 88 - 7 89 - 6 90 - 5 91 - 4 92 - 3 93 - 2 94 - 1 95 - 0 96 97 - 7 98 - 6 99 - 5 100 - 4 101 - 3 102 - 2 103 - 1 104 - 0 105 106 - 7 107 - 6 108 - 5 109 - 4 110 - 3 111 - 2 112 - 1 113 - 0 114 115 - 7 116 - 6 117 - 5 118 - 4 119 - 3 120 - 2 121 - 1 122 - 0 123 * .. _V4L2-PIX-FMT-RGB332: 124 125 - ``V4L2_PIX_FMT_RGB332`` 126 - 'RGB1' 127 128 - r\ :sub:`2` 129 - r\ :sub:`1` 130 - r\ :sub:`0` 131 - g\ :sub:`2` 132 - g\ :sub:`1` 133 - g\ :sub:`0` 134 - b\ :sub:`1` 135 - b\ :sub:`0` 136 - 137 * .. _V4L2-PIX-FMT-ARGB444: 138 139 - ``V4L2_PIX_FMT_ARGB444`` 140 - 'AR12' 141 142 - g\ :sub:`3` 143 - g\ :sub:`2` 144 - g\ :sub:`1` 145 - g\ :sub:`0` 146 - b\ :sub:`3` 147 - b\ :sub:`2` 148 - b\ :sub:`1` 149 - b\ :sub:`0` 150 151 - a\ :sub:`3` 152 - a\ :sub:`2` 153 - a\ :sub:`1` 154 - a\ :sub:`0` 155 - r\ :sub:`3` 156 - r\ :sub:`2` 157 - r\ :sub:`1` 158 - r\ :sub:`0` 159 - 160 * .. _V4L2-PIX-FMT-XRGB444: 161 162 - ``V4L2_PIX_FMT_XRGB444`` 163 - 'XR12' 164 165 - g\ :sub:`3` 166 - g\ :sub:`2` 167 - g\ :sub:`1` 168 - g\ :sub:`0` 169 - b\ :sub:`3` 170 - b\ :sub:`2` 171 - b\ :sub:`1` 172 - b\ :sub:`0` 173 174 - x 175 - x 176 - x 177 - x 178 - r\ :sub:`3` 179 - r\ :sub:`2` 180 - r\ :sub:`1` 181 - r\ :sub:`0` 182 - 183 * .. _V4L2-PIX-FMT-RGBA444: 184 185 - ``V4L2_PIX_FMT_RGBA444`` 186 - 'RA12' 187 188 - b\ :sub:`3` 189 - b\ :sub:`2` 190 - b\ :sub:`1` 191 - b\ :sub:`0` 192 - a\ :sub:`3` 193 - a\ :sub:`2` 194 - a\ :sub:`1` 195 - a\ :sub:`0` 196 197 - r\ :sub:`3` 198 - r\ :sub:`2` 199 - r\ :sub:`1` 200 - r\ :sub:`0` 201 - g\ :sub:`3` 202 - g\ :sub:`2` 203 - g\ :sub:`1` 204 - g\ :sub:`0` 205 - 206 * .. _V4L2-PIX-FMT-RGBX444: 207 208 - ``V4L2_PIX_FMT_RGBX444`` 209 - 'RX12' 210 211 - b\ :sub:`3` 212 - b\ :sub:`2` 213 - b\ :sub:`1` 214 - b\ :sub:`0` 215 - x 216 - x 217 - x 218 - x 219 220 - r\ :sub:`3` 221 - r\ :sub:`2` 222 - r\ :sub:`1` 223 - r\ :sub:`0` 224 - g\ :sub:`3` 225 - g\ :sub:`2` 226 - g\ :sub:`1` 227 - g\ :sub:`0` 228 - 229 * .. _V4L2-PIX-FMT-ABGR444: 230 231 - ``V4L2_PIX_FMT_ABGR444`` 232 - 'AB12' 233 234 - g\ :sub:`3` 235 - g\ :sub:`2` 236 - g\ :sub:`1` 237 - g\ :sub:`0` 238 - r\ :sub:`3` 239 - r\ :sub:`2` 240 - r\ :sub:`1` 241 - r\ :sub:`0` 242 243 - a\ :sub:`3` 244 - a\ :sub:`2` 245 - a\ :sub:`1` 246 - a\ :sub:`0` 247 - b\ :sub:`3` 248 - b\ :sub:`2` 249 - b\ :sub:`1` 250 - b\ :sub:`0` 251 - 252 * .. _V4L2-PIX-FMT-XBGR444: 253 254 - ``V4L2_PIX_FMT_XBGR444`` 255 - 'XB12' 256 257 - g\ :sub:`3` 258 - g\ :sub:`2` 259 - g\ :sub:`1` 260 - g\ :sub:`0` 261 - r\ :sub:`3` 262 - r\ :sub:`2` 263 - r\ :sub:`1` 264 - r\ :sub:`0` 265 266 - x 267 - x 268 - x 269 - x 270 - b\ :sub:`3` 271 - b\ :sub:`2` 272 - b\ :sub:`1` 273 - b\ :sub:`0` 274 - 275 * .. _V4L2-PIX-FMT-BGRA444: 276 277 - ``V4L2_PIX_FMT_BGRA444`` 278 - 'BA12' 279 280 - r\ :sub:`3` 281 - r\ :sub:`2` 282 - r\ :sub:`1` 283 - r\ :sub:`0` 284 - a\ :sub:`3` 285 - a\ :sub:`2` 286 - a\ :sub:`1` 287 - a\ :sub:`0` 288 289 - b\ :sub:`3` 290 - b\ :sub:`2` 291 - b\ :sub:`1` 292 - b\ :sub:`0` 293 - g\ :sub:`3` 294 - g\ :sub:`2` 295 - g\ :sub:`1` 296 - g\ :sub:`0` 297 - 298 * .. _V4L2-PIX-FMT-BGRX444: 299 300 - ``V4L2_PIX_FMT_BGRX444`` 301 - 'BX12' 302 303 - r\ :sub:`3` 304 - r\ :sub:`2` 305 - r\ :sub:`1` 306 - r\ :sub:`0` 307 - x 308 - x 309 - x 310 - x 311 312 - b\ :sub:`3` 313 - b\ :sub:`2` 314 - b\ :sub:`1` 315 - b\ :sub:`0` 316 - g\ :sub:`3` 317 - g\ :sub:`2` 318 - g\ :sub:`1` 319 - g\ :sub:`0` 320 - 321 * .. _V4L2-PIX-FMT-ARGB555: 322 323 - ``V4L2_PIX_FMT_ARGB555`` 324 - 'AR15' 325 326 - g\ :sub:`2` 327 - g\ :sub:`1` 328 - g\ :sub:`0` 329 - b\ :sub:`4` 330 - b\ :sub:`3` 331 - b\ :sub:`2` 332 - b\ :sub:`1` 333 - b\ :sub:`0` 334 335 - a 336 - r\ :sub:`4` 337 - r\ :sub:`3` 338 - r\ :sub:`2` 339 - r\ :sub:`1` 340 - r\ :sub:`0` 341 - g\ :sub:`4` 342 - g\ :sub:`3` 343 - 344 * .. _V4L2-PIX-FMT-XRGB555: 345 346 - ``V4L2_PIX_FMT_XRGB555`` 347 - 'XR15' 348 349 - g\ :sub:`2` 350 - g\ :sub:`1` 351 - g\ :sub:`0` 352 - b\ :sub:`4` 353 - b\ :sub:`3` 354 - b\ :sub:`2` 355 - b\ :sub:`1` 356 - b\ :sub:`0` 357 358 - x 359 - r\ :sub:`4` 360 - r\ :sub:`3` 361 - r\ :sub:`2` 362 - r\ :sub:`1` 363 - r\ :sub:`0` 364 - g\ :sub:`4` 365 - g\ :sub:`3` 366 - 367 * .. _V4L2-PIX-FMT-RGBA555: 368 369 - ``V4L2_PIX_FMT_RGBA555`` 370 - 'RA15' 371 372 - g\ :sub:`1` 373 - g\ :sub:`0` 374 - b\ :sub:`4` 375 - b\ :sub:`3` 376 - b\ :sub:`2` 377 - b\ :sub:`1` 378 - b\ :sub:`0` 379 - a 380 381 - r\ :sub:`4` 382 - r\ :sub:`3` 383 - r\ :sub:`2` 384 - r\ :sub:`1` 385 - r\ :sub:`0` 386 - g\ :sub:`4` 387 - g\ :sub:`3` 388 - g\ :sub:`2` 389 - 390 * .. _V4L2-PIX-FMT-RGBX555: 391 392 - ``V4L2_PIX_FMT_RGBX555`` 393 - 'RX15' 394 395 - g\ :sub:`1` 396 - g\ :sub:`0` 397 - b\ :sub:`4` 398 - b\ :sub:`3` 399 - b\ :sub:`2` 400 - b\ :sub:`1` 401 - b\ :sub:`0` 402 - x 403 404 - r\ :sub:`4` 405 - r\ :sub:`3` 406 - r\ :sub:`2` 407 - r\ :sub:`1` 408 - r\ :sub:`0` 409 - g\ :sub:`4` 410 - g\ :sub:`3` 411 - g\ :sub:`2` 412 - 413 * .. _V4L2-PIX-FMT-ABGR555: 414 415 - ``V4L2_PIX_FMT_ABGR555`` 416 - 'AB15' 417 418 - g\ :sub:`2` 419 - g\ :sub:`1` 420 - g\ :sub:`0` 421 - r\ :sub:`4` 422 - r\ :sub:`3` 423 - r\ :sub:`2` 424 - r\ :sub:`1` 425 - r\ :sub:`0` 426 427 - a 428 - b\ :sub:`4` 429 - b\ :sub:`3` 430 - b\ :sub:`2` 431 - b\ :sub:`1` 432 - b\ :sub:`0` 433 - g\ :sub:`4` 434 - g\ :sub:`3` 435 - 436 * .. _V4L2-PIX-FMT-XBGR555: 437 438 - ``V4L2_PIX_FMT_XBGR555`` 439 - 'XB15' 440 441 - g\ :sub:`2` 442 - g\ :sub:`1` 443 - g\ :sub:`0` 444 - r\ :sub:`4` 445 - r\ :sub:`3` 446 - r\ :sub:`2` 447 - r\ :sub:`1` 448 - r\ :sub:`0` 449 450 - x 451 - b\ :sub:`4` 452 - b\ :sub:`3` 453 - b\ :sub:`2` 454 - b\ :sub:`1` 455 - b\ :sub:`0` 456 - g\ :sub:`4` 457 - g\ :sub:`3` 458 - 459 * .. _V4L2-PIX-FMT-BGRA555: 460 461 - ``V4L2_PIX_FMT_BGRA555`` 462 - 'BA15' 463 464 - g\ :sub:`1` 465 - g\ :sub:`0` 466 - r\ :sub:`4` 467 - r\ :sub:`3` 468 - r\ :sub:`2` 469 - r\ :sub:`1` 470 - r\ :sub:`0` 471 - a 472 473 - b\ :sub:`4` 474 - b\ :sub:`3` 475 - b\ :sub:`2` 476 - b\ :sub:`1` 477 - b\ :sub:`0` 478 - g\ :sub:`4` 479 - g\ :sub:`3` 480 - g\ :sub:`2` 481 - 482 * .. _V4L2-PIX-FMT-BGRX555: 483 484 - ``V4L2_PIX_FMT_BGRX555`` 485 - 'BX15' 486 487 - g\ :sub:`1` 488 - g\ :sub:`0` 489 - r\ :sub:`4` 490 - r\ :sub:`3` 491 - r\ :sub:`2` 492 - r\ :sub:`1` 493 - r\ :sub:`0` 494 - x 495 496 - b\ :sub:`4` 497 - b\ :sub:`3` 498 - b\ :sub:`2` 499 - b\ :sub:`1` 500 - b\ :sub:`0` 501 - g\ :sub:`4` 502 - g\ :sub:`3` 503 - g\ :sub:`2` 504 - 505 * .. _V4L2-PIX-FMT-RGB565: 506 507 - ``V4L2_PIX_FMT_RGB565`` 508 - 'RGBP' 509 510 - g\ :sub:`2` 511 - g\ :sub:`1` 512 - g\ :sub:`0` 513 - b\ :sub:`4` 514 - b\ :sub:`3` 515 - b\ :sub:`2` 516 - b\ :sub:`1` 517 - b\ :sub:`0` 518 519 - r\ :sub:`4` 520 - r\ :sub:`3` 521 - r\ :sub:`2` 522 - r\ :sub:`1` 523 - r\ :sub:`0` 524 - g\ :sub:`5` 525 - g\ :sub:`4` 526 - g\ :sub:`3` 527 - 528 * .. _V4L2-PIX-FMT-ARGB555X: 529 530 - ``V4L2_PIX_FMT_ARGB555X`` 531 - 'AR15' | (1 << 31) 532 533 - a 534 - r\ :sub:`4` 535 - r\ :sub:`3` 536 - r\ :sub:`2` 537 - r\ :sub:`1` 538 - r\ :sub:`0` 539 - g\ :sub:`4` 540 - g\ :sub:`3` 541 542 - g\ :sub:`2` 543 - g\ :sub:`1` 544 - g\ :sub:`0` 545 - b\ :sub:`4` 546 - b\ :sub:`3` 547 - b\ :sub:`2` 548 - b\ :sub:`1` 549 - b\ :sub:`0` 550 - 551 * .. _V4L2-PIX-FMT-XRGB555X: 552 553 - ``V4L2_PIX_FMT_XRGB555X`` 554 - 'XR15' | (1 << 31) 555 556 - x 557 - r\ :sub:`4` 558 - r\ :sub:`3` 559 - r\ :sub:`2` 560 - r\ :sub:`1` 561 - r\ :sub:`0` 562 - g\ :sub:`4` 563 - g\ :sub:`3` 564 565 - g\ :sub:`2` 566 - g\ :sub:`1` 567 - g\ :sub:`0` 568 - b\ :sub:`4` 569 - b\ :sub:`3` 570 - b\ :sub:`2` 571 - b\ :sub:`1` 572 - b\ :sub:`0` 573 - 574 * .. _V4L2-PIX-FMT-RGB565X: 575 576 - ``V4L2_PIX_FMT_RGB565X`` 577 - 'RGBR' 578 579 - r\ :sub:`4` 580 - r\ :sub:`3` 581 - r\ :sub:`2` 582 - r\ :sub:`1` 583 - r\ :sub:`0` 584 - g\ :sub:`5` 585 - g\ :sub:`4` 586 - g\ :sub:`3` 587 588 - g\ :sub:`2` 589 - g\ :sub:`1` 590 - g\ :sub:`0` 591 - b\ :sub:`4` 592 - b\ :sub:`3` 593 - b\ :sub:`2` 594 - b\ :sub:`1` 595 - b\ :sub:`0` 596 - 597 * .. _V4L2-PIX-FMT-BGR666: 598 599 - ``V4L2_PIX_FMT_BGR666`` 600 - 'BGRH' 601 602 - b\ :sub:`5` 603 - b\ :sub:`4` 604 - b\ :sub:`3` 605 - b\ :sub:`2` 606 - b\ :sub:`1` 607 - b\ :sub:`0` 608 - g\ :sub:`5` 609 - g\ :sub:`4` 610 611 - g\ :sub:`3` 612 - g\ :sub:`2` 613 - g\ :sub:`1` 614 - g\ :sub:`0` 615 - r\ :sub:`5` 616 - r\ :sub:`4` 617 - r\ :sub:`3` 618 - r\ :sub:`2` 619 620 - r\ :sub:`1` 621 - r\ :sub:`0` 622 - x 623 - x 624 - x 625 - x 626 - x 627 - x 628 629 - x 630 - x 631 - x 632 - x 633 - x 634 - x 635 - x 636 - x 637 638.. raw:: latex 639 640 \endgroup 641 642 6438 Bits Per Component 644==================== 645 646These formats store an RGB triplet in three or four bytes. They are named based 647on the order of the RGB components as stored in memory, and on the total number 648of bits per pixel. For instance, RGB24 format stores a pixel with [R\ :sub:`7` 649R\ :sub:`6` R\ :sub:`5` R\ :sub:`4` R\ :sub:`3` R\ :sub:`2` R\ :sub:`1` 650R\ :sub:`0`] in the first byte, [G\ :sub:`7` G\ :sub:`6` G\ :sub:`5` G\ :sub:`4` 651G\ :sub:`3` G\ :sub:`2` G\ :sub:`1` G\ :sub:`0`] in the second byte and 652[B\ :sub:`7` B\ :sub:`6` B\ :sub:`5` B\ :sub:`4` B\ :sub:`3` B\ :sub:`2` 653B\ :sub:`1` B\ :sub:`0`] in the third byte. This differs from the DRM format 654nomenclature that instead use the order of components as seen in a 24- or 65532-bit little endian word. 656 657.. raw:: latex 658 659 \small 660 661.. flat-table:: RGB Formats With 8 Bits Per Component 662 :header-rows: 1 663 :stub-columns: 0 664 665 * - Identifier 666 - Code 667 - Byte 0 in memory 668 - Byte 1 669 - Byte 2 670 - Byte 3 671 * .. _V4L2-PIX-FMT-BGR24: 672 673 - ``V4L2_PIX_FMT_BGR24`` 674 - 'BGR3' 675 676 - B\ :sub:`7-0` 677 - G\ :sub:`7-0` 678 - R\ :sub:`7-0` 679 - 680 * .. _V4L2-PIX-FMT-RGB24: 681 682 - ``V4L2_PIX_FMT_RGB24`` 683 - 'RGB3' 684 685 - R\ :sub:`7-0` 686 - G\ :sub:`7-0` 687 - B\ :sub:`7-0` 688 - 689 * .. _V4L2-PIX-FMT-ABGR32: 690 691 - ``V4L2_PIX_FMT_ABGR32`` 692 - 'AR24' 693 694 - B\ :sub:`7-0` 695 - G\ :sub:`7-0` 696 - R\ :sub:`7-0` 697 - A\ :sub:`7-0` 698 * .. _V4L2-PIX-FMT-XBGR32: 699 700 - ``V4L2_PIX_FMT_XBGR32`` 701 - 'XR24' 702 703 - B\ :sub:`7-0` 704 - G\ :sub:`7-0` 705 - R\ :sub:`7-0` 706 - X\ :sub:`7-0` 707 * .. _V4L2-PIX-FMT-BGRA32: 708 709 - ``V4L2_PIX_FMT_BGRA32`` 710 - 'RA24' 711 712 - A\ :sub:`7-0` 713 - B\ :sub:`7-0` 714 - G\ :sub:`7-0` 715 - R\ :sub:`7-0` 716 * .. _V4L2-PIX-FMT-BGRX32: 717 718 - ``V4L2_PIX_FMT_BGRX32`` 719 - 'RX24' 720 721 - X\ :sub:`7-0` 722 - B\ :sub:`7-0` 723 - G\ :sub:`7-0` 724 - R\ :sub:`7-0` 725 * .. _V4L2-PIX-FMT-RGBA32: 726 727 - ``V4L2_PIX_FMT_RGBA32`` 728 - 'AB24' 729 730 - R\ :sub:`7-0` 731 - G\ :sub:`7-0` 732 - B\ :sub:`7-0` 733 - A\ :sub:`7-0` 734 * .. _V4L2-PIX-FMT-RGBX32: 735 736 - ``V4L2_PIX_FMT_RGBX32`` 737 - 'XB24' 738 739 - R\ :sub:`7-0` 740 - G\ :sub:`7-0` 741 - B\ :sub:`7-0` 742 - X\ :sub:`7-0` 743 * .. _V4L2-PIX-FMT-ARGB32: 744 745 - ``V4L2_PIX_FMT_ARGB32`` 746 - 'BA24' 747 748 - A\ :sub:`7-0` 749 - R\ :sub:`7-0` 750 - G\ :sub:`7-0` 751 - B\ :sub:`7-0` 752 * .. _V4L2-PIX-FMT-XRGB32: 753 754 - ``V4L2_PIX_FMT_XRGB32`` 755 - 'BX24' 756 757 - X\ :sub:`7-0` 758 - R\ :sub:`7-0` 759 - G\ :sub:`7-0` 760 - B\ :sub:`7-0` 761 762.. raw:: latex 763 764 \normalsize 765 766 76710 Bits Per Component 768===================== 769 770These formats store a 30-bit RGB triplet with an optional 2 bit alpha in four 771bytes. They are named based on the order of the RGB components as seen in a 77232-bit word, which is then stored in memory in little endian byte order 773(unless otherwise noted by the presence of bit 31 in the 4CC value), and on the 774number of bits for each component. 775 776.. raw:: latex 777 778 \begingroup 779 \tiny 780 \setlength{\tabcolsep}{2pt} 781 782.. tabularcolumns:: |p{3.2cm}|p{0.8cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| 783 784 785.. flat-table:: RGB Formats 10 Bits Per Color Component 786 :header-rows: 2 787 :stub-columns: 0 788 789 * - Identifier 790 - Code 791 - :cspan:`7` Byte 0 in memory 792 - :cspan:`7` Byte 1 793 - :cspan:`7` Byte 2 794 - :cspan:`7` Byte 3 795 * - 796 - 797 - 7 798 - 6 799 - 5 800 - 4 801 - 3 802 - 2 803 - 1 804 - 0 805 806 - 7 807 - 6 808 - 5 809 - 4 810 - 3 811 - 2 812 - 1 813 - 0 814 815 - 7 816 - 6 817 - 5 818 - 4 819 - 3 820 - 2 821 - 1 822 - 0 823 824 - 7 825 - 6 826 - 5 827 - 4 828 - 3 829 - 2 830 - 1 831 - 0 832 * .. _V4L2-PIX-FMT-RGBX1010102: 833 834 - ``V4L2_PIX_FMT_RGBX1010102`` 835 - 'RX30' 836 837 - b\ :sub:`5` 838 - b\ :sub:`4` 839 - b\ :sub:`3` 840 - b\ :sub:`2` 841 - b\ :sub:`1` 842 - b\ :sub:`0` 843 - x 844 - x 845 846 - g\ :sub:`3` 847 - g\ :sub:`2` 848 - g\ :sub:`1` 849 - g\ :sub:`0` 850 - b\ :sub:`9` 851 - b\ :sub:`8` 852 - b\ :sub:`7` 853 - b\ :sub:`6` 854 855 - r\ :sub:`1` 856 - r\ :sub:`0` 857 - g\ :sub:`9` 858 - g\ :sub:`8` 859 - g\ :sub:`7` 860 - g\ :sub:`6` 861 - g\ :sub:`5` 862 - g\ :sub:`4` 863 864 - r\ :sub:`9` 865 - r\ :sub:`8` 866 - r\ :sub:`7` 867 - r\ :sub:`6` 868 - r\ :sub:`5` 869 - r\ :sub:`4` 870 - r\ :sub:`3` 871 - r\ :sub:`2` 872 * .. _V4L2-PIX-FMT-RGBA1010102: 873 874 - ``V4L2_PIX_FMT_RGBA1010102`` 875 - 'RA30' 876 877 - b\ :sub:`5` 878 - b\ :sub:`4` 879 - b\ :sub:`3` 880 - b\ :sub:`2` 881 - b\ :sub:`1` 882 - b\ :sub:`0` 883 - a\ :sub:`1` 884 - a\ :sub:`0` 885 886 - g\ :sub:`3` 887 - g\ :sub:`2` 888 - g\ :sub:`1` 889 - g\ :sub:`0` 890 - b\ :sub:`9` 891 - b\ :sub:`8` 892 - b\ :sub:`7` 893 - b\ :sub:`6` 894 895 - r\ :sub:`1` 896 - r\ :sub:`0` 897 - g\ :sub:`9` 898 - g\ :sub:`8` 899 - g\ :sub:`7` 900 - g\ :sub:`6` 901 - g\ :sub:`5` 902 - g\ :sub:`4` 903 904 - r\ :sub:`9` 905 - r\ :sub:`8` 906 - r\ :sub:`7` 907 - r\ :sub:`6` 908 - r\ :sub:`5` 909 - r\ :sub:`4` 910 - r\ :sub:`3` 911 - r\ :sub:`2` 912 * .. _V4L2-PIX-FMT-ARGB2101010: 913 914 - ``V4L2_PIX_FMT_ARGB2101010`` 915 - 'AR30' 916 917 - b\ :sub:`7` 918 - b\ :sub:`6` 919 - b\ :sub:`5` 920 - b\ :sub:`4` 921 - b\ :sub:`3` 922 - b\ :sub:`2` 923 - b\ :sub:`1` 924 - b\ :sub:`0` 925 926 - g\ :sub:`5` 927 - g\ :sub:`4` 928 - g\ :sub:`3` 929 - g\ :sub:`2` 930 - g\ :sub:`1` 931 - g\ :sub:`0` 932 - b\ :sub:`9` 933 - b\ :sub:`8` 934 935 - r\ :sub:`3` 936 - r\ :sub:`2` 937 - r\ :sub:`1` 938 - r\ :sub:`0` 939 - g\ :sub:`9` 940 - g\ :sub:`8` 941 - g\ :sub:`7` 942 - g\ :sub:`6` 943 944 - a\ :sub:`1` 945 - a\ :sub:`0` 946 - r\ :sub:`9` 947 - r\ :sub:`8` 948 - r\ :sub:`7` 949 - r\ :sub:`6` 950 - r\ :sub:`5` 951 - r\ :sub:`4` 952 953.. raw:: latex 954 955 \endgroup 956 95712 Bits Per Component 958============================== 959 960These formats store an RGB triplet in six or eight bytes, with 12 bits per component. 961Expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, 962arranged in little endian order. 963 964.. raw:: latex 965 966 \small 967 968.. flat-table:: RGB Formats With 12 Bits Per Component 969 :header-rows: 1 970 971 * - Identifier 972 - Code 973 - Byte 1-0 974 - Byte 3-2 975 - Byte 5-4 976 - Byte 7-6 977 * .. _V4L2-PIX-FMT-BGR48-12: 978 979 - ``V4L2_PIX_FMT_BGR48_12`` 980 - 'B312' 981 982 - B\ :sub:`15-4` 983 - G\ :sub:`15-4` 984 - R\ :sub:`15-4` 985 - 986 * .. _V4L2-PIX-FMT-ABGR64-12: 987 988 - ``V4L2_PIX_FMT_ABGR64_12`` 989 - 'B412' 990 991 - B\ :sub:`15-4` 992 - G\ :sub:`15-4` 993 - R\ :sub:`15-4` 994 - A\ :sub:`15-4` 995 996.. raw:: latex 997 998 \normalsize 999 100016 Bits Per Component 1001===================== 1002 1003These formats store an RGB triplet in six bytes, with 16 bits per component 1004stored in memory in little endian byte order. They are named based on the order 1005of the RGB components as stored in memory. For instance, RGB48 stores R\ 1006:sub:`7:0` and R\ :sub:`15:8` in bytes 0 and 1 respectively. This differs from 1007the DRM format nomenclature that instead uses the order of components as seen in 1008the 48-bits little endian word. 1009 1010.. raw:: latex 1011 1012 \small 1013 1014.. flat-table:: RGB Formats With 16 Bits Per Component 1015 :header-rows: 1 1016 1017 * - Identifier 1018 - Code 1019 - Byte 0 1020 - Byte 1 1021 - Byte 2 1022 - Byte 3 1023 - Byte 4 1024 - Byte 5 1025 1026 * .. _V4L2-PIX-FMT-BGR48: 1027 1028 - ``V4L2_PIX_FMT_BGR48`` 1029 - 'BGR6' 1030 1031 - B\ :sub:`7-0` 1032 - B\ :sub:`15-8` 1033 - G\ :sub:`7-0` 1034 - G\ :sub:`15-8` 1035 - R\ :sub:`7-0` 1036 - R\ :sub:`15-8` 1037 1038 * .. _V4L2-PIX-FMT-RGB48: 1039 1040 - ``V4L2_PIX_FMT_RGB48`` 1041 - 'RGB6' 1042 1043 - R\ :sub:`7-0` 1044 - R\ :sub:`15-8` 1045 - G\ :sub:`7-0` 1046 - G\ :sub:`15-8` 1047 - B\ :sub:`7-0` 1048 - B\ :sub:`15-8` 1049 1050.. raw:: latex 1051 1052 \normalsize 1053 1054Deprecated RGB Formats 1055====================== 1056 1057Formats defined in :ref:`pixfmt-rgb-deprecated` are deprecated and must not be 1058used by new drivers. They are documented here for reference. The meaning of 1059their alpha bits ``(a)`` is ill-defined and they are interpreted as in either 1060the corresponding ARGB or XRGB format, depending on the driver. 1061 1062.. raw:: latex 1063 1064 \begingroup 1065 \tiny 1066 \setlength{\tabcolsep}{2pt} 1067 1068.. tabularcolumns:: |p{2.6cm}|p{0.70cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| 1069 1070.. _pixfmt-rgb-deprecated: 1071 1072.. flat-table:: Deprecated Packed RGB Image Formats 1073 :header-rows: 2 1074 :stub-columns: 0 1075 1076 * - Identifier 1077 - Code 1078 - :cspan:`7` Byte 0 in memory 1079 1080 - :cspan:`7` Byte 1 1081 1082 - :cspan:`7` Byte 2 1083 1084 - :cspan:`7` Byte 3 1085 * - 1086 - 1087 - 7 1088 - 6 1089 - 5 1090 - 4 1091 - 3 1092 - 2 1093 - 1 1094 - 0 1095 1096 - 7 1097 - 6 1098 - 5 1099 - 4 1100 - 3 1101 - 2 1102 - 1 1103 - 0 1104 1105 - 7 1106 - 6 1107 - 5 1108 - 4 1109 - 3 1110 - 2 1111 - 1 1112 - 0 1113 1114 - 7 1115 - 6 1116 - 5 1117 - 4 1118 - 3 1119 - 2 1120 - 1 1121 - 0 1122 * .. _V4L2-PIX-FMT-RGB444: 1123 1124 - ``V4L2_PIX_FMT_RGB444`` 1125 - 'R444' 1126 1127 - g\ :sub:`3` 1128 - g\ :sub:`2` 1129 - g\ :sub:`1` 1130 - g\ :sub:`0` 1131 - b\ :sub:`3` 1132 - b\ :sub:`2` 1133 - b\ :sub:`1` 1134 - b\ :sub:`0` 1135 1136 - a\ :sub:`3` 1137 - a\ :sub:`2` 1138 - a\ :sub:`1` 1139 - a\ :sub:`0` 1140 - r\ :sub:`3` 1141 - r\ :sub:`2` 1142 - r\ :sub:`1` 1143 - r\ :sub:`0` 1144 - 1145 * .. _V4L2-PIX-FMT-RGB555: 1146 1147 - ``V4L2_PIX_FMT_RGB555`` 1148 - 'RGBO' 1149 1150 - g\ :sub:`2` 1151 - g\ :sub:`1` 1152 - g\ :sub:`0` 1153 - b\ :sub:`4` 1154 - b\ :sub:`3` 1155 - b\ :sub:`2` 1156 - b\ :sub:`1` 1157 - b\ :sub:`0` 1158 1159 - a 1160 - r\ :sub:`4` 1161 - r\ :sub:`3` 1162 - r\ :sub:`2` 1163 - r\ :sub:`1` 1164 - r\ :sub:`0` 1165 - g\ :sub:`4` 1166 - g\ :sub:`3` 1167 - 1168 * .. _V4L2-PIX-FMT-RGB555X: 1169 1170 - ``V4L2_PIX_FMT_RGB555X`` 1171 - 'RGBQ' 1172 1173 - a 1174 - r\ :sub:`4` 1175 - r\ :sub:`3` 1176 - r\ :sub:`2` 1177 - r\ :sub:`1` 1178 - r\ :sub:`0` 1179 - g\ :sub:`4` 1180 - g\ :sub:`3` 1181 1182 - g\ :sub:`2` 1183 - g\ :sub:`1` 1184 - g\ :sub:`0` 1185 - b\ :sub:`4` 1186 - b\ :sub:`3` 1187 - b\ :sub:`2` 1188 - b\ :sub:`1` 1189 - b\ :sub:`0` 1190 - 1191 * .. _V4L2-PIX-FMT-BGR32: 1192 1193 - ``V4L2_PIX_FMT_BGR32`` 1194 - 'BGR4' 1195 1196 - b\ :sub:`7` 1197 - b\ :sub:`6` 1198 - b\ :sub:`5` 1199 - b\ :sub:`4` 1200 - b\ :sub:`3` 1201 - b\ :sub:`2` 1202 - b\ :sub:`1` 1203 - b\ :sub:`0` 1204 1205 - g\ :sub:`7` 1206 - g\ :sub:`6` 1207 - g\ :sub:`5` 1208 - g\ :sub:`4` 1209 - g\ :sub:`3` 1210 - g\ :sub:`2` 1211 - g\ :sub:`1` 1212 - g\ :sub:`0` 1213 1214 - r\ :sub:`7` 1215 - r\ :sub:`6` 1216 - r\ :sub:`5` 1217 - r\ :sub:`4` 1218 - r\ :sub:`3` 1219 - r\ :sub:`2` 1220 - r\ :sub:`1` 1221 - r\ :sub:`0` 1222 1223 - a\ :sub:`7` 1224 - a\ :sub:`6` 1225 - a\ :sub:`5` 1226 - a\ :sub:`4` 1227 - a\ :sub:`3` 1228 - a\ :sub:`2` 1229 - a\ :sub:`1` 1230 - a\ :sub:`0` 1231 * .. _V4L2-PIX-FMT-RGB32: 1232 1233 - ``V4L2_PIX_FMT_RGB32`` 1234 - 'RGB4' 1235 1236 - a\ :sub:`7` 1237 - a\ :sub:`6` 1238 - a\ :sub:`5` 1239 - a\ :sub:`4` 1240 - a\ :sub:`3` 1241 - a\ :sub:`2` 1242 - a\ :sub:`1` 1243 - a\ :sub:`0` 1244 1245 - r\ :sub:`7` 1246 - r\ :sub:`6` 1247 - r\ :sub:`5` 1248 - r\ :sub:`4` 1249 - r\ :sub:`3` 1250 - r\ :sub:`2` 1251 - r\ :sub:`1` 1252 - r\ :sub:`0` 1253 1254 - g\ :sub:`7` 1255 - g\ :sub:`6` 1256 - g\ :sub:`5` 1257 - g\ :sub:`4` 1258 - g\ :sub:`3` 1259 - g\ :sub:`2` 1260 - g\ :sub:`1` 1261 - g\ :sub:`0` 1262 1263 - b\ :sub:`7` 1264 - b\ :sub:`6` 1265 - b\ :sub:`5` 1266 - b\ :sub:`4` 1267 - b\ :sub:`3` 1268 - b\ :sub:`2` 1269 - b\ :sub:`1` 1270 - b\ :sub:`0` 1271 1272.. raw:: latex 1273 1274 \endgroup 1275 1276A test utility to determine which RGB formats a driver actually supports 1277is available from the LinuxTV v4l-dvb repository. See 1278`https://linuxtv.org/repo/ <https://linuxtv.org/repo/>`__ for access 1279instructions. 1280