1    <refentry>
2      <refmeta>
3	<refentrytitle>V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21')</refentrytitle>
4	&manvol;
5      </refmeta>
6      <refnamediv>
7	<refname id="V4L2-PIX-FMT-NV12"><constant>V4L2_PIX_FMT_NV12</constant></refname>
8	<refname id="V4L2-PIX-FMT-NV21"><constant>V4L2_PIX_FMT_NV21</constant></refname>
9	<refpurpose>Formats with &frac12; horizontal and vertical
10chroma resolution, also known as YUV 4:2:0. One luminance and one
11chrominance plane with alternating chroma samples as opposed to
12<constant>V4L2_PIX_FMT_YVU420</constant></refpurpose>
13      </refnamediv>
14      <refsect1>
15	<title>Description</title>
16
17	<para>These are two-plane versions of the YUV 4:2:0 format.
18The three components are separated into two sub-images or planes. The
19Y plane is first. The Y plane has one byte per pixel. For
20<constant>V4L2_PIX_FMT_NV12</constant>, a combined CbCr plane
21immediately follows the Y plane in memory.  The CbCr plane is the same
22width, in bytes, as the Y plane (and of the image), but is half as
23tall in pixels. Each CbCr pair belongs to four pixels. For example,
24Cb<subscript>0</subscript>/Cr<subscript>0</subscript> belongs to
25Y'<subscript>00</subscript>, Y'<subscript>01</subscript>,
26Y'<subscript>10</subscript>, Y'<subscript>11</subscript>.
27<constant>V4L2_PIX_FMT_NV21</constant> is the same except the Cb and
28Cr bytes are swapped, the CrCb plane starts with a Cr byte.</para>
29
30	<para>If the Y plane has pad bytes after each row, then the
31CbCr plane has as many pad bytes after its rows.</para>
32
33	<example>
34	  <title><constant>V4L2_PIX_FMT_NV12</constant> 4 &times; 4
35pixel image</title>
36
37	  <formalpara>
38	    <title>Byte Order.</title>
39	    <para>Each cell is one byte.
40		<informaltable frame="none">
41		<tgroup cols="5" align="center">
42		  <colspec align="left" colwidth="2*" />
43		  <tbody valign="top">
44		    <row>
45		      <entry>start&nbsp;+&nbsp;0:</entry>
46		      <entry>Y'<subscript>00</subscript></entry>
47		      <entry>Y'<subscript>01</subscript></entry>
48		      <entry>Y'<subscript>02</subscript></entry>
49		      <entry>Y'<subscript>03</subscript></entry>
50		    </row>
51		    <row>
52		      <entry>start&nbsp;+&nbsp;4:</entry>
53		      <entry>Y'<subscript>10</subscript></entry>
54		      <entry>Y'<subscript>11</subscript></entry>
55		      <entry>Y'<subscript>12</subscript></entry>
56		      <entry>Y'<subscript>13</subscript></entry>
57		    </row>
58		    <row>
59		      <entry>start&nbsp;+&nbsp;8:</entry>
60		      <entry>Y'<subscript>20</subscript></entry>
61		      <entry>Y'<subscript>21</subscript></entry>
62		      <entry>Y'<subscript>22</subscript></entry>
63		      <entry>Y'<subscript>23</subscript></entry>
64		    </row>
65		    <row>
66		      <entry>start&nbsp;+&nbsp;12:</entry>
67		      <entry>Y'<subscript>30</subscript></entry>
68		      <entry>Y'<subscript>31</subscript></entry>
69		      <entry>Y'<subscript>32</subscript></entry>
70		      <entry>Y'<subscript>33</subscript></entry>
71		    </row>
72		    <row>
73		      <entry>start&nbsp;+&nbsp;16:</entry>
74		      <entry>Cb<subscript>00</subscript></entry>
75		      <entry>Cr<subscript>00</subscript></entry>
76		      <entry>Cb<subscript>01</subscript></entry>
77		      <entry>Cr<subscript>01</subscript></entry>
78		    </row>
79		    <row>
80		      <entry>start&nbsp;+&nbsp;20:</entry>
81		      <entry>Cb<subscript>10</subscript></entry>
82		      <entry>Cr<subscript>10</subscript></entry>
83		      <entry>Cb<subscript>11</subscript></entry>
84		      <entry>Cr<subscript>11</subscript></entry>
85		    </row>
86		  </tbody>
87		</tgroup>
88		</informaltable>
89	      </para>
90	  </formalpara>
91
92	  <formalpara>
93	    <title>Color Sample Location.</title>
94	    <para>
95		<informaltable frame="none">
96		<tgroup cols="7" align="center">
97		  <tbody valign="top">
98		    <row>
99		      <entry></entry>
100		      <entry>0</entry><entry></entry><entry>1</entry><entry></entry>
101		      <entry>2</entry><entry></entry><entry>3</entry>
102		    </row>
103		    <row>
104		      <entry>0</entry>
105		      <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
106		      <entry>Y</entry><entry></entry><entry>Y</entry>
107		    </row>
108		    <row>
109		      <entry></entry>
110		      <entry></entry><entry>C</entry><entry></entry><entry></entry>
111		      <entry></entry><entry>C</entry><entry></entry>
112		    </row>
113		    <row>
114		      <entry>1</entry>
115		      <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
116		      <entry>Y</entry><entry></entry><entry>Y</entry>
117		    </row>
118		    <row>
119		      <entry></entry>
120		    </row>
121		    <row>
122		      <entry>2</entry>
123		      <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
124		      <entry>Y</entry><entry></entry><entry>Y</entry>
125		    </row>
126		    <row>
127		      <entry></entry>
128		      <entry></entry><entry>C</entry><entry></entry><entry></entry>
129		      <entry></entry><entry>C</entry><entry></entry>
130		    </row>
131		    <row>
132		      <entry>3</entry>
133		      <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
134		      <entry>Y</entry><entry></entry><entry>Y</entry>
135		    </row>
136		  </tbody>
137		</tgroup>
138		</informaltable>
139	      </para>
140	  </formalpara>
141	</example>
142      </refsect1>
143    </refentry>
144