← Documents Documentation/userspace-api/media/v4l/pixfmt-rgb.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / V4L

RGB 형식

42개 packed RGB FourCC의 alpha·padding 의미와 bit/byte layout을 설명합니다.

Source pathDocumentation/userspace-api/media/v4l/pixfmt-rgb.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

pixfmt-rgb.rst:1-1278

Packed RGB 형식은 component bit 수, memory 순서와 alpha/padding semantic으로 구분되며 V4L2 naming은 DRM과 다른 기준을 사용합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Packed RGB와 alpha·padding 규칙

1-49

RGB 형식은 pixel 하나를 R, G, B 값의 triplet으로 encoding합니다. 모두 packed 형식이라 한 pixel의 component가 memory에 연속 저장되고 pixel 하나가 정수 개 byte를 차지합니다. Pixel bit 수가 byte 경계에 맞지 않으면 남는 bit를 padding으로 채웁니다.

형식은 component별 bit 수, memory에서의 component 순서, alpha component 또는 추가 padding bit의 유무로 구분됩니다. Component bit 수는 대체로 같지만 항상 같지는 않습니다.

ARGB 및 그 순열인 alpha 형식에서 alpha의 용도와 값은 device 유형과 hardware operation에 따라 달라집니다. Capture device와 mem-to-mem capture queue는 alpha를 memory에 채웁니다. 실제 alpha channel을 capture하면 값에 의미가 있고, channel은 없지만 고정 alpha를 넣을 수 있으면 `V4L2_CID_ALPHA_COMPONENT`로 모든 pixel의 alpha 값을 정합니다. 어느 쪽도 아니면 alpha 형식 대신 대응 XRGB/XBGR 형식을 사용해야 합니다.

Output device, mem-to-mem output queue와 video output overlay는 alpha를 memory에서 읽습니다. Hardware가 alpha를 처리한다면 application이 의미 있는 값을 채워야 하며, 처리하지 않는다면 역시 대응 XRGB/XBGR 형식을 사용합니다.

이름에 X가 있는 형식의 X bit는 padding입니다. 값은 undefined이므로 capture와 output 모두에서 application, device, driver가 무시해야 합니다. 뒤 표에서 bit 7은 byte의 MSB이고 r/g/b/a/x는 각각 red, green, blue, alpha, padding bit를 뜻합니다.

Alpha와 X 선택
Identifier / CodeMemory 배치
Capture가 alpha channel 제공ARGB 계열을 사용하고 capture된 alpha 값을 보존
Capture가 고정 alpha 삽입ARGB 계열과 `V4L2_CID_ALPHA_COMPONENT` 사용
Output이 alpha 처리Application이 ARGB alpha에 의미 있는 값을 기록
Alpha를 처리하지 않음대응 XRGB/XBGR 계열을 사용하고 X를 무시

Device가 alpha를 실제로 다루는지에 따라 형식을 선택합니다.

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later

.. _pixfmt-rgb:

***********
RGB Formats
***********

These formats encode each pixel as a triplet of RGB values. They are packed
formats, meaning that the RGB values for one pixel are stored consecutively in
memory and each pixel consumes an integer number of bytes. When the number of
bits required to store a pixel is not aligned to a byte boundary, the data is
padded with additional bits to fill the remaining byte.

The formats differ by the number of bits per RGB component (typically but not
always the same for all components), the order of components in memory, and the
presence of an alpha component or additional padding bits.

The usage and value of the alpha bits in formats that support them (named ARGB
or a permutation thereof, collectively referred to as alpha formats) depend on
the device type and hardware operation. :ref:`Capture <capture>` devices
(including capture queues of mem-to-mem devices) fill the alpha component in
memory. When the device captures an alpha channel the alpha component will have
a meaningful value. Otherwise, when the device doesn't capture an alpha channel
but can set the alpha bit to a user-configurable value, the
:ref:`V4L2_CID_ALPHA_COMPONENT <v4l2-alpha-component>` control is used to
specify that alpha value, and the alpha component of all pixels will be set to
the value specified by that control. Otherwise a corresponding format without
an alpha component (XRGB or XBGR) must be used instead of an alpha format.

:ref:`Output <output>` devices (including output queues of mem-to-mem devices
and :ref:`video output overlay <osd>` devices) read the alpha component from
memory. When the device processes the alpha channel the alpha component must be
filled with meaningful values by applications. Otherwise a corresponding format
without an alpha component (XRGB or XBGR) must be used instead of an alpha
format.

Formats that contain padding bits are named XRGB (or a permutation thereof).
The padding bits contain undefined values and must be ignored by applications,
devices and drivers, for both :ref:`capture` and :ref:`output` devices.

