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