• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3.. _V4L2-PIX-FMT-YUV420M:
4.. _v4l2-pix-fmt-yvu420m:
5
6************************************************************
7V4L2_PIX_FMT_YUV420M ('YM12'), V4L2_PIX_FMT_YVU420M ('YM21')
8************************************************************
9
10
11V4L2_PIX_FMT_YVU420M
12Variation of ``V4L2_PIX_FMT_YUV420`` and ``V4L2_PIX_FMT_YVU420`` with
13planes non contiguous in memory.
14
15
16Description
17===========
18
19This is a multi-planar format, as opposed to a packed format. The three
20components are separated into three sub-images or planes.
21
22The Y plane is first. The Y plane has one byte per pixel. For
23``V4L2_PIX_FMT_YUV420M`` the Cb data constitutes the second plane which
24is half the width and half the height of the Y plane (and of the image).
25Each Cb belongs to four pixels, a two-by-two square of the image. For
26example, Cb\ :sub:`0` belongs to Y'\ :sub:`00`, Y'\ :sub:`01`,
27Y'\ :sub:`10`, and Y'\ :sub:`11`. The Cr data, just like the Cb plane,
28is in the third plane.
29
30``V4L2_PIX_FMT_YVU420M`` is the same except the Cr data is stored in the
31second plane and the Cb data in the third plane.
32
33If the Y plane has pad bytes after each row, then the Cb and Cr planes
34have half as many pad bytes after their rows. In other words, two Cx
35rows (including padding) is exactly as long as one Y row (including
36padding).
37
38``V4L2_PIX_FMT_YUV420M`` and ``V4L2_PIX_FMT_YVU420M`` are intended to be
39used only in drivers and applications that support the multi-planar API,
40described in :ref:`planar-apis`.
41
42**Byte Order.**
43Each cell is one byte.
44
45
46
47
48.. flat-table::
49    :header-rows:  0
50    :stub-columns: 0
51
52    * - start0 + 0:
53      - Y'\ :sub:`00`
54      - Y'\ :sub:`01`
55      - Y'\ :sub:`02`
56      - Y'\ :sub:`03`
57    * - start0 + 4:
58      - Y'\ :sub:`10`
59      - Y'\ :sub:`11`
60      - Y'\ :sub:`12`
61      - Y'\ :sub:`13`
62    * - start0 + 8:
63      - Y'\ :sub:`20`
64      - Y'\ :sub:`21`
65      - Y'\ :sub:`22`
66      - Y'\ :sub:`23`
67    * - start0 + 12:
68      - Y'\ :sub:`30`
69      - Y'\ :sub:`31`
70      - Y'\ :sub:`32`
71      - Y'\ :sub:`33`
72    * -
73    * - start1 + 0:
74      - Cb\ :sub:`00`
75      - Cb\ :sub:`01`
76    * - start1 + 2:
77      - Cb\ :sub:`10`
78      - Cb\ :sub:`11`
79    * -
80    * - start2 + 0:
81      - Cr\ :sub:`00`
82      - Cr\ :sub:`01`
83    * - start2 + 2:
84      - Cr\ :sub:`10`
85      - Cr\ :sub:`11`
86
87
88**Color Sample Location:**
89
90
91
92.. flat-table::
93    :header-rows:  0
94    :stub-columns: 0
95
96    * -
97      - 0
98      -
99      - 1
100      -
101      - 2
102      -
103      - 3
104    * - 0
105      - Y
106      -
107      - Y
108      -
109      - Y
110      -
111      - Y
112    * -
113      -
114      - C
115      -
116      -
117      -
118      - C
119      -
120    * - 1
121      - Y
122      -
123      - Y
124      -
125      - Y
126      -
127      - Y
128    * -
129    * - 2
130      - Y
131      -
132      - Y
133      -
134      - Y
135      -
136      - Y
137    * -
138      -
139      - C
140      -
141      -
142      -
143      - C
144      -
145    * - 3
146      - Y
147      -
148      - Y
149      -
150      - Y
151      -
152      - Y
153