.. note::

   - In all the tables that follow, bit 7 is the most significant bit in a byte.
   - 'r', 'g' and 'b' denote bits of the red, green and blue components
     respectively. 'a' denotes bits of the alpha component (if supported by the
     format), and 'x' denotes padding bits.

8 bpc 미만: RGB332와 4:4:4

50-319

Component당 8 bit 미만인 형식은 pixel을 1, 2 또는 4 byte에 저장합니다. 이름은 8/16/32-bit word에서 보이는 component 순서와 각 component bit 수를 기준으로 하며, word는 기본적으로 little-endian으로 memory에 저장됩니다. FourCC 값의 bit 31이 설정된 형식은 명시된 반대 byte 순서를 사용합니다.

예를 들어 RGB565의 16-bit word는 `[R4:0 G5:0 B4:0]`이고 little-endian memory에서는 낮은 byte `[G2:0 B4:0]` 다음 높은 byte `[R4:0 G5:3]`가 옵니다.

RGB332와 4:4:4 형식
Identifier / CodeMemory 배치
`V4L2_PIX_FMT_RGB332` / `RGB1`Byte 0=`R[2:0] G[2:0] B[1:0]`
`V4L2_PIX_FMT_ARGB444` / `AR12`Byte 0=`G[3:0] B[3:0]`; Byte 1=`A[3:0] R[3:0]`
`V4L2_PIX_FMT_XRGB444` / `XR12`Byte 0=`G[3:0] B[3:0]`; Byte 1=`X[3:0] R[3:0]`
`V4L2_PIX_FMT_RGBA444` / `RA12`Byte 0=`B[3:0] A[3:0]`; Byte 1=`R[3:0] G[3:0]`
`V4L2_PIX_FMT_RGBX444` / `RX12`Byte 0=`B[3:0] X[3:0]`; Byte 1=`R[3:0] G[3:0]`
`V4L2_PIX_FMT_ABGR444` / `AB12`Byte 0=`G[3:0] R[3:0]`; Byte 1=`A[3:0] B[3:0]`
`V4L2_PIX_FMT_XBGR444` / `XB12`Byte 0=`G[3:0] R[3:0]`; Byte 1=`X[3:0] B[3:0]`
`V4L2_PIX_FMT_BGRA444` / `BA12`Byte 0=`R[3:0] A[3:0]`; Byte 1=`B[3:0] G[3:0]`
`V4L2_PIX_FMT_BGRX444` / `BX12`Byte 0=`R[3:0] X[3:0]`; Byte 1=`B[3:0] G[3:0]`

Byte 0이 낮은 주소입니다. 각 표기는 한 byte 안의 MSB→LSB 순서입니다.

16-bit 형식 이름과 memory
형식 이름에서 16-bit word component 순서 확인각 component bit 수만큼 word bit range 배정Word의 낮은 8 bit를 Byte 0으로 저장높은 8 bit를 Byte 1로 저장

이름은 word의 MSB→LSB component 순서이고 memory는 little-endian임을 구분합니다.

Less Than 8 Bits Per Component
==============================

These formats store an RGB triplet in one, two or four bytes. They are named
based on the order of the RGB components as seen in a 8-, 16- or 32-bit word,
which is then stored in memory in little endian byte order (unless otherwise
noted by the presence of bit 31 in the 4CC value), and on the number of bits
for each component. For instance, the RGB565 format stores a pixel in a 16-bit
word [15:0] laid out at as [R\ :sub:`4` R\ :sub:`3` R\ :sub:`2` R\ :sub:`1`
R\ :sub:`0` G\ :sub:`5` G\ :sub:`4` G\ :sub:`3` G\ :sub:`2` G\ :sub:`1`
G\ :sub:`0` B\ :sub:`4` B\ :sub:`3` B\ :sub:`2` B\ :sub:`1` B\ :sub:`0`], and
stored in memory in two bytes, [R\ :sub:`4` R\ :sub:`3` R\ :sub:`2` R\ :sub:`1`
R\ :sub:`0` G\ :sub:`5` G\ :sub:`4` G\ :sub:`3`] followed by [G\ :sub:`2`
G\ :sub:`1` G\ :sub:`0` B\ :sub:`4` B\ :sub:`3` B\ :sub:`2` B\ :sub:`1`
B\ :sub:`0`].

.. raw:: latex

    \begingroup
    \tiny
    \setlength{\tabcolsep}{2pt}

.. 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}|


