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
263Tiled NV12
264----------
265
266Semi-planar YUV 4:2:0 formats, using macroblock tiling. The chroma plane is
267subsampled by 2 in each direction. Chroma lines contain half the number of
268pixels and the same number of bytes as luma lines, and the chroma plane
269contains half the number of lines of the luma plane. Each tile follows the
270previous one linearly in memory (from left to right, top to bottom).
271
272``V4L2_PIX_FMT_NV12MT_16X16`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
273pixels in 2D 16x16 tiles, and stores tiles linearly in memory.
274The line stride and image height must be aligned to a multiple of 16.
275The layouts of the luma and chroma planes are identical.
276
277``V4L2_PIX_FMT_NV12MT`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
278pixels in 2D 64x32 tiles, and stores 2x2 groups of tiles in
279Z-order in memory, alternating Z and mirrored Z shapes horizontally.
280The line stride must be a multiple of 128 pixels to ensure an
281integer number of Z shapes. The image height must be a multiple of 32 pixels.
282If the vertical resolution is an odd number of tiles, the last row of
283tiles is stored in linear order. The layouts of the luma and chroma
284planes are identical.
285
286``V4L2_PIX_FMT_NV12_4L4`` stores pixels in 4x4 tiles, and stores
287tiles linearly in memory. The line stride and image height must be
288aligned to a multiple of 4. The layouts of the luma and chroma planes are
289identical.
290
291``V4L2_PIX_FMT_NV12_16L16`` stores pixels in 16x16 tiles, and stores
292tiles linearly in memory. The line stride and image height must be
293aligned to a multiple of 16. The layouts of the luma and chroma planes are
294identical.
295
296``V4L2_PIX_FMT_NV12_32L32`` stores pixels in 32x32 tiles, and stores
297tiles linearly in memory. The line stride and image height must be
298aligned to a multiple of 32. The layouts of the luma and chroma planes are
299identical.
300
301``V4L2_PIX_FMT_NV12M_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
302pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
303The image height must be aligned to a multiple of 128.
304The layouts of the luma and chroma planes are identical.
305
306``V4L2_PIX_FMT_NV12M_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores
30710 bits pixels in 2D 8x128 tiles, and stores tiles linearly in memory.
308the data is arranged in big endian order.
309The image height must be aligned to a multiple of 128.
310The layouts of the luma and chroma planes are identical.
311Note the tile size is 8bytes multiplied by 128 bytes,
312it means that the low bits and high bits of one pixel may be in different tiles.
313The 10 bit pixels are packed, so 5 bytes contain 4 10-bit pixels layout like
314this (for luma):
315byte 0: Y0(bits 9-2)
316byte 1: Y0(bits 1-0) Y1(bits 9-4)
317byte 2: Y1(bits 3-0) Y2(bits 9-6)
318byte 3: Y2(bits 5-0) Y3(bits 9-8)
319byte 4: Y3(bits 7-0)
320
321``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels
322in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the
323image height must be aligned to a multiple of 32. The number of luma and chroma
324tiles are identical, even though the tile size differ. The image is formed of
325two non-contiguous planes.
326
327.. _nv12mt:
328
329.. kernel-figure:: nv12mt.svg
330    :alt:    nv12mt.svg
331    :align:  center
332
333    V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout
334
335.. _nv12mt_ex:
336
337.. kernel-figure:: nv12mt_example.svg
338    :alt:    nv12mt_example.svg
339    :align:  center
340
341    Example V4L2_PIX_FMT_NV12MT memory layout of tiles
342
343
344.. _V4L2-PIX-FMT-NV16:
345.. _V4L2-PIX-FMT-NV61:
346.. _V4L2-PIX-FMT-NV16M:
347.. _V4L2-PIX-FMT-NV61M:
348
349NV16, NV61, NV16M and NV61M
350---------------------------
351
352Semi-planar YUV 4:2:2 formats. The chroma plane is subsampled by 2 in the
353horizontal direction. Chroma lines contain half the number of pixels and the
354same number of bytes as luma lines, and the chroma plane contains the same
355number of lines as the luma plane.
356
357.. flat-table:: Sample 4x4 NV16 Image
358    :header-rows:  0
359    :stub-columns: 0
360
361    * - start + 0:
362      - Y'\ :sub:`00`
363      - Y'\ :sub:`01`
364      - Y'\ :sub:`02`
365      - Y'\ :sub:`03`
366    * - start + 4:
367      - Y'\ :sub:`10`
368      - Y'\ :sub:`11`
369      - Y'\ :sub:`12`
370      - Y'\ :sub:`13`
371    * - start + 8:
372      - Y'\ :sub:`20`
373      - Y'\ :sub:`21`
374      - Y'\ :sub:`22`
375      - Y'\ :sub:`23`
376    * - start + 12:
377      - Y'\ :sub:`30`
378      - Y'\ :sub:`31`
379      - Y'\ :sub:`32`
380      - Y'\ :sub:`33`
381    * - start + 16:
382      - Cb\ :sub:`00`
383      - Cr\ :sub:`00`
384      - Cb\ :sub:`01`
385      - Cr\ :sub:`01`
386    * - start + 20:
387      - Cb\ :sub:`10`
388      - Cr\ :sub:`10`
389      - Cb\ :sub:`11`
390      - Cr\ :sub:`11`
391    * - start + 24:
392      - Cb\ :sub:`20`
393      - Cr\ :sub:`20`
394      - Cb\ :sub:`21`
395      - Cr\ :sub:`21`
396    * - start + 28:
397      - Cb\ :sub:`30`
398      - Cr\ :sub:`30`
399      - Cb\ :sub:`31`
400      - Cr\ :sub:`31`
401
402.. flat-table:: Sample 4x4 NV16M Image
403    :header-rows:  0
404    :stub-columns: 0
405
406    * - start0 + 0:
407      - Y'\ :sub:`00`
408      - Y'\ :sub:`01`
409      - Y'\ :sub:`02`
410      - Y'\ :sub:`03`
411    * - start0 + 4:
412      - Y'\ :sub:`10`
413      - Y'\ :sub:`11`
414      - Y'\ :sub:`12`
415      - Y'\ :sub:`13`
416    * - start0 + 8:
417      - Y'\ :sub:`20`
418      - Y'\ :sub:`21`
419      - Y'\ :sub:`22`
420      - Y'\ :sub:`23`
421    * - start0 + 12:
422      - Y'\ :sub:`30`
423      - Y'\ :sub:`31`
424      - Y'\ :sub:`32`
425      - Y'\ :sub:`33`
426    * -
427    * - start1 + 0:
428      - Cb\ :sub:`00`
429      - Cr\ :sub:`00`
430      - Cb\ :sub:`02`
431      - Cr\ :sub:`02`
432    * - start1 + 4:
433      - Cb\ :sub:`10`
434      - Cr\ :sub:`10`
435      - Cb\ :sub:`12`
436      - Cr\ :sub:`12`
437    * - start1 + 8:
438      - Cb\ :sub:`20`
439      - Cr\ :sub:`20`
440      - Cb\ :sub:`22`
441      - Cr\ :sub:`22`
442    * - start1 + 12:
443      - Cb\ :sub:`30`
444      - Cr\ :sub:`30`
445      - Cb\ :sub:`32`
446      - Cr\ :sub:`32`
447
448
449.. _V4L2-PIX-FMT-NV24:
450.. _V4L2-PIX-FMT-NV42:
451
452NV24 and NV42
453-------------
454
455Semi-planar YUV 4:4:4 formats. The chroma plane is not subsampled.
456Chroma lines contain the same number of pixels and twice the
457number of bytes as luma lines, and the chroma plane contains the same
458number of lines as the luma plane.
459
460.. flat-table:: Sample 4x4 NV24 Image
461    :header-rows:  0
462    :stub-columns: 0
463
464    * - start + 0:
465      - Y'\ :sub:`00`
466      - Y'\ :sub:`01`
467      - Y'\ :sub:`02`
468      - Y'\ :sub:`03`
469    * - start + 4:
470      - Y'\ :sub:`10`
471      - Y'\ :sub:`11`
472      - Y'\ :sub:`12`
473      - Y'\ :sub:`13`
474    * - start + 8:
475      - Y'\ :sub:`20`
476      - Y'\ :sub:`21`
477      - Y'\ :sub:`22`
478      - Y'\ :sub:`23`
479    * - start + 12:
480      - Y'\ :sub:`30`
481      - Y'\ :sub:`31`
482      - Y'\ :sub:`32`
483      - Y'\ :sub:`33`
484    * - start + 16:
485      - Cb\ :sub:`00`
486      - Cr\ :sub:`00`
487      - Cb\ :sub:`01`
488      - Cr\ :sub:`01`
489      - Cb\ :sub:`02`
490      - Cr\ :sub:`02`
491      - Cb\ :sub:`03`
492      - Cr\ :sub:`03`
493    * - start + 24:
494      - Cb\ :sub:`10`
495      - Cr\ :sub:`10`
496      - Cb\ :sub:`11`
497      - Cr\ :sub:`11`
498      - Cb\ :sub:`12`
499      - Cr\ :sub:`12`
500      - Cb\ :sub:`13`
501      - Cr\ :sub:`13`
502    * - start + 32:
503      - Cb\ :sub:`20`
504      - Cr\ :sub:`20`
505      - Cb\ :sub:`21`
506      - Cr\ :sub:`21`
507      - Cb\ :sub:`22`
508      - Cr\ :sub:`22`
509      - Cb\ :sub:`23`
510      - Cr\ :sub:`23`
511    * - start + 40:
512      - Cb\ :sub:`30`
513      - Cr\ :sub:`30`
514      - Cb\ :sub:`31`
515      - Cr\ :sub:`31`
516      - Cb\ :sub:`32`
517      - Cr\ :sub:`32`
518      - Cb\ :sub:`33`
519      - Cr\ :sub:`33`
520
521
522Fully Planar YUV Formats
523========================
524
525These formats store the Y, Cb and Cr components in three separate planes. The
526luma plane comes first, and the order of the two chroma planes varies between
527formats. The two chroma planes always use the same subsampling.
528
529For memory contiguous formats, the number of padding pixels at the end of the
530chroma lines is identical to the padding of the luma lines. The chroma line
531stride (in bytes) is thus equal to the luma line stride divided by the
532horizontal subsampling factor. Vertical subsampling doesn't affect the line
533stride.
534
535For non-contiguous formats, no constraints are enforced by the format on the
536relationship between the luma and chroma line padding and stride.
537
538All components are stored with the same number of bits per component.
539
540.. raw:: latex
541
542    \small
543
544.. tabularcolumns:: |p{5.0cm}|p{1.1cm}|p{1.5cm}|p{2.2cm}|p{1.2cm}|p{3.7cm}|
545
546.. flat-table:: Overview of Fully Planar YUV Formats
547    :header-rows:  1
548    :stub-columns: 0
549
550    * - Identifier
551      - Code
552      - Bits per component
553      - Subsampling
554      - Planes order [4]_
555      - Contiguous [5]_
556
557    * - V4L2_PIX_FMT_YUV410
558      - 'YUV9'
559      - 8
560      - 4:1:0
561      - Y, Cb, Cr
562      - Yes
563    * - V4L2_PIX_FMT_YVU410
564      - 'YVU9'
565      - 8
566      - 4:1:0
567      - Y, Cr, Cb
568      - Yes
569    * - V4L2_PIX_FMT_YUV411P
570      - '411P'
571      - 8
572      - 4:1:1
573      - Y, Cb, Cr
574      - Yes
575    * - V4L2_PIX_FMT_YUV420M
576      - 'YM12'
577      - 8
578      - 4:2:0
579      - Y, Cb, Cr
580      - No
581    * - V4L2_PIX_FMT_YVU420M
582      - 'YM21'
583      - 8
584      - 4:2:0
585      - Y, Cr, Cb
586      - No
587    * - V4L2_PIX_FMT_YUV420
588      - 'YU12'
589      - 8
590      - 4:2:0
591      - Y, Cb, Cr
592      - Yes
593    * - V4L2_PIX_FMT_YVU420
594      - 'YV12'
595      - 8
596      - 4:2:0
597      - Y, Cr, Cb
598      - Yes
599    * - V4L2_PIX_FMT_YUV422P
600      - '422P'
601      - 8
602      - 4:2:2
603      - Y, Cb, Cr
604      - Yes
605    * - V4L2_PIX_FMT_YUV422M
606      - 'YM16'
607      - 8
608      - 4:2:2
609      - Y, Cb, Cr
610      - No
611    * - V4L2_PIX_FMT_YVU422M
612      - 'YM61'
613      - 8
614      - 4:2:2
615      - Y, Cr, Cb
616      - No
617    * - V4L2_PIX_FMT_YUV444M
618      - 'YM24'
619      - 8
620      - 4:4:4
621      - Y, Cb, Cr
622      - No
623    * - V4L2_PIX_FMT_YVU444M
624      - 'YM42'
625      - 8
626      - 4:4:4
627      - Y, Cr, Cb
628      - No
629
630.. raw:: latex
631
632    \normalsize
633
634.. [4] Order of luma and chroma planes
635.. [5] Indicates if planes have to be contiguous in memory or can be
636       disjoint
637
638
639**Color Sample Location:**
640Chroma samples are :ref:`interstitially sited<yuv-chroma-centered>`
641horizontally.
642
643.. _V4L2-PIX-FMT-YUV410:
644.. _V4L2-PIX-FMT-YVU410:
645
646YUV410 and YVU410
647-----------------
648
649Planar YUV 4:1:0 formats. The chroma planes are subsampled by 4 in each
650direction. Chroma lines contain a quarter of the number of pixels and bytes of
651the luma lines, and the chroma planes contain a quarter of the number of lines
652of the luma plane.
653
654.. flat-table:: Sample 4x4 YUV410 Image
655    :header-rows:  0
656    :stub-columns: 0
657
658    * - start + 0:
659      - Y'\ :sub:`00`
660      - Y'\ :sub:`01`
661      - Y'\ :sub:`02`
662      - Y'\ :sub:`03`
663    * - start + 4:
664      - Y'\ :sub:`10`
665      - Y'\ :sub:`11`
666      - Y'\ :sub:`12`
667      - Y'\ :sub:`13`
668    * - start + 8:
669      - Y'\ :sub:`20`
670      - Y'\ :sub:`21`
671      - Y'\ :sub:`22`
672      - Y'\ :sub:`23`
673    * - start + 12:
674      - Y'\ :sub:`30`
675      - Y'\ :sub:`31`
676      - Y'\ :sub:`32`
677      - Y'\ :sub:`33`
678    * - start + 16:
679      - Cr\ :sub:`00`
680    * - start + 17:
681      - Cb\ :sub:`00`
682
683
684.. _V4L2-PIX-FMT-YUV411P:
685
686YUV411P
687-------
688
689Planar YUV 4:1:1 formats. The chroma planes are subsampled by 4 in the
690horizontal direction. Chroma lines contain a quarter of the number of pixels
691and bytes of the luma lines, and the chroma planes contain the same number of
692lines as the luma plane.
693
694.. flat-table:: Sample 4x4 YUV411P Image
695    :header-rows:  0
696    :stub-columns: 0
697
698    * - start + 0:
699      - Y'\ :sub:`00`
700      - Y'\ :sub:`01`
701      - Y'\ :sub:`02`
702      - Y'\ :sub:`03`
703    * - start + 4:
704      - Y'\ :sub:`10`
705      - Y'\ :sub:`11`
706      - Y'\ :sub:`12`
707      - Y'\ :sub:`13`
708    * - start + 8:
709      - Y'\ :sub:`20`
710      - Y'\ :sub:`21`
711      - Y'\ :sub:`22`
712      - Y'\ :sub:`23`
713    * - start + 12:
714      - Y'\ :sub:`30`
715      - Y'\ :sub:`31`
716      - Y'\ :sub:`32`
717      - Y'\ :sub:`33`
718    * - start + 16:
719      - Cb\ :sub:`00`
720    * - start + 17:
721      - Cb\ :sub:`10`
722    * - start + 18:
723      - Cb\ :sub:`20`
724    * - start + 19:
725      - Cb\ :sub:`30`
726    * - start + 20:
727      - Cr\ :sub:`00`
728    * - start + 21:
729      - Cr\ :sub:`10`
730    * - start + 22:
731      - Cr\ :sub:`20`
732    * - start + 23:
733      - Cr\ :sub:`30`
734
735
736.. _V4L2-PIX-FMT-YUV420:
737.. _V4L2-PIX-FMT-YVU420:
738.. _V4L2-PIX-FMT-YUV420M:
739.. _V4L2-PIX-FMT-YVU420M:
740
741YUV420, YVU420, YUV420M and YVU420M
742-----------------------------------
743
744Planar YUV 4:2:0 formats. The chroma planes are subsampled by 2 in each
745direction. Chroma lines contain half of the number of pixels and bytes of the
746luma lines, and the chroma planes contain half of the number of lines of the
747luma plane.
748
749.. flat-table:: Sample 4x4 YUV420 Image
750    :header-rows:  0
751    :stub-columns: 0
752
753    * - start + 0:
754      - Y'\ :sub:`00`
755      - Y'\ :sub:`01`
756      - Y'\ :sub:`02`
757      - Y'\ :sub:`03`
758    * - start + 4:
759      - Y'\ :sub:`10`
760      - Y'\ :sub:`11`
761      - Y'\ :sub:`12`
762      - Y'\ :sub:`13`
763    * - start + 8:
764      - Y'\ :sub:`20`
765      - Y'\ :sub:`21`
766      - Y'\ :sub:`22`
767      - Y'\ :sub:`23`
768    * - start + 12:
769      - Y'\ :sub:`30`
770      - Y'\ :sub:`31`
771      - Y'\ :sub:`32`
772      - Y'\ :sub:`33`
773    * - start + 16:
774      - Cr\ :sub:`00`
775      - Cr\ :sub:`01`
776    * - start + 18:
777      - Cr\ :sub:`10`
778      - Cr\ :sub:`11`
779    * - start + 20:
780      - Cb\ :sub:`00`
781      - Cb\ :sub:`01`
782    * - start + 22:
783      - Cb\ :sub:`10`
784      - Cb\ :sub:`11`
785
786.. flat-table:: Sample 4x4 YUV420M Image
787    :header-rows:  0
788    :stub-columns: 0
789
790    * - start0 + 0:
791      - Y'\ :sub:`00`
792      - Y'\ :sub:`01`
793      - Y'\ :sub:`02`
794      - Y'\ :sub:`03`
795    * - start0 + 4:
796      - Y'\ :sub:`10`
797      - Y'\ :sub:`11`
798      - Y'\ :sub:`12`
799      - Y'\ :sub:`13`
800    * - start0 + 8:
801      - Y'\ :sub:`20`
802      - Y'\ :sub:`21`
803      - Y'\ :sub:`22`
804      - Y'\ :sub:`23`
805    * - start0 + 12:
806      - Y'\ :sub:`30`
807      - Y'\ :sub:`31`
808      - Y'\ :sub:`32`
809      - Y'\ :sub:`33`
810    * -
811    * - start1 + 0:
812      - Cb\ :sub:`00`
813      - Cb\ :sub:`01`
814    * - start1 + 2:
815      - Cb\ :sub:`10`
816      - Cb\ :sub:`11`
817    * -
818    * - start2 + 0:
819      - Cr\ :sub:`00`
820      - Cr\ :sub:`01`
821    * - start2 + 2:
822      - Cr\ :sub:`10`
823      - Cr\ :sub:`11`
824
825
826.. _V4L2-PIX-FMT-YUV422P:
827.. _V4L2-PIX-FMT-YUV422M:
828.. _V4L2-PIX-FMT-YVU422M:
829
830YUV422P, YUV422M and YVU422M
831----------------------------
832
833Planar YUV 4:2:2 formats. The chroma planes are subsampled by 2 in the
834horizontal direction. Chroma lines contain half of the number of pixels and
835bytes of the luma lines, and the chroma planes contain the same number of lines
836as the luma plane.
837
838.. flat-table:: Sample 4x4 YUV422P Image
839    :header-rows:  0
840    :stub-columns: 0
841
842    * - start + 0:
843      - Y'\ :sub:`00`
844      - Y'\ :sub:`01`
845      - Y'\ :sub:`02`
846      - Y'\ :sub:`03`
847    * - start + 4:
848      - Y'\ :sub:`10`
849      - Y'\ :sub:`11`
850      - Y'\ :sub:`12`
851      - Y'\ :sub:`13`
852    * - start + 8:
853      - Y'\ :sub:`20`
854      - Y'\ :sub:`21`
855      - Y'\ :sub:`22`
856      - Y'\ :sub:`23`
857    * - start + 12:
858      - Y'\ :sub:`30`
859      - Y'\ :sub:`31`
860      - Y'\ :sub:`32`
861      - Y'\ :sub:`33`
862    * - start + 16:
863      - Cb\ :sub:`00`
864      - Cb\ :sub:`01`
865    * - start + 18:
866      - Cb\ :sub:`10`
867      - Cb\ :sub:`11`
868    * - start + 20:
869      - Cb\ :sub:`20`
870      - Cb\ :sub:`21`
871    * - start + 22:
872      - Cb\ :sub:`30`
873      - Cb\ :sub:`31`
874    * - start + 24:
875      - Cr\ :sub:`00`
876      - Cr\ :sub:`01`
877    * - start + 26:
878      - Cr\ :sub:`10`
879      - Cr\ :sub:`11`
880    * - start + 28:
881      - Cr\ :sub:`20`
882      - Cr\ :sub:`21`
883    * - start + 30:
884      - Cr\ :sub:`30`
885      - Cr\ :sub:`31`
886
887.. flat-table:: Sample 4x4 YUV422M Image
888    :header-rows:  0
889    :stub-columns: 0
890
891    * - start0 + 0:
892      - Y'\ :sub:`00`
893      - Y'\ :sub:`01`
894      - Y'\ :sub:`02`
895      - Y'\ :sub:`03`
896    * - start0 + 4:
897      - Y'\ :sub:`10`
898      - Y'\ :sub:`11`
899      - Y'\ :sub:`12`
900      - Y'\ :sub:`13`
901    * - start0 + 8:
902      - Y'\ :sub:`20`
903      - Y'\ :sub:`21`
904      - Y'\ :sub:`22`
905      - Y'\ :sub:`23`
906    * - start0 + 12:
907      - Y'\ :sub:`30`
908      - Y'\ :sub:`31`
909      - Y'\ :sub:`32`
910      - Y'\ :sub:`33`
911    * -
912    * - start1 + 0:
913      - Cb\ :sub:`00`
914      - Cb\ :sub:`01`
915    * - start1 + 2:
916      - Cb\ :sub:`10`
917      - Cb\ :sub:`11`
918    * - start1 + 4:
919      - Cb\ :sub:`20`
920      - Cb\ :sub:`21`
921    * - start1 + 6:
922      - Cb\ :sub:`30`
923      - Cb\ :sub:`31`
924    * -
925    * - start2 + 0:
926      - Cr\ :sub:`00`
927      - Cr\ :sub:`01`
928    * - start2 + 2:
929      - Cr\ :sub:`10`
930      - Cr\ :sub:`11`
931    * - start2 + 4:
932      - Cr\ :sub:`20`
933      - Cr\ :sub:`21`
934    * - start2 + 6:
935      - Cr\ :sub:`30`
936      - Cr\ :sub:`31`
937
938
939.. _V4L2-PIX-FMT-YUV444M:
940.. _V4L2-PIX-FMT-YVU444M:
941
942YUV444M and YVU444M
943-------------------
944
945Planar YUV 4:4:4 formats. The chroma planes are no subsampled. Chroma lines
946contain the same number of pixels and bytes of the luma lines, and the chroma
947planes contain the same number of lines as the luma plane.
948
949.. flat-table:: Sample 4x4 YUV444M Image
950    :header-rows:  0
951    :stub-columns: 0
952
953    * - start0 + 0:
954      - Y'\ :sub:`00`
955      - Y'\ :sub:`01`
956      - Y'\ :sub:`02`
957      - Y'\ :sub:`03`
958    * - start0 + 4:
959      - Y'\ :sub:`10`
960      - Y'\ :sub:`11`
961      - Y'\ :sub:`12`
962      - Y'\ :sub:`13`
963    * - start0 + 8:
964      - Y'\ :sub:`20`
965      - Y'\ :sub:`21`
966      - Y'\ :sub:`22`
967      - Y'\ :sub:`23`
968    * - start0 + 12:
969      - Y'\ :sub:`30`
970      - Y'\ :sub:`31`
971      - Y'\ :sub:`32`
972      - Y'\ :sub:`33`
973    * -
974    * - start1 + 0:
975      - Cb\ :sub:`00`
976      - Cb\ :sub:`01`
977      - Cb\ :sub:`02`
978      - Cb\ :sub:`03`
979    * - start1 + 4:
980      - Cb\ :sub:`10`
981      - Cb\ :sub:`11`
982      - Cb\ :sub:`12`
983      - Cb\ :sub:`13`
984    * - start1 + 8:
985      - Cb\ :sub:`20`
986      - Cb\ :sub:`21`
987      - Cb\ :sub:`22`
988      - Cb\ :sub:`23`
989    * - start1 + 12:
990      - Cb\ :sub:`20`
991      - Cb\ :sub:`21`
992      - Cb\ :sub:`32`
993      - Cb\ :sub:`33`
994    * -
995    * - start2 + 0:
996      - Cr\ :sub:`00`
997      - Cr\ :sub:`01`
998      - Cr\ :sub:`02`
999      - Cr\ :sub:`03`
1000    * - start2 + 4:
1001      - Cr\ :sub:`10`
1002      - Cr\ :sub:`11`
1003      - Cr\ :sub:`12`
1004      - Cr\ :sub:`13`
1005    * - start2 + 8:
1006      - Cr\ :sub:`20`
1007      - Cr\ :sub:`21`
1008      - Cr\ :sub:`22`
1009      - Cr\ :sub:`23`
1010    * - start2 + 12:
1011      - Cr\ :sub:`30`
1012      - Cr\ :sub:`31`
1013      - Cr\ :sub:`32`
1014      - Cr\ :sub:`33`
1015