xref: /openbmc/linux/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst (revision f019679ea5f2ab650c3348a79e7d9c3625f62899)
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3.. planar-yuv:
4
5******************
6Planar YUV formats
7******************
8
9Planar formats split luma and chroma data in separate memory regions. They
10exist in two variants:
11
12- Semi-planar formats use two planes. The first plane is the luma plane and
13  stores the Y components. The second plane is the chroma plane and stores the
14  Cb and Cr components interleaved.
15
16- Fully planar formats use three planes to store the Y, Cb and Cr components
17  separately.
18
19Within a plane, components are stored in pixel order, which may be linear or
20tiled. Padding may be supported at the end of the lines, and the line stride of
21the chroma planes may be constrained by the line stride of the luma plane.
22
23Some planar formats allow planes to be placed in independent memory locations.
24They are identified by an 'M' suffix in their name (such as in
25``V4L2_PIX_FMT_NV12M``). Those formats are intended to be used only in drivers
26and applications that support the multi-planar API, described in
27:ref:`planar-apis`. Unless explicitly documented as supporting non-contiguous
28planes, formats require the planes to follow each other immediately in memory.
29
30
31Semi-Planar YUV Formats
32=======================
33
34These formats are commonly referred to as NV formats (NV12, NV16, ...). They
35use two planes, and store the luma components in the first plane and the chroma
36components in the second plane. The Cb and Cr components are interleaved in the
37chroma plane, with Cb and Cr always stored in pairs. The chroma order is
38exposed as different formats.
39
40For memory contiguous formats, the number of padding pixels at the end of the
41chroma lines is identical to the padding of the luma lines. Without horizontal
42subsampling, the chroma line stride (in bytes) is thus equal to twice the luma
43line stride. With horizontal subsampling by 2, the chroma line stride is equal
44to the luma line stride. Vertical subsampling doesn't affect the line stride.
45
46For non-contiguous formats, no constraints are enforced by the format on the
47relationship between the luma and chroma line padding and stride.
48
49All components are stored with the same number of bits per component.
50
51.. raw:: latex
52
53    \footnotesize
54
55.. tabularcolumns:: |p{5.2cm}|p{1.0cm}|p{1.5cm}|p{1.9cm}|p{1.2cm}|p{1.8cm}|p{2.7cm}|
56
57.. flat-table:: Overview of Semi-Planar YUV Formats
58    :header-rows:  1
59    :stub-columns: 0
60
61    * - Identifier
62      - Code
63      - Bits per component
64      - Subsampling
65      - Chroma order [1]_
66      - Contiguous [2]_
67      - Tiling [3]_
68    * - V4L2_PIX_FMT_NV12
69      - 'NV12'
70      - 8
71      - 4:2:0
72      - Cb, Cr
73      - Yes
74      - Linear
75    * - V4L2_PIX_FMT_NV21
76      - 'NV21'
77      - 8
78      - 4:2:0
79      - Cr, Cb
80      - Yes
81      - Linear
82    * - V4L2_PIX_FMT_NV12M
83      - 'NM12'
84      - 8
85      - 4:2:0
86      - Cb, Cr
87      - No
88      - Linear
89    * - V4L2_PIX_FMT_NV21M
90      - 'NM21'
91      - 8
92      - 4:2:0
93      - Cr, Cb
94      - No
95      - Linear
96    * - V4L2_PIX_FMT_NV12MT
97      - 'TM12'
98      - 8
99      - 4:2:0
100      - Cb, Cr
101      - No
102      - 64x32 tiles
103
104        Horizontal Z order
105    * - V4L2_PIX_FMT_NV12MT_16X16
106      - 'VM12'
107      - 8
108      - 4:2:2
109      - Cb, Cr
110      - No
111      - 16x16 tiles
112    * - V4L2_PIX_FMT_NV16
113      - 'NV16'
114      - 8
115      - 4:2:2
116      - Cb, Cr
117      - Yes
118      - Linear
119    * - V4L2_PIX_FMT_NV61
120      - 'NV61'
121      - 8
122      - 4:2:2
123      - Cr, Cb
124      - Yes
125      - Linear
126    * - V4L2_PIX_FMT_NV16M
127      - 'NM16'
128      - 8
129      - 4:2:2
130      - Cb, Cr
131      - No
132      - Linear
133    * - V4L2_PIX_FMT_NV61M
134      - 'NM61'
135      - 8
136      - 4:2:2
137      - Cr, Cb
138      - No
139      - Linear
140    * - V4L2_PIX_FMT_NV24
141      - 'NV24'
142      - 8
143      - 4:4:4
144      - Cb, Cr
145      - Yes
146      - Linear
147    * - V4L2_PIX_FMT_NV42
148      - 'NV42'
149      - 8
150      - 4:4:4
151      - Cr, Cb
152      - Yes
153      - Linear
154
155.. raw:: latex
156
157    \normalsize
158
159.. [1] Order of chroma samples in the second plane
160.. [2] Indicates if planes have to be contiguous in memory or can be
161       disjoint
162.. [3] Macroblock size in pixels
163
164
165**Color Sample Location:**
166Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
167horizontally.
168
169
170.. _V4L2-PIX-FMT-NV12:
171.. _V4L2-PIX-FMT-NV21:
172.. _V4L2-PIX-FMT-NV12M:
173.. _V4L2-PIX-FMT-NV21M:
174
175NV12, NV21, NV12M and NV21M
176---------------------------
177
178Semi-planar YUV 4:2:0 formats. The chroma plane is subsampled by 2 in each
179direction. Chroma lines contain half the number of pixels and the same number
180of bytes as luma lines, and the chroma plane contains half the number of lines
181of the luma plane.
182
183.. flat-table:: Sample 4x4 NV12 Image
184    :header-rows:  0
185    :stub-columns: 0
186
187    * - start + 0:
188      - Y'\ :sub:`00`
189      - Y'\ :sub:`01`
190      - Y'\ :sub:`02`
191      - Y'\ :sub:`03`
192    * - start + 4:
193      - Y'\ :sub:`10`
194      - Y'\ :sub:`11`
195      - Y'\ :sub:`12`
196      - Y'\ :sub:`13`
197    * - start + 8:
198      - Y'\ :sub:`20`
199      - Y'\ :sub:`21`
200      - Y'\ :sub:`22`
201      - Y'\ :sub:`23`
202    * - start + 12:
203      - Y'\ :sub:`30`
204      - Y'\ :sub:`31`
205      - Y'\ :sub:`32`
206      - Y'\ :sub:`33`
207    * - start + 16:
208      - Cb\ :sub:`00`
209      - Cr\ :sub:`00`
210      - Cb\ :sub:`01`
211      - Cr\ :sub:`01`
212    * - start + 20:
213      - Cb\ :sub:`10`
214      - Cr\ :sub:`10`
215      - Cb\ :sub:`11`
216      - Cr\ :sub:`11`
217
218.. flat-table:: Sample 4x4 NV12M Image
219    :header-rows:  0
220    :stub-columns: 0
221
222    * - start0 + 0:
223      - Y'\ :sub:`00`
224      - Y'\ :sub:`01`
225      - Y'\ :sub:`02`
226      - Y'\ :sub:`03`
227    * - start0 + 4:
228      - Y'\ :sub:`10`
229      - Y'\ :sub:`11`
230      - Y'\ :sub:`12`
231      - Y'\ :sub:`13`
232    * - start0 + 8:
233      - Y'\ :sub:`20`
234      - Y'\ :sub:`21`
235      - Y'\ :sub:`22`
236      - Y'\ :sub:`23`
237    * - start0 + 12:
238      - Y'\ :sub:`30`
239      - Y'\ :sub:`31`
240      - Y'\ :sub:`32`
241      - Y'\ :sub:`33`
242    * -
243    * - start1 + 0:
244      - Cb\ :sub:`00`
245      - Cr\ :sub:`00`
246      - Cb\ :sub:`01`
247      - Cr\ :sub:`01`
248    * - start1 + 4:
249      - Cb\ :sub:`10`
250      - Cr\ :sub:`10`
251      - Cb\ :sub:`11`
252      - Cr\ :sub:`11`
253
254
255.. _V4L2-PIX-FMT-NV12MT:
256.. _V4L2-PIX-FMT-NV12MT-16X16:
257.. _V4L2-PIX-FMT-NV12-4L4:
258.. _V4L2-PIX-FMT-NV12-16L16:
259.. _V4L2-PIX-FMT-NV12-32L32:
260.. _V4L2-PIX-FMT-NV12M-8L128:
261.. _V4L2-PIX-FMT-NV12M-10BE-8L128:
262.. _V4L2-PIX-FMT-MM21:
263
264Tiled NV12
265----------
266
267Semi-planar YUV 4:2:0 formats, using macroblock tiling. The chroma plane is
268subsampled by 2 in each direction. Chroma lines contain half the number of
269pixels and the same number of bytes as luma lines, and the chroma plane
270contains half the number of lines of the luma plane. Each tile follows the
271previous one linearly in memory (from left to right, top to bottom).
272
273``V4L2_PIX_FMT_NV12MT_16X16`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
274pixels in 2D 16x16 tiles, and stores tiles linearly in memory.
275The line stride and image height must be aligned to a multiple of 16.
276The layouts of the luma and chroma planes are identical.
277
278``V4L2_PIX_FMT_NV12MT`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
279pixels in 2D 64x32 tiles, and stores 2x2 groups of tiles in
280Z-order in memory, alternating Z and mirrored Z shapes horizontally.
281The line stride must be a multiple of 128 pixels to ensure an
282integer number of Z shapes. The image height must be a multiple of 32 pixels.
283If the vertical resolution is an odd number of tiles, the last row of
284tiles is stored in linear order. The layouts of the luma and chroma
285planes are identical.
286
287``V4L2_PIX_FMT_NV12_4L4`` stores pixels in 4x4 tiles, and stores
288tiles linearly in memory. The line stride and image height must be
289aligned to a multiple of 4. The layouts of the luma and chroma planes are
290identical.
291
292``V4L2_PIX_FMT_NV12_16L16`` stores pixels in 16x16 tiles, and stores
293tiles linearly in memory. The line stride and image height must be
294aligned to a multiple of 16. The layouts of the luma and chroma planes are
295identical.
296
297``V4L2_PIX_FMT_NV12_32L32`` stores pixels in 32x32 tiles, and stores
298tiles linearly in memory. The line stride and image height must be
299aligned to a multiple of 32. The layouts of the luma and chroma planes are
300identical.
301
302``V4L2_PIX_FMT_NV12M_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
303pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
304The image height must be aligned to a multiple of 128.
305The layouts of the luma and chroma planes are identical.
306
307``V4L2_PIX_FMT_NV12M_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
30810 bits pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
309the data is arranged in big endian order.
310The image height must be aligned to a multiple of 128.
311The layouts of the luma and chroma planes are identical.
312Note the tile size is 8bytes multiplied by 128 bytes,
313it means that the low bits and high bits of one pixel may be in different tiles.
314The 10 bit pixels are packed, so 5 bytes contain 4 10-bit pixels layout like
315this (for luma):
316byte 0: Y0(bits 9-2)
317byte 1: Y0(bits 1-0) Y1(bits 9-4)
318byte 2: Y1(bits 3-0) Y2(bits 9-6)
319byte 3: Y2(bits 5-0) Y3(bits 9-8)
320byte 4: Y3(bits 7-0)
321
322``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels
323in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the
324image height must be aligned to a multiple of 32. The number of luma and chroma
325tiles are identical, even though the tile size differ. The image is formed of
326two non-contiguous planes.
327
328.. _nv12mt:
329
330.. kernel-figure:: nv12mt.svg
331    :alt:    nv12mt.svg
332    :align:  center
333
334    V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout
335
336.. _nv12mt_ex:
337
338.. kernel-figure:: nv12mt_example.svg
339    :alt:    nv12mt_example.svg
340    :align:  center
341
342    Example V4L2_PIX_FMT_NV12MT memory layout of tiles
343
344
345.. _V4L2-PIX-FMT-NV16:
346.. _V4L2-PIX-FMT-NV61:
347.. _V4L2-PIX-FMT-NV16M:
348.. _V4L2-PIX-FMT-NV61M:
349
350NV16, NV61, NV16M and NV61M
351---------------------------
352
353Semi-planar YUV 4:2:2 formats. The chroma plane is subsampled by 2 in the
354horizontal direction. Chroma lines contain half the number of pixels and the
355same number of bytes as luma lines, and the chroma plane contains the same
356number of lines as the luma plane.
357
358.. flat-table:: Sample 4x4 NV16 Image
359    :header-rows:  0
360    :stub-columns: 0
361
362    * - start + 0:
363      - Y'\ :sub:`00`
364      - Y'\ :sub:`01`
365      - Y'\ :sub:`02`
366      - Y'\ :sub:`03`
367    * - start + 4:
368      - Y'\ :sub:`10`
369      - Y'\ :sub:`11`
370      - Y'\ :sub:`12`
371      - Y'\ :sub:`13`
372    * - start + 8:
373      - Y'\ :sub:`20`
374      - Y'\ :sub:`21`
375      - Y'\ :sub:`22`
376      - Y'\ :sub:`23`
377    * - start + 12:
378      - Y'\ :sub:`30`
379      - Y'\ :sub:`31`
380      - Y'\ :sub:`32`
381      - Y'\ :sub:`33`
382    * - start + 16:
383      - Cb\ :sub:`00`
384      - Cr\ :sub:`00`
385      - Cb\ :sub:`01`
386      - Cr\ :sub:`01`
387    * - start + 20:
388      - Cb\ :sub:`10`
389      - Cr\ :sub:`10`
390      - Cb\ :sub:`11`
391      - Cr\ :sub:`11`
392    * - start + 24:
393      - Cb\ :sub:`20`
394      - Cr\ :sub:`20`
395      - Cb\ :sub:`21`
396      - Cr\ :sub:`21`
397    * - start + 28:
398      - Cb\ :sub:`30`
399      - Cr\ :sub:`30`
400      - Cb\ :sub:`31`
401      - Cr\ :sub:`31`
402
403.. flat-table:: Sample 4x4 NV16M Image
404    :header-rows:  0
405    :stub-columns: 0
406
407    * - start0 + 0:
408      - Y'\ :sub:`00`
409      - Y'\ :sub:`01`
410      - Y'\ :sub:`02`
411      - Y'\ :sub:`03`
412    * - start0 + 4:
413      - Y'\ :sub:`10`
414      - Y'\ :sub:`11`
415      - Y'\ :sub:`12`
416      - Y'\ :sub:`13`
417    * - start0 + 8:
418      - Y'\ :sub:`20`
419      - Y'\ :sub:`21`
420      - Y'\ :sub:`22`
421      - Y'\ :sub:`23`
422    * - start0 + 12:
423      - Y'\ :sub:`30`
424      - Y'\ :sub:`31`
425      - Y'\ :sub:`32`
426      - Y'\ :sub:`33`
427    * -
428    * - start1 + 0:
429      - Cb\ :sub:`00`
430      - Cr\ :sub:`00`
431      - Cb\ :sub:`02`
432      - Cr\ :sub:`02`
433    * - start1 + 4:
434      - Cb\ :sub:`10`
435      - Cr\ :sub:`10`
436      - Cb\ :sub:`12`
437      - Cr\ :sub:`12`
438    * - start1 + 8:
439      - Cb\ :sub:`20`
440      - Cr\ :sub:`20`
441      - Cb\ :sub:`22`
442      - Cr\ :sub:`22`
443    * - start1 + 12:
444      - Cb\ :sub:`30`
445      - Cr\ :sub:`30`
446      - Cb\ :sub:`32`
447      - Cr\ :sub:`32`
448
449
450.. _V4L2-PIX-FMT-NV24:
451.. _V4L2-PIX-FMT-NV42:
452
453NV24 and NV42
454-------------
455
456Semi-planar YUV 4:4:4 formats. The chroma plane is not subsampled.
457Chroma lines contain the same number of pixels and twice the
458number of bytes as luma lines, and the chroma plane contains the same
459number of lines as the luma plane.
460
461.. flat-table:: Sample 4x4 NV24 Image
462    :header-rows:  0
463    :stub-columns: 0
464
465    * - start + 0:
466      - Y'\ :sub:`00`
467      - Y'\ :sub:`01`
468      - Y'\ :sub:`02`
469      - Y'\ :sub:`03`
470    * - start + 4:
471      - Y'\ :sub:`10`
472      - Y'\ :sub:`11`
473      - Y'\ :sub:`12`
474      - Y'\ :sub:`13`
475    * - start + 8:
476      - Y'\ :sub:`20`
477      - Y'\ :sub:`21`
478      - Y'\ :sub:`22`
479      - Y'\ :sub:`23`
480    * - start + 12:
481      - Y'\ :sub:`30`
482      - Y'\ :sub:`31`
483      - Y'\ :sub:`32`
484      - Y'\ :sub:`33`
485    * - start + 16:
486      - Cb\ :sub:`00`
487      - Cr\ :sub:`00`
488      - Cb\ :sub:`01`
489      - Cr\ :sub:`01`
490      - Cb\ :sub:`02`
491      - Cr\ :sub:`02`
492      - Cb\ :sub:`03`
493      - Cr\ :sub:`03`
494    * - start + 24:
495      - Cb\ :sub:`10`
496      - Cr\ :sub:`10`
497      - Cb\ :sub:`11`
498      - Cr\ :sub:`11`
499      - Cb\ :sub:`12`
500      - Cr\ :sub:`12`
501      - Cb\ :sub:`13`
502      - Cr\ :sub:`13`
503    * - start + 32:
504      - Cb\ :sub:`20`
505      - Cr\ :sub:`20`
506      - Cb\ :sub:`21`
507      - Cr\ :sub:`21`
508      - Cb\ :sub:`22`
509      - Cr\ :sub:`22`
510      - Cb\ :sub:`23`
511      - Cr\ :sub:`23`
512    * - start + 40:
513      - Cb\ :sub:`30`
514      - Cr\ :sub:`30`
515      - Cb\ :sub:`31`
516      - Cr\ :sub:`31`
517      - Cb\ :sub:`32`
518      - Cr\ :sub:`32`
519      - Cb\ :sub:`33`
520      - Cr\ :sub:`33`
521
522
523Fully Planar YUV Formats
524========================
525
526These formats store the Y, Cb and Cr components in three separate planes. The
527luma plane comes first, and the order of the two chroma planes varies between
528formats. The two chroma planes always use the same subsampling.
529
530For memory contiguous formats, the number of padding pixels at the end of the
531chroma lines is identical to the padding of the luma lines. The chroma line
532stride (in bytes) is thus equal to the luma line stride divided by the
533horizontal subsampling factor. Vertical subsampling doesn't affect the line
534stride.
535
536For non-contiguous formats, no constraints are enforced by the format on the
537relationship between the luma and chroma line padding and stride.
538
539All components are stored with the same number of bits per component.
540
541.. raw:: latex
542
543    \small
544
545.. tabularcolumns:: |p{5.0cm}|p{1.1cm}|p{1.5cm}|p{2.2cm}|p{1.2cm}|p{3.7cm}|
546
547.. flat-table:: Overview of Fully Planar YUV Formats
548    :header-rows:  1
549    :stub-columns: 0
550
551    * - Identifier
552      - Code
553      - Bits per component
554      - Subsampling
555      - Planes order [4]_
556      - Contiguous [5]_
557
558    * - V4L2_PIX_FMT_YUV410
559      - 'YUV9'
560      - 8
561      - 4:1:0
562      - Y, Cb, Cr
563      - Yes
564    * - V4L2_PIX_FMT_YVU410
565      - 'YVU9'
566      - 8
567      - 4:1:0
568      - Y, Cr, Cb
569      - Yes
570    * - V4L2_PIX_FMT_YUV411P
571      - '411P'
572      - 8
573      - 4:1:1
574      - Y, Cb, Cr
575      - Yes
576    * - V4L2_PIX_FMT_YUV420M
577      - 'YM12'
578      - 8
579      - 4:2:0
580      - Y, Cb, Cr
581      - No
582    * - V4L2_PIX_FMT_YVU420M
583      - 'YM21'
584      - 8
585      - 4:2:0
586      - Y, Cr, Cb
587      - No
588    * - V4L2_PIX_FMT_YUV420
589      - 'YU12'
590      - 8
591      - 4:2:0
592      - Y, Cb, Cr
593      - Yes
594    * - V4L2_PIX_FMT_YVU420
595      - 'YV12'
596      - 8
597      - 4:2:0
598      - Y, Cr, Cb
599      - Yes
600    * - V4L2_PIX_FMT_YUV422P
601      - '422P'
602      - 8
603      - 4:2:2
604      - Y, Cb, Cr
605      - Yes
606    * - V4L2_PIX_FMT_YUV422M
607      - 'YM16'
608      - 8
609      - 4:2:2
610      - Y, Cb, Cr
611      - No
612    * - V4L2_PIX_FMT_YVU422M
613      - 'YM61'
614      - 8
615      - 4:2:2
616      - Y, Cr, Cb
617      - No
618    * - V4L2_PIX_FMT_YUV444M
619      - 'YM24'
620      - 8
621      - 4:4:4
622      - Y, Cb, Cr
623      - No
624    * - V4L2_PIX_FMT_YVU444M
625      - 'YM42'
626      - 8
627      - 4:4:4
628      - Y, Cr, Cb
629      - No
630
631.. raw:: latex
632
633    \normalsize
634
635.. [4] Order of luma and chroma planes
636.. [5] Indicates if planes have to be contiguous in memory or can be
637       disjoint
638
639
640**Color Sample Location:**
641Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
642horizontally.
643
644.. _V4L2-PIX-FMT-YUV410:
645.. _V4L2-PIX-FMT-YVU410:
646
647YUV410 and YVU410
648-----------------
649
650Planar YUV 4:1:0 formats. The chroma planes are subsampled by 4 in each
651direction. Chroma lines contain a quarter of the number of pixels and bytes of
652the luma lines, and the chroma planes contain a quarter of the number of lines
653of the luma plane.
654
655.. flat-table:: Sample 4x4 YUV410 Image
656    :header-rows:  0
657    :stub-columns: 0
658
659    * - start + 0:
660      - Y'\ :sub:`00`
661      - Y'\ :sub:`01`
662      - Y'\ :sub:`02`
663      - Y'\ :sub:`03`
664    * - start + 4:
665      - Y'\ :sub:`10`
666      - Y'\ :sub:`11`
667      - Y'\ :sub:`12`
668      - Y'\ :sub:`13`
669    * - start + 8:
670      - Y'\ :sub:`20`
671      - Y'\ :sub:`21`
672      - Y'\ :sub:`22`
673      - Y'\ :sub:`23`
674    * - start + 12:
675      - Y'\ :sub:`30`
676      - Y'\ :sub:`31`
677      - Y'\ :sub:`32`
678      - Y'\ :sub:`33`
679    * - start + 16:
680      - Cr\ :sub:`00`
681    * - start + 17:
682      - Cb\ :sub:`00`
683
684
685.. _V4L2-PIX-FMT-YUV411P:
686
687YUV411P
688-------
689
690Planar YUV 4:1:1 formats. The chroma planes are subsampled by 4 in the
691horizontal direction. Chroma lines contain a quarter of the number of pixels
692and bytes of the luma lines, and the chroma planes contain the same number of
693lines as the luma plane.
694
695.. flat-table:: Sample 4x4 YUV411P Image
696    :header-rows:  0
697    :stub-columns: 0
698
699    * - start + 0:
700      - Y'\ :sub:`00`
701      - Y'\ :sub:`01`
702      - Y'\ :sub:`02`
703      - Y'\ :sub:`03`
704    * - start + 4:
705      - Y'\ :sub:`10`
706      - Y'\ :sub:`11`
707      - Y'\ :sub:`12`
708      - Y'\ :sub:`13`
709    * - start + 8:
710      - Y'\ :sub:`20`
711      - Y'\ :sub:`21`
712      - Y'\ :sub:`22`
713      - Y'\ :sub:`23`
714    * - start + 12:
715      - Y'\ :sub:`30`
716      - Y'\ :sub:`31`
717      - Y'\ :sub:`32`
718      - Y'\ :sub:`33`
719    * - start + 16:
720      - Cb\ :sub:`00`
721    * - start + 17:
722      - Cb\ :sub:`10`
723    * - start + 18:
724      - Cb\ :sub:`20`
725    * - start + 19:
726      - Cb\ :sub:`30`
727    * - start + 20:
728      - Cr\ :sub:`00`
729    * - start + 21:
730      - Cr\ :sub:`10`
731    * - start + 22:
732      - Cr\ :sub:`20`
733    * - start + 23:
734      - Cr\ :sub:`30`
735
736
737.. _V4L2-PIX-FMT-YUV420:
738.. _V4L2-PIX-FMT-YVU420:
739.. _V4L2-PIX-FMT-YUV420M:
740.. _V4L2-PIX-FMT-YVU420M:
741
742YUV420, YVU420, YUV420M and YVU420M
743-----------------------------------
744
745Planar YUV 4:2:0 formats. The chroma planes are subsampled by 2 in each
746direction. Chroma lines contain half of the number of pixels and bytes of the
747luma lines, and the chroma planes contain half of the number of lines of the
748luma plane.
749
750.. flat-table:: Sample 4x4 YUV420 Image
751    :header-rows:  0
752    :stub-columns: 0
753
754    * - start + 0:
755      - Y'\ :sub:`00`
756      - Y'\ :sub:`01`
757      - Y'\ :sub:`02`
758      - Y'\ :sub:`03`
759    * - start + 4:
760      - Y'\ :sub:`10`
761      - Y'\ :sub:`11`
762      - Y'\ :sub:`12`
763      - Y'\ :sub:`13`
764    * - start + 8:
765      - Y'\ :sub:`20`
766      - Y'\ :sub:`21`
767      - Y'\ :sub:`22`
768      - Y'\ :sub:`23`
769    * - start + 12:
770      - Y'\ :sub:`30`
771      - Y'\ :sub:`31`
772      - Y'\ :sub:`32`
773      - Y'\ :sub:`33`
774    * - start + 16:
775      - Cr\ :sub:`00`
776      - Cr\ :sub:`01`
777    * - start + 18:
778      - Cr\ :sub:`10`
779      - Cr\ :sub:`11`
780    * - start + 20:
781      - Cb\ :sub:`00`
782      - Cb\ :sub:`01`
783    * - start + 22:
784      - Cb\ :sub:`10`
785      - Cb\ :sub:`11`
786
787.. flat-table:: Sample 4x4 YUV420M Image
788    :header-rows:  0
789    :stub-columns: 0
790
791    * - start0 + 0:
792      - Y'\ :sub:`00`
793      - Y'\ :sub:`01`
794      - Y'\ :sub:`02`
795      - Y'\ :sub:`03`
796    * - start0 + 4:
797      - Y'\ :sub:`10`
798      - Y'\ :sub:`11`
799      - Y'\ :sub:`12`
800      - Y'\ :sub:`13`
801    * - start0 + 8:
802      - Y'\ :sub:`20`
803      - Y'\ :sub:`21`
804      - Y'\ :sub:`22`
805      - Y'\ :sub:`23`
806    * - start0 + 12:
807      - Y'\ :sub:`30`
808      - Y'\ :sub:`31`
809      - Y'\ :sub:`32`
810      - Y'\ :sub:`33`
811    * -
812    * - start1 + 0:
813      - Cb\ :sub:`00`
814      - Cb\ :sub:`01`
815    * - start1 + 2:
816      - Cb\ :sub:`10`
817      - Cb\ :sub:`11`
818    * -
819    * - start2 + 0:
820      - Cr\ :sub:`00`
821      - Cr\ :sub:`01`
822    * - start2 + 2:
823      - Cr\ :sub:`10`
824      - Cr\ :sub:`11`
825
826
827.. _V4L2-PIX-FMT-YUV422P:
828.. _V4L2-PIX-FMT-YUV422M:
829.. _V4L2-PIX-FMT-YVU422M:
830
831YUV422P, YUV422M and YVU422M
832----------------------------
833
834Planar YUV 4:2:2 formats. The chroma planes are subsampled by 2 in the
835horizontal direction. Chroma lines contain half of the number of pixels and
836bytes of the luma lines, and the chroma planes contain the same number of lines
837as the luma plane.
838
839.. flat-table:: Sample 4x4 YUV422P Image
840    :header-rows:  0
841    :stub-columns: 0
842
843    * - start + 0:
844      - Y'\ :sub:`00`
845      - Y'\ :sub:`01`
846      - Y'\ :sub:`02`
847      - Y'\ :sub:`03`
848    * - start + 4:
849      - Y'\ :sub:`10`
850      - Y'\ :sub:`11`
851      - Y'\ :sub:`12`
852      - Y'\ :sub:`13`
853    * - start + 8:
854      - Y'\ :sub:`20`
855      - Y'\ :sub:`21`
856      - Y'\ :sub:`22`
857      - Y'\ :sub:`23`
858    * - start + 12:
859      - Y'\ :sub:`30`
860      - Y'\ :sub:`31`
861      - Y'\ :sub:`32`
862      - Y'\ :sub:`33`
863    * - start + 16:
864      - Cb\ :sub:`00`
865      - Cb\ :sub:`01`
866    * - start + 18:
867      - Cb\ :sub:`10`
868      - Cb\ :sub:`11`
869    * - start + 20:
870      - Cb\ :sub:`20`
871      - Cb\ :sub:`21`
872    * - start + 22:
873      - Cb\ :sub:`30`
874      - Cb\ :sub:`31`
875    * - start + 24:
876      - Cr\ :sub:`00`
877      - Cr\ :sub:`01`
878    * - start + 26:
879      - Cr\ :sub:`10`
880      - Cr\ :sub:`11`
881    * - start + 28:
882      - Cr\ :sub:`20`
883      - Cr\ :sub:`21`
884    * - start + 30:
885      - Cr\ :sub:`30`
886      - Cr\ :sub:`31`
887
888.. flat-table:: Sample 4x4 YUV422M Image
889    :header-rows:  0
890    :stub-columns: 0
891
892    * - start0 + 0:
893      - Y'\ :sub:`00`
894      - Y'\ :sub:`01`
895      - Y'\ :sub:`02`
896      - Y'\ :sub:`03`
897    * - start0 + 4:
898      - Y'\ :sub:`10`
899      - Y'\ :sub:`11`
900      - Y'\ :sub:`12`
901      - Y'\ :sub:`13`
902    * - start0 + 8:
903      - Y'\ :sub:`20`
904      - Y'\ :sub:`21`
905      - Y'\ :sub:`22`
906      - Y'\ :sub:`23`
907    * - start0 + 12:
908      - Y'\ :sub:`30`
909      - Y'\ :sub:`31`
910      - Y'\ :sub:`32`
911      - Y'\ :sub:`33`
912    * -
913    * - start1 + 0:
914      - Cb\ :sub:`00`
915      - Cb\ :sub:`01`
916    * - start1 + 2:
917      - Cb\ :sub:`10`
918      - Cb\ :sub:`11`
919    * - start1 + 4:
920      - Cb\ :sub:`20`
921      - Cb\ :sub:`21`
922    * - start1 + 6:
923      - Cb\ :sub:`30`
924      - Cb\ :sub:`31`
925    * -
926    * - start2 + 0:
927      - Cr\ :sub:`00`
928      - Cr\ :sub:`01`
929    * - start2 + 2:
930      - Cr\ :sub:`10`
931      - Cr\ :sub:`11`
932    * - start2 + 4:
933      - Cr\ :sub:`20`
934      - Cr\ :sub:`21`
935    * - start2 + 6:
936      - Cr\ :sub:`30`
937      - Cr\ :sub:`31`
938
939
940.. _V4L2-PIX-FMT-YUV444M:
941.. _V4L2-PIX-FMT-YVU444M:
942
943YUV444M and YVU444M
944-------------------
945
946Planar YUV 4:4:4 formats. The chroma planes are no subsampled. Chroma lines
947contain the same number of pixels and bytes of the luma lines, and the chroma
948planes contain the same number of lines as the luma plane.
949
950.. flat-table:: Sample 4x4 YUV444M Image
951    :header-rows:  0
952    :stub-columns: 0
953
954    * - start0 + 0:
955      - Y'\ :sub:`00`
956      - Y'\ :sub:`01`
957      - Y'\ :sub:`02`
958      - Y'\ :sub:`03`
959    * - start0 + 4:
960      - Y'\ :sub:`10`
961      - Y'\ :sub:`11`
962      - Y'\ :sub:`12`
963      - Y'\ :sub:`13`
964    * - start0 + 8:
965      - Y'\ :sub:`20`
966      - Y'\ :sub:`21`
967      - Y'\ :sub:`22`
968      - Y'\ :sub:`23`
969    * - start0 + 12:
970      - Y'\ :sub:`30`
971      - Y'\ :sub:`31`
972      - Y'\ :sub:`32`
973      - Y'\ :sub:`33`
974    * -
975    * - start1 + 0:
976      - Cb\ :sub:`00`
977      - Cb\ :sub:`01`
978      - Cb\ :sub:`02`
979      - Cb\ :sub:`03`
980    * - start1 + 4:
981      - Cb\ :sub:`10`
982      - Cb\ :sub:`11`
983      - Cb\ :sub:`12`
984      - Cb\ :sub:`13`
985    * - start1 + 8:
986      - Cb\ :sub:`20`
987      - Cb\ :sub:`21`
988      - Cb\ :sub:`22`
989      - Cb\ :sub:`23`
990    * - start1 + 12:
991      - Cb\ :sub:`20`
992      - Cb\ :sub:`21`
993      - Cb\ :sub:`32`
994      - Cb\ :sub:`33`
995    * -
996    * - start2 + 0:
997      - Cr\ :sub:`00`
998      - Cr\ :sub:`01`
999      - Cr\ :sub:`02`
1000      - Cr\ :sub:`03`
1001    * - start2 + 4:
1002      - Cr\ :sub:`10`
1003      - Cr\ :sub:`11`
1004      - Cr\ :sub:`12`
1005      - Cr\ :sub:`13`
1006    * - start2 + 8:
1007      - Cr\ :sub:`20`
1008      - Cr\ :sub:`21`
1009      - Cr\ :sub:`22`
1010      - Cr\ :sub:`23`
1011    * - start2 + 12:
1012      - Cr\ :sub:`30`
1013      - Cr\ :sub:`31`
1014      - Cr\ :sub:`32`
1015      - Cr\ :sub:`33`
1016