.. flat-table:: RGB Formats With Less Than 8 Bits Per Component
    :header-rows:  2
    :stub-columns: 0

    * - Identifier
      - Code
      - :cspan:`7` Byte 0 in memory
      - :cspan:`7` Byte 1
      - :cspan:`7` Byte 2
      - :cspan:`7` Byte 3
    * -
      -
      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0

      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0

      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0

      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0
    * .. _V4L2-PIX-FMT-RGB332:

      - ``V4L2_PIX_FMT_RGB332``
      - 'RGB1'

      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`1`
      - b\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-ARGB444:

      - ``V4L2_PIX_FMT_ARGB444``
      - 'AR12'

      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

      - a\ :sub:`3`
      - a\ :sub:`2`
      - a\ :sub:`1`
      - a\ :sub:`0`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-XRGB444:

      - ``V4L2_PIX_FMT_XRGB444``
      - 'XR12'

      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

      - x
      - x
      - x
      - x
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-RGBA444:

      - ``V4L2_PIX_FMT_RGBA444``
      - 'RA12'

      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - a\ :sub:`3`
      - a\ :sub:`2`
      - a\ :sub:`1`
      - a\ :sub:`0`

      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-RGBX444:

      - ``V4L2_PIX_FMT_RGBX444``
      - 'RX12'

      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - x
      - x
      - x
      - x

      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-ABGR444:

      - ``V4L2_PIX_FMT_ABGR444``
      - 'AB12'

      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`

      - a\ :sub:`3`
      - a\ :sub:`2`
      - a\ :sub:`1`
      - a\ :sub:`0`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-XBGR444:

      - ``V4L2_PIX_FMT_XBGR444``
      - 'XB12'

      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`

      - x
      - x
      - x
      - x
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-BGRA444:

      - ``V4L2_PIX_FMT_BGRA444``
      - 'BA12'

      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - a\ :sub:`3`
      - a\ :sub:`2`
      - a\ :sub:`1`
      - a\ :sub:`0`

      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-BGRX444:

      - ``V4L2_PIX_FMT_BGRX444``
      - 'BX12'

      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - x
      - x
      - x
      - x

      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      -

8 bpc 미만: 5:5:5·5:6:5·6:6:6

320-641
1-bit alpha/padding 5:5:5 계열
Identifier / CodeMemory 배치
`V4L2_PIX_FMT_ARGB555` / `AR15`B0=`G[2:0] B[4:0]`; B1=`A R[4:0] G[4:3]`
`V4L2_PIX_FMT_XRGB555` / `XR15`B0=`G[2:0] B[4:0]`; B1=`X R[4:0] G[4:3]`
`V4L2_PIX_FMT_RGBA555` / `RA15`B0=`G[1:0] B[4:0] A`; B1=`R[4:0] G[4:2]`
`V4L2_PIX_FMT_RGBX555` / `RX15`B0=`G[1:0] B[4:0] X`; B1=`R[4:0] G[4:2]`
`V4L2_PIX_FMT_ABGR555` / `AB15`B0=`G[2:0] R[4:0]`; B1=`A B[4:0] G[4:3]`
`V4L2_PIX_FMT_XBGR555` / `XB15`B0=`G[2:0] R[4:0]`; B1=`X B[4:0] G[4:3]`
`V4L2_PIX_FMT_BGRA555` / `BA15`B0=`G[1:0] R[4:0] A`; B1=`B[4:0] G[4:2]`
`V4L2_PIX_FMT_BGRX555` / `BX15`B0=`G[1:0] R[4:0] X`; B1=`B[4:0] G[4:2]`

A와 X만 다르고 RGB bit 배치는 쌍별로 같습니다.

5:6:5와 byte-order variant
Identifier / CodeMemory 배치
`V4L2_PIX_FMT_RGB565` / `RGBP`B0=`G[2:0] B[4:0]`; B1=`R[4:0] G[5:3]`
`V4L2_PIX_FMT_ARGB555X` / `AR15 | (1 << 31)`B0=`A R[4:0] G[4:3]`; B1=`G[2:0] B[4:0]`
`V4L2_PIX_FMT_XRGB555X` / `XR15 | (1 << 31)`B0=`X R[4:0] G[4:3]`; B1=`G[2:0] B[4:0]`
`V4L2_PIX_FMT_RGB565X` / `RGBR`B0=`R[4:0] G[5:3]`; B1=`G[2:0] B[4:0]`

FourCC bit 31 또는 X suffix가 byte 순서를 명시하는 형식입니다.

`V4L2_PIX_FMT_BGR666` (`BGRH`)은 4 byte를 차지하지만 실제 color는 18 bit입니다. Byte 0=`B[5:0] G[5:4]`, Byte 1=`G[3:0] R[5:2]`, Byte 2=`R[1:0] X[5:0]`, Byte 3은 모두 X padding입니다.

BGR666 유효 bit
ByteMSB→LSB
Byte 0B 6 bit + G 상위 2 bit
Byte 1G 하위 4 bit + R 상위 4 bit
Byte 2R 하위 2 bit + X 6 bit
Byte 3X 8 bit

