1    <refentry>
2      <refmeta>
3	<refentrytitle>V4L2_PIX_FMT_NV12M ('NM12'), V4L2_PIX_FMT_NV21M ('NM21'), V4L2_PIX_FMT_NV12MT_16X16</refentrytitle>
4	&manvol;
5      </refmeta>
6      <refnamediv>
7	<refname id="V4L2-PIX-FMT-NV12M"><constant>V4L2_PIX_FMT_NV12M</constant></refname>
8	<refname id="V4L2-PIX-FMT-NV21M"><constant>V4L2_PIX_FMT_NV21M</constant></refname>
9	<refname id="V4L2-PIX-FMT-NV12MT-16X16"><constant>V4L2_PIX_FMT_NV12MT_16X16</constant></refname>
10	<refpurpose>Variation of <constant>V4L2_PIX_FMT_NV12</constant> and <constant>V4L2_PIX_FMT_NV21</constant> with planes
11	  non contiguous in memory. </refpurpose>
12      </refnamediv>
13      <refsect1>
14	<title>Description</title>
15
16	<para>This is a multi-planar, two-plane version of the YUV 4:2:0 format.
17The three components are separated into two sub-images or planes.
18<constant>V4L2_PIX_FMT_NV12M</constant> differs from <constant>V4L2_PIX_FMT_NV12
19</constant> in that the two planes are non-contiguous in memory, i.e. the chroma
20plane do not necessarily immediately follows the luma plane.
21The luminance data occupies the first plane. The Y plane has one byte per pixel.
22In the second plane there is a chrominance data with alternating chroma samples.
23The CbCr plane is the same width, in bytes, as the Y plane (and of the image),
24but is half as tall in pixels. Each CbCr pair belongs to four pixels. For example,
25Cb<subscript>0</subscript>/Cr<subscript>0</subscript> belongs to
26Y'<subscript>00</subscript>, Y'<subscript>01</subscript>,
27Y'<subscript>10</subscript>, Y'<subscript>11</subscript>.
28<constant>V4L2_PIX_FMT_NV12MT_16X16</constant> is the tiled version of
29<constant>V4L2_PIX_FMT_NV12M</constant> with 16x16 macroblock tiles. Here pixels
30are arranged in 16x16 2D tiles and tiles are arranged in linear order in memory.
31<constant>V4L2_PIX_FMT_NV21M</constant> is the same as <constant>V4L2_PIX_FMT_NV12M</constant>
32except the Cb and Cr bytes are swapped, the CrCb plane starts with a Cr byte.</para>
33
34	<para><constant>V4L2_PIX_FMT_NV12M</constant> is intended to be
35used only in drivers and applications that support the multi-planar API,
36described in <xref linkend="planar-apis"/>. </para>
37
38	<para>If the Y plane has pad bytes after each row, then the
39CbCr plane has as many pad bytes after its rows.</para>
40
41	<example>
42	  <title><constant>V4L2_PIX_FMT_NV12M</constant> 4 &times; 4 pixel image</title>
43
44	  <formalpara>
45	    <title>Byte Order.</title>
46	    <para>Each cell is one byte.
47		<informaltable frame="none">
48		<tgroup cols="5" align="center">
49		  <colspec align="left" colwidth="2*" />
50		  <tbody valign="top">
51		    <row>
52		      <entry>start0&nbsp;+&nbsp;0:</entry>
53		      <entry>Y'<subscript>00</subscript></entry>
54		      <entry>Y'<subscript>01</subscript></entry>
55		      <entry>Y'<subscript>02</subscript></entry>
56		      <entry>Y'<subscript>03</subscript></entry>
57		    </row>
58		    <row>
59		      <entry>start0&nbsp;+&nbsp;4:</entry>
60		      <entry>Y'<subscript>10</subscript></entry>
61		      <entry>Y'<subscript>11</subscript></entry>
62		      <entry>Y'<subscript>12</subscript></entry>
63		      <entry>Y'<subscript>13</subscript></entry>
64		    </row>
65		    <row>
66		      <entry>start0&nbsp;+&nbsp;8:</entry>
67		      <entry>Y'<subscript>20</subscript></entry>
68		      <entry>Y'<subscript>21</subscript></entry>
69		      <entry>Y'<subscript>22</subscript></entry>
70		      <entry>Y'<subscript>23</subscript></entry>
71		    </row>
72		    <row>
73		      <entry>start0&nbsp;+&nbsp;12:</entry>
74		      <entry>Y'<subscript>30</subscript></entry>
75		      <entry>Y'<subscript>31</subscript></entry>
76		      <entry>Y'<subscript>32</subscript></entry>
77		      <entry>Y'<subscript>33</subscript></entry>
78		    </row>
79		    <row>
80		      <entry></entry>
81		    </row>
82		    <row>
83		      <entry>start1&nbsp;+&nbsp;0:</entry>
84		      <entry>Cb<subscript>00</subscript></entry>
85		      <entry>Cr<subscript>00</subscript></entry>
86		      <entry>Cb<subscript>01</subscript></entry>
87		      <entry>Cr<subscript>01</subscript></entry>
88		    </row>
89		    <row>
90		      <entry>start1&nbsp;+&nbsp;4:</entry>
91		      <entry>Cb<subscript>10</subscript></entry>
92		      <entry>Cr<subscript>10</subscript></entry>
93		      <entry>Cb<subscript>11</subscript></entry>
94		      <entry>Cr<subscript>11</subscript></entry>
95		    </row>
96		  </tbody>
97		</tgroup>
98		</informaltable>
99	      </para>
100	  </formalpara>
101
102	  <formalpara>
103	    <title>Color Sample Location.</title>
104	    <para>
105		<informaltable frame="none">
106		<tgroup cols="7" align="center">
107		  <tbody valign="top">
108		    <row>
109		      <entry></entry>
110		      <entry>0</entry><entry></entry><entry>1</entry><entry></entry>
111		      <entry>2</entry><entry></entry><entry>3</entry>
112		    </row>
113		    <row>
114		      <entry>0</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		      <entry></entry><entry>C</entry><entry></entry><entry></entry>
121		      <entry></entry><entry>C</entry><entry></entry>
122		    </row>
123		    <row>
124		      <entry>1</entry>
125		      <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
126		      <entry>Y</entry><entry></entry><entry>Y</entry>
127		    </row>
128		    <row>
129		      <entry></entry>
130		    </row>
131		    <row>
132		      <entry>2</entry>
133		      <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
134		      <entry>Y</entry><entry></entry><entry>Y</entry>
135		    </row>
136		    <row>
137		      <entry></entry>
138		      <entry></entry><entry>C</entry><entry></entry><entry></entry>
139		      <entry></entry><entry>C</entry><entry></entry>
140		    </row>
141		    <row>
142		      <entry>3</entry>
143		      <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
144		      <entry>Y</entry><entry></entry><entry>Y</entry>
145		    </row>
146		  </tbody>
147		</tgroup>
148		</informaltable>
149	      </para>
150	  </formalpara>
151	</example>
152      </refsect1>
153    </refentry>
154