blob: 906d1effff6787381e1d0bb5c3eff6e5d2778f81 [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
3.. _V4L2-PIX-FMT-NV12:
4
5******************************************************
6V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21')
7******************************************************
8
9*man V4L2_PIX_FMT_NV12(2)*
10
11V4L2_PIX_FMT_NV21
12Formats with ½ horizontal and vertical chroma resolution, also known as
13YUV 4:2:0. One luminance and one chrominance plane with alternating
14chroma samples as opposed to ``V4L2_PIX_FMT_YVU420``
15
16
17Description
18===========
19
20These are two-plane versions of the YUV 4:2:0 format. The three
21components are separated into two sub-images or planes. The Y plane is
22first. The Y plane has one byte per pixel. For ``V4L2_PIX_FMT_NV12``, a
23combined CbCr plane immediately follows the Y plane in memory. The CbCr
24plane is the same width, in bytes, as the Y plane (and of the image),
25but is half as tall in pixels. Each CbCr pair belongs to four pixels.
Mauro Carvalho Chehabeba9e912016-07-04 09:04:31 -030026For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
Markus Heiser5377d912016-06-30 15:18:56 +020027Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`. ``V4L2_PIX_FMT_NV21`` is
28the same except the Cb and Cr bytes are swapped, the CrCb plane starts
29with a Cr byte.
30
31If the Y plane has pad bytes after each row, then the CbCr plane has as
32many pad bytes after its rows.
33
Mauro Carvalho Chehab056d2ee2016-07-04 13:58:01 -030034**Byte Order.**
Markus Heiser5377d912016-06-30 15:18:56 +020035Each cell is one byte.
36
37
38
39.. flat-table::
40 :header-rows: 0
41 :stub-columns: 0
42 :widths: 2 1 1 1 1
43
44
45 - .. row 1
46
47 - start + 0:
48
49 - Y'\ :sub:`00`
50
51 - Y'\ :sub:`01`
52
53 - Y'\ :sub:`02`
54
55 - Y'\ :sub:`03`
56
57 - .. row 2
58
59 - start + 4:
60
61 - Y'\ :sub:`10`
62
63 - Y'\ :sub:`11`
64
65 - Y'\ :sub:`12`
66
67 - Y'\ :sub:`13`
68
69 - .. row 3
70
71 - start + 8:
72
73 - Y'\ :sub:`20`
74
75 - Y'\ :sub:`21`
76
77 - Y'\ :sub:`22`
78
79 - Y'\ :sub:`23`
80
81 - .. row 4
82
83 - start + 12:
84
85 - Y'\ :sub:`30`
86
87 - Y'\ :sub:`31`
88
89 - Y'\ :sub:`32`
90
91 - Y'\ :sub:`33`
92
93 - .. row 5
94
95 - start + 16:
96
97 - Cb\ :sub:`00`
98
99 - Cr\ :sub:`00`
100
101 - Cb\ :sub:`01`
102
103 - Cr\ :sub:`01`
104
105 - .. row 6
106
107 - start + 20:
108
109 - Cb\ :sub:`10`
110
111 - Cr\ :sub:`10`
112
113 - Cb\ :sub:`11`
114
115 - Cr\ :sub:`11`
116
117
118**Color Sample Location..**
119
Markus Heiser5377d912016-06-30 15:18:56 +0200120.. flat-table::
121 :header-rows: 0
122 :stub-columns: 0
123
124
125 - .. row 1
126
127 -
128 - 0
129
130 -
131 - 1
132
Markus Heiser5377d912016-06-30 15:18:56 +0200133 - 2
134
135 -
136 - 3
137
138 - .. row 2
139
140 - 0
141
142 - Y
143
144 -
145 - Y
146
Markus Heiser5377d912016-06-30 15:18:56 +0200147 - Y
148
149 -
150 - Y
151
152 - .. row 3
153
154 -
155 -
156 - C
157
158 -
159 -
Markus Heiser5377d912016-06-30 15:18:56 +0200160 - C
161
162 -
163
164 - .. row 4
165
166 - 1
167
168 - Y
Markus Heiser5377d912016-06-30 15:18:56 +0200169 -
Mauro Carvalho Chehab31ad2502016-07-03 18:55:19 -0300170
Markus Heiser5377d912016-06-30 15:18:56 +0200171 - Y
172
Markus Heiser5377d912016-06-30 15:18:56 +0200173 - Y
174
175 -
176 - Y
177
178 - .. row 5
179
180 -
181
182 - .. row 6
183
184 - 2
185
186 - Y
Markus Heiser5377d912016-06-30 15:18:56 +0200187 -
Mauro Carvalho Chehab31ad2502016-07-03 18:55:19 -0300188
Markus Heiser5377d912016-06-30 15:18:56 +0200189 - Y
190
Markus Heiser5377d912016-06-30 15:18:56 +0200191 - Y
192
193 -
194 - Y
195
196 - .. row 7
197
198 -
199 -
200 - C
201
202 -
203 -
Markus Heiser5377d912016-06-30 15:18:56 +0200204 - C
205
206 -
207
208 - .. row 8
209
210 - 3
211
212 - Y
213
214 -
215 - Y
216
Markus Heiser5377d912016-06-30 15:18:56 +0200217 - Y
218
219 -
220 - Y