14개 X bit는 정의되지 않으므로 무시합니다.

    * .. _V4L2-PIX-FMT-ARGB555:

      - ``V4L2_PIX_FMT_ARGB555``
      - 'AR15'

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

      - a
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`
      -
    * .. _V4L2-PIX-FMT-XRGB555:

      - ``V4L2_PIX_FMT_XRGB555``
      - 'XR15'

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

      - x
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`
      -
    * .. _V4L2-PIX-FMT-RGBA555:

      - ``V4L2_PIX_FMT_RGBA555``
      - 'RA15'

      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - a

      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`
      - g\ :sub:`2`
      -
    * .. _V4L2-PIX-FMT-RGBX555:

      - ``V4L2_PIX_FMT_RGBX555``
      - 'RX15'

      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - x

      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`
      - g\ :sub:`2`
      -
    * .. _V4L2-PIX-FMT-ABGR555:

      - ``V4L2_PIX_FMT_ABGR555``
      - 'AB15'

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`

      - a
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`
      -
    * .. _V4L2-PIX-FMT-XBGR555:

      - ``V4L2_PIX_FMT_XBGR555``
      - 'XB15'

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`

      - x
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`
      -
    * .. _V4L2-PIX-FMT-BGRA555:

      - ``V4L2_PIX_FMT_BGRA555``
      - 'BA15'

      - g\ :sub:`1`
      - g\ :sub:`0`
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - a

      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`
      - g\ :sub:`2`
      -
    * .. _V4L2-PIX-FMT-BGRX555:

      - ``V4L2_PIX_FMT_BGRX555``
      - 'BX15'

      - g\ :sub:`1`
      - g\ :sub:`0`
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - x

      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`
      - g\ :sub:`2`
      -
    * .. _V4L2-PIX-FMT-RGB565:

      - ``V4L2_PIX_FMT_RGB565``
      - 'RGBP'

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`5`
      - g\ :sub:`4`
      - g\ :sub:`3`
      -
    * .. _V4L2-PIX-FMT-ARGB555X:

      - ``V4L2_PIX_FMT_ARGB555X``
      - 'AR15' | (1 << 31)

      - a
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-XRGB555X:

      - ``V4L2_PIX_FMT_XRGB555X``
      - 'XR15' | (1 << 31)

      - x
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-RGB565X:

      - ``V4L2_PIX_FMT_RGB565X``
      - 'RGBR'

      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`5`
      - g\ :sub:`4`
      - g\ :sub:`3`

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-BGR666:

      - ``V4L2_PIX_FMT_BGR666``
      - 'BGRH'

      - b\ :sub:`5`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - g\ :sub:`5`
      - g\ :sub:`4`

      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - r\ :sub:`5`
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`

      - r\ :sub:`1`
      - r\ :sub:`0`
      - x
      - x
      - x
      - x
      - x
      - x

      - x
      - x
      - x
      - x
      - x
      - x
      - x
      - x

.. raw:: latex

    \endgroup

Component당 8 bit

642-765

8-bpc 형식은 RGB triplet을 3 byte 또는 alpha/padding을 포함해 4 byte에 저장합니다. 이름은 실제 memory의 component 순서와 pixel당 총 bit 수를 기준으로 합니다. RGB24는 Byte 0=R, Byte 1=G, Byte 2=B입니다. 이는 24/32-bit little-endian word에서 보이는 component 순서를 이름에 쓰는 DRM naming과 다릅니다.

RGB 8-bpc memory byte 순서
Identifier / CodeMemory 배치
`V4L2_PIX_FMT_BGR24` / `BGR3`B, G, R
`V4L2_PIX_FMT_RGB24` / `RGB3`R, G, B
`V4L2_PIX_FMT_ABGR32` / `AR24`B, G, R, A
`V4L2_PIX_FMT_XBGR32` / `XR24`B, G, R, X
`V4L2_PIX_FMT_BGRA32` / `RA24`A, B, G, R
`V4L2_PIX_FMT_BGRX32` / `RX24`X, B, G, R
`V4L2_PIX_FMT_RGBA32` / `AB24`R, G, B, A
`V4L2_PIX_FMT_RGBX32` / `XB24`R, G, B, X
`V4L2_PIX_FMT_ARGB32` / `BA24`A, R, G, B
`V4L2_PIX_FMT_XRGB32` / `BX24`X, R, G, B

A는 alpha, X는 undefined padding입니다.

V4L2와 DRM naming
Identifier / CodeMemory 배치
V4L2Memory Byte 0부터 component 순서를 이름에 반영
DRMLittle-endian 24/32-bit word의 MSB→LSB component 순서를 이름에 반영

같은 byte sequence를 이름으로 읽을 때 기준이 다릅니다.

8 Bits Per Component
====================

These formats store an RGB triplet in three or four bytes. They are named based
on the order of the RGB components as stored in memory, and on the total number
of bits per pixel. For instance, RGB24 format stores a pixel with [R\ :sub:`7`
R\ :sub:`6` R\ :sub:`5` R\ :sub:`4` R\ :sub:`3` R\ :sub:`2` R\ :sub:`1`
R\ :sub:`0`] in the first byte, [G\ :sub:`7` G\ :sub:`6` G\ :sub:`5` G\ :sub:`4`
G\ :sub:`3` G\ :sub:`2` G\ :sub:`1` G\ :sub:`0`] in the second byte and
[B\ :sub:`7` B\ :sub:`6` B\ :sub:`5` B\ :sub:`4` B\ :sub:`3` B\ :sub:`2`
B\ :sub:`1` B\ :sub:`0`] in the third byte. This differs from the DRM format
nomenclature that instead use the order of components as seen in a 24- or
32-bit little endian word.

.. raw:: latex

    \small

.. flat-table:: RGB Formats With 8 Bits Per Component
    :header-rows:  1
    :stub-columns: 0

    * - Identifier
      - Code
      - Byte 0 in memory
      - Byte 1
      - Byte 2
      - Byte 3
    * .. _V4L2-PIX-FMT-BGR24:

      - ``V4L2_PIX_FMT_BGR24``
      - 'BGR3'

      - B\ :sub:`7-0`
      - G\ :sub:`7-0`
      - R\ :sub:`7-0`
      -
    * .. _V4L2-PIX-FMT-RGB24:

      - ``V4L2_PIX_FMT_RGB24``
      - 'RGB3'

      - R\ :sub:`7-0`
      - G\ :sub:`7-0`
      - B\ :sub:`7-0`
      -
    * .. _V4L2-PIX-FMT-ABGR32:

      - ``V4L2_PIX_FMT_ABGR32``
      - 'AR24'

      - B\ :sub:`7-0`
      - G\ :sub:`7-0`
      - R\ :sub:`7-0`
      - A\ :sub:`7-0`
    * .. _V4L2-PIX-FMT-XBGR32:

      - ``V4L2_PIX_FMT_XBGR32``
      - 'XR24'

      - B\ :sub:`7-0`
      - G\ :sub:`7-0`
      - R\ :sub:`7-0`
      - X\ :sub:`7-0`
    * .. _V4L2-PIX-FMT-BGRA32:

      - ``V4L2_PIX_FMT_BGRA32``
      - 'RA24'

      - A\ :sub:`7-0`
      - B\ :sub:`7-0`
      - G\ :sub:`7-0`
      - R\ :sub:`7-0`
    * .. _V4L2-PIX-FMT-BGRX32:

      - ``V4L2_PIX_FMT_BGRX32``
      - 'RX24'

      - X\ :sub:`7-0`
      - B\ :sub:`7-0`
      - G\ :sub:`7-0`
      - R\ :sub:`7-0`
    * .. _V4L2-PIX-FMT-RGBA32:

      - ``V4L2_PIX_FMT_RGBA32``
      - 'AB24'

      - R\ :sub:`7-0`
      - G\ :sub:`7-0`
      - B\ :sub:`7-0`
      - A\ :sub:`7-0`
    * .. _V4L2-PIX-FMT-RGBX32:

      - ``V4L2_PIX_FMT_RGBX32``
      - 'XB24'

      - R\ :sub:`7-0`
      - G\ :sub:`7-0`
      - B\ :sub:`7-0`
      - X\ :sub:`7-0`
    * .. _V4L2-PIX-FMT-ARGB32:

      - ``V4L2_PIX_FMT_ARGB32``
      - 'BA24'

      - A\ :sub:`7-0`
      - R\ :sub:`7-0`
      - G\ :sub:`7-0`
      - B\ :sub:`7-0`
    * .. _V4L2-PIX-FMT-XRGB32:

      - ``V4L2_PIX_FMT_XRGB32``
      - 'BX24'

      - X\ :sub:`7-0`
      - R\ :sub:`7-0`
      - G\ :sub:`7-0`
      - B\ :sub:`7-0`

.. raw:: latex

    \normalsize

Component당 10 bit

766-955

10-bpc 형식은 30-bit RGB triplet과 선택적인 2-bit alpha를 4 byte에 저장합니다. 이름은 32-bit word에서 보이는 component 순서와 각 component bit 수를 기준으로 하고, word는 기본적으로 little-endian으로 memory에 저장됩니다. FourCC bit 31 표시는 예외 byte order를 뜻합니다.

10-bpc 32-bit word와 memory
Identifier / CodeMemory 배치
`V4L2_PIX_FMT_RGBX1010102` / `RX30`Word=`R[9:0] G[9:0] B[9:0] X[1:0]`; B0=`B[5:0] X[1:0]`, B1=`G[3:0] B[9:6]`, B2=`R[1:0] G[9:4]`, B3=`R[9:2]`
`V4L2_PIX_FMT_RGBA1010102` / `RA30`Word=`R[9:0] G[9:0] B[9:0] A[1:0]`; RGBX와 같고 low 2 bit가 alpha
`V4L2_PIX_FMT_ARGB2101010` / `AR30`Word=`A[1:0] R[9:0] G[9:0] B[9:0]`; B0=`B[7:0]`, B1=`G[5:0] B[9:8]`, B2=`R[3:0] G[9:6]`, B3=`A[1:0] R[9:4]`

Word 표기는 bit 31→0, byte 표기는 낮은 주소부터입니다.

10-bit component 복원
Byte 0..3을 little-endian 32-bit word로 결합형식별 R/G/B/A 또는 X bit range mask각 10-bit color를 0..1023 값으로 추출2-bit alpha는 0..3으로 사용하거나 X면 폐기

Byte 경계를 가로지르는 component를 32-bit word에서 복원합니다.

10 Bits Per Component
=====================

These formats store a 30-bit RGB triplet with an optional 2 bit alpha in four
bytes. They are named based on the order of the RGB components as seen in a
32-bit word, which is then stored in memory in little endian byte order
(unless otherwise noted by the presence of bit 31 in the 4CC value), and on the
number of bits for each component.

.. raw:: latex

    \begingroup
    \tiny
    \setlength{\tabcolsep}{2pt}

.. 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}|


.. flat-table:: RGB Formats 10 Bits Per Color Component
    :header-rows:  2
    :stub-columns: 0

    * - Identifier
      - Code
      - :cspan:`7` Byte 0 in memory
      - :cspan:`7` Byte 1
      - :cspan:`7` Byte 2
      - :cspan:`7` Byte 3
    * -
      -
      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0

      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0

      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0

      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0
    * .. _V4L2-PIX-FMT-RGBX1010102:

      - ``V4L2_PIX_FMT_RGBX1010102``
      - 'RX30'

      - b\ :sub:`5`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - x
      - x

      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`9`
      - b\ :sub:`8`
      - b\ :sub:`7`
      - b\ :sub:`6`

      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`9`
      - g\ :sub:`8`
      - g\ :sub:`7`
      - g\ :sub:`6`
      - g\ :sub:`5`
      - g\ :sub:`4`

      - r\ :sub:`9`
      - r\ :sub:`8`
      - r\ :sub:`7`
      - r\ :sub:`6`
      - r\ :sub:`5`
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
    * .. _V4L2-PIX-FMT-RGBA1010102:

      - ``V4L2_PIX_FMT_RGBA1010102``
      - 'RA30'

      - b\ :sub:`5`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      - a\ :sub:`1`
      - a\ :sub:`0`

      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`9`
      - b\ :sub:`8`
      - b\ :sub:`7`
      - b\ :sub:`6`

      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`9`
      - g\ :sub:`8`
      - g\ :sub:`7`
      - g\ :sub:`6`
      - g\ :sub:`5`
      - g\ :sub:`4`

      - r\ :sub:`9`
      - r\ :sub:`8`
      - r\ :sub:`7`
      - r\ :sub:`6`
      - r\ :sub:`5`
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
    * .. _V4L2-PIX-FMT-ARGB2101010:

      - ``V4L2_PIX_FMT_ARGB2101010``
      - 'AR30'

      - b\ :sub:`7`
      - b\ :sub:`6`
      - b\ :sub:`5`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

      - g\ :sub:`5`
      - g\ :sub:`4`
      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`9`
      - b\ :sub:`8`

      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`9`
      - g\ :sub:`8`
      - g\ :sub:`7`
      - g\ :sub:`6`

      - a\ :sub:`1`
      - a\ :sub:`0`
      - r\ :sub:`9`
      - r\ :sub:`8`
      - r\ :sub:`7`
      - r\ :sub:`6`
      - r\ :sub:`5`
      - r\ :sub:`4`

.. raw:: latex

    \endgroup

Component당 12·16 bit

956-1052

12-bpc 형식은 RGB triplet을 6 byte, alpha 포함 형식은 8 byte에 저장합니다. 각 12-bit component를 16-bit word의 상위 bit 15:4로 확장하고 하위 4 bit는 0으로 채우며 word는 little-endian입니다.

12-bpc 형식
Identifier / CodeMemory 배치
`V4L2_PIX_FMT_BGR48_12` / `B312`Bytes 1-0=B[15:4], 3-2=G[15:4], 5-4=R[15:4]
`V4L2_PIX_FMT_ABGR64_12` / `B412`Bytes 1-0=B[15:4], 3-2=G[15:4], 5-4=R[15:4], 7-6=A[15:4]

각 항목은 16-bit little-endian word 하나입니다.

16-bpc 형식은 RGB triplet을 6 byte에 저장하고 component마다 완전한 16-bit little-endian word를 사용합니다. 이름은 memory component 순서 기준이며, 48-bit little-endian word에서 보이는 순서를 쓰는 DRM naming과 다릅니다.

16-bpc 형식
Identifier / CodeMemory 배치
`V4L2_PIX_FMT_BGR48` / `BGR6`B[7:0], B[15:8], G[7:0], G[15:8], R[7:0], R[15:8]
`V4L2_PIX_FMT_RGB48` / `RGB6`R[7:0], R[15:8], G[7:0], G[15:8], B[7:0], B[15:8]

각 component는 low byte 뒤 high byte 순서입니다.

12 Bits Per Component
==============================

These formats store an RGB triplet in six or eight bytes, with 12 bits per component.
Expand the bits per component to 16 bits, data in the high bits, zeros in the low bits,
arranged in little endian order.

.. raw:: latex

    \small

.. flat-table:: RGB Formats With 12 Bits Per Component
    :header-rows:  1

    * - Identifier
      - Code
      - Byte 1-0
      - Byte 3-2
      - Byte 5-4
      - Byte 7-6
    * .. _V4L2-PIX-FMT-BGR48-12:

      - ``V4L2_PIX_FMT_BGR48_12``
      - 'B312'

      - B\ :sub:`15-4`
      - G\ :sub:`15-4`
      - R\ :sub:`15-4`
      -
    * .. _V4L2-PIX-FMT-ABGR64-12:

      - ``V4L2_PIX_FMT_ABGR64_12``
      - 'B412'

      - B\ :sub:`15-4`
      - G\ :sub:`15-4`
      - R\ :sub:`15-4`
      - A\ :sub:`15-4`

.. raw:: latex

    \normalsize

16 Bits Per Component
=====================

These formats store an RGB triplet in six bytes, with 16 bits per component
stored in memory in little endian byte order. They are named based on the order
of the RGB components as stored in memory. For instance, RGB48 stores R\
:sub:`7:0` and R\ :sub:`15:8` in bytes 0 and 1 respectively. This differs from
the DRM format nomenclature that instead uses the order of components as seen in
the 48-bits little endian word.

.. raw:: latex

    \small

.. flat-table:: RGB Formats With 16 Bits Per Component
    :header-rows:  1

    * - Identifier
      - Code
      - Byte 0
      - Byte 1
      - Byte 2
      - Byte 3
      - Byte 4
      - Byte 5

    * .. _V4L2-PIX-FMT-BGR48:

      - ``V4L2_PIX_FMT_BGR48``
      - 'BGR6'

      - B\ :sub:`7-0`
      - B\ :sub:`15-8`
      - G\ :sub:`7-0`
      - G\ :sub:`15-8`
      - R\ :sub:`7-0`
      - R\ :sub:`15-8`

    * .. _V4L2-PIX-FMT-RGB48:

      - ``V4L2_PIX_FMT_RGB48``
      - 'RGB6'

      - R\ :sub:`7-0`
      - R\ :sub:`15-8`
      - G\ :sub:`7-0`
      - G\ :sub:`15-8`
      - B\ :sub:`7-0`
      - B\ :sub:`15-8`

.. raw:: latex

    \normalsize

Deprecated RGB 형식

1053-1278

`pixfmt-rgb-deprecated`에 정의된 형식은 deprecated이므로 새 driver가 사용하면 안 됩니다. 호환성 참고를 위해 남아 있으며 alpha bit `(a)`의 의미가 명확하지 않습니다. Driver에 따라 대응 ARGB의 alpha로 해석하거나 XRGB의 padding으로 해석합니다.

Deprecated packed RGB
Identifier / CodeMemory 배치
`V4L2_PIX_FMT_RGB444` / `R444`B0=`G[3:0] B[3:0]`; B1=`a[3:0] R[3:0]`; `a` 의미가 driver 의존
`V4L2_PIX_FMT_RGB555` / `RGBO`B0=`G[2:0] B[4:0]`; B1=`a R[4:0] G[4:3]`; `a` 의미가 driver 의존
`V4L2_PIX_FMT_RGB555X` / `RGBQ`B0=`a R[4:0] G[4:3]`; B1=`G[2:0] B[4:0]`; `a` 의미가 driver 의존
`V4L2_PIX_FMT_BGR32` / `BGR4`Byte 0=B, Byte 1=G, Byte 2=R, Byte 3=a
`V4L2_PIX_FMT_RGB32` / `RGB4`Byte 0=a, Byte 1=R, Byte 2=G, Byte 3=B

새 구현은 명확한 A/X 형식으로 대체해야 합니다.

권장 대체 원칙
Identifier / CodeMemory 배치
의미 있는 alphaARGB/ABGR/RGBA/BGRA 계열
사용하지 않는 bitXRGB/XBGR/RGBX/BGRX 계열
Legacy 호환Deprecated FourCC는 기존 driver와의 협상에만 사용

Alpha semantic을 FourCC 이름으로 명확히 합니다.

Driver가 실제 지원하는 RGB 형식을 판별하는 test utility는 LinuxTV v4l-dvb repository에서 제공됩니다. 접근 방법은 `https://linuxtv.org/repo/`를 참조합니다.

