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