Deprecated RGB Formats
======================

Formats defined in :ref:`pixfmt-rgb-deprecated` are deprecated and must not be
used by new drivers. They are documented here for reference. The meaning of
their alpha bits ``(a)`` is ill-defined and they are interpreted as in either
the corresponding ARGB or XRGB format, depending on the driver.

.. raw:: latex

    \begingroup
    \tiny
    \setlength{\tabcolsep}{2pt}

.. 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}|

.. _pixfmt-rgb-deprecated:

.. flat-table:: Deprecated Packed RGB Image Formats
    :header-rows:  2
    :stub-columns: 0

    * - Identifier
      - Code
      - :cspan:`7` Byte 0 in memory

      - :cspan:`7` Byte 1

      - :cspan:`7` Byte 2

      - :cspan:`7` Byte 3
    * -
      -
      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0

      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0

      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0

      - 7
      - 6
      - 5
      - 4
      - 3
      - 2
      - 1
      - 0
    * .. _V4L2-PIX-FMT-RGB444:

      - ``V4L2_PIX_FMT_RGB444``
      - 'R444'

      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

      - a\ :sub:`3`
      - a\ :sub:`2`
      - a\ :sub:`1`
      - a\ :sub:`0`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-RGB555:

      - ``V4L2_PIX_FMT_RGB555``
      - 'RGBO'

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

      - a
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`
      -
    * .. _V4L2-PIX-FMT-RGB555X:

      - ``V4L2_PIX_FMT_RGB555X``
      - 'RGBQ'

      - a
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`
      - g\ :sub:`4`
      - g\ :sub:`3`

      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`
      -
    * .. _V4L2-PIX-FMT-BGR32:

      - ``V4L2_PIX_FMT_BGR32``
      - 'BGR4'

      - b\ :sub:`7`
      - b\ :sub:`6`
      - b\ :sub:`5`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

      - g\ :sub:`7`
      - g\ :sub:`6`
      - g\ :sub:`5`
      - g\ :sub:`4`
      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`

      - r\ :sub:`7`
      - r\ :sub:`6`
      - r\ :sub:`5`
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`

      - a\ :sub:`7`
      - a\ :sub:`6`
      - a\ :sub:`5`
      - a\ :sub:`4`
      - a\ :sub:`3`
      - a\ :sub:`2`
      - a\ :sub:`1`
      - a\ :sub:`0`
    * .. _V4L2-PIX-FMT-RGB32:

      - ``V4L2_PIX_FMT_RGB32``
      - 'RGB4'

      - a\ :sub:`7`
      - a\ :sub:`6`
      - a\ :sub:`5`
      - a\ :sub:`4`
      - a\ :sub:`3`
      - a\ :sub:`2`
      - a\ :sub:`1`
      - a\ :sub:`0`

      - r\ :sub:`7`
      - r\ :sub:`6`
      - r\ :sub:`5`
      - r\ :sub:`4`
      - r\ :sub:`3`
      - r\ :sub:`2`
      - r\ :sub:`1`
      - r\ :sub:`0`

      - g\ :sub:`7`
      - g\ :sub:`6`
      - g\ :sub:`5`
      - g\ :sub:`4`
      - g\ :sub:`3`
      - g\ :sub:`2`
      - g\ :sub:`1`
      - g\ :sub:`0`

      - b\ :sub:`7`
      - b\ :sub:`6`
      - b\ :sub:`5`
      - b\ :sub:`4`
      - b\ :sub:`3`
      - b\ :sub:`2`
      - b\ :sub:`1`
      - b\ :sub:`0`

.. raw:: latex

    \endgroup

A test utility to determine which RGB formats a driver actually supports
is available from the LinuxTV v4l-dvb repository. See
`https://linuxtv.org/repo/ <https://linuxtv.org/repo/>`__ for access
instructions.