Merge branch 'next' into for-linus
[sfrench/cifs-2.6.git] / Documentation / DocBook / media / v4l / pixfmt-yuv420m.xml
1     <refentry>
2       <refmeta>
3         <refentrytitle>V4L2_PIX_FMT_YUV420M ('YM12'), V4L2_PIX_FMT_YVU420M ('YM21')</refentrytitle>
4         &manvol;
5       </refmeta>
6       <refnamediv>
7         <refname id="V4L2-PIX-FMT-YUV420M"><constant>V4L2_PIX_FMT_YUV420M</constant></refname>
8         <refname id="V4L2-PIX-FMT-YVU420M"><constant>V4L2_PIX_FMT_YVU420M</constant></refname>
9         <refpurpose>Variation of <constant>V4L2_PIX_FMT_YUV420</constant> and
10           <constant>V4L2_PIX_FMT_YVU420</constant> with planes non contiguous
11           in memory.</refpurpose>
12       </refnamediv>
13
14       <refsect1>
15         <title>Description</title>
16
17         <para>This is a multi-planar format, as opposed to a packed format.
18 The three components are separated into three sub-images or planes.</para>
19
20         <para>The Y plane is first. The Y plane has one byte per pixel.
21 For <constant>V4L2_PIX_FMT_YUV420M</constant> the Cb data
22 constitutes the second plane which is half the width and half
23 the height of the Y plane (and of the image). Each Cb belongs to four
24 pixels, a two-by-two square of the image. For example,
25 Cb<subscript>0</subscript> belongs to Y'<subscript>00</subscript>,
26 Y'<subscript>01</subscript>, Y'<subscript>10</subscript>, and
27 Y'<subscript>11</subscript>. The Cr data, just like the Cb plane, is
28 in the third plane.</para>
29
30         <para><constant>V4L2_PIX_FMT_YVU420M</constant> is the same except
31 the Cr data is stored in the second plane and the Cb data in the third plane.
32 </para>
33
34         <para>If the Y plane has pad bytes after each row, then the Cb
35 and Cr planes have half as many pad bytes after their rows. In other
36 words, two Cx rows (including padding) is exactly as long as one Y row
37 (including padding).</para>
38
39         <para><constant>V4L2_PIX_FMT_YUV420M</constant> and
40 <constant>V4L2_PIX_FMT_YVU420M</constant> are intended to be
41 used only in drivers and applications that support the multi-planar API,
42 described in <xref linkend="planar-apis"/>. </para>
43
44         <example>
45           <title><constant>V4L2_PIX_FMT_YUV420M</constant> 4 &times; 4
46 pixel image</title>
47
48           <formalpara>
49             <title>Byte Order.</title>
50             <para>Each cell is one byte.
51                 <informaltable frame="none">
52                 <tgroup cols="5" align="center">
53                   <colspec align="left" colwidth="2*" />
54                   <tbody valign="top">
55                     <row>
56                       <entry>start0&nbsp;+&nbsp;0:</entry>
57                       <entry>Y'<subscript>00</subscript></entry>
58                       <entry>Y'<subscript>01</subscript></entry>
59                       <entry>Y'<subscript>02</subscript></entry>
60                       <entry>Y'<subscript>03</subscript></entry>
61                     </row>
62                     <row>
63                       <entry>start0&nbsp;+&nbsp;4:</entry>
64                       <entry>Y'<subscript>10</subscript></entry>
65                       <entry>Y'<subscript>11</subscript></entry>
66                       <entry>Y'<subscript>12</subscript></entry>
67                       <entry>Y'<subscript>13</subscript></entry>
68                     </row>
69                     <row>
70                       <entry>start0&nbsp;+&nbsp;8:</entry>
71                       <entry>Y'<subscript>20</subscript></entry>
72                       <entry>Y'<subscript>21</subscript></entry>
73                       <entry>Y'<subscript>22</subscript></entry>
74                       <entry>Y'<subscript>23</subscript></entry>
75                     </row>
76                     <row>
77                       <entry>start0&nbsp;+&nbsp;12:</entry>
78                       <entry>Y'<subscript>30</subscript></entry>
79                       <entry>Y'<subscript>31</subscript></entry>
80                       <entry>Y'<subscript>32</subscript></entry>
81                       <entry>Y'<subscript>33</subscript></entry>
82                     </row>
83                     <row><entry></entry></row>
84                     <row>
85                       <entry>start1&nbsp;+&nbsp;0:</entry>
86                       <entry>Cb<subscript>00</subscript></entry>
87                       <entry>Cb<subscript>01</subscript></entry>
88                     </row>
89                     <row>
90                       <entry>start1&nbsp;+&nbsp;2:</entry>
91                       <entry>Cb<subscript>10</subscript></entry>
92                       <entry>Cb<subscript>11</subscript></entry>
93                     </row>
94                     <row><entry></entry></row>
95                     <row>
96                       <entry>start2&nbsp;+&nbsp;0:</entry>
97                       <entry>Cr<subscript>00</subscript></entry>
98                       <entry>Cr<subscript>01</subscript></entry>
99                     </row>
100                     <row>
101                       <entry>start2&nbsp;+&nbsp;2:</entry>
102                       <entry>Cr<subscript>10</subscript></entry>
103                       <entry>Cr<subscript>11</subscript></entry>
104                     </row>
105                   </tbody>
106                 </tgroup>
107                 </informaltable>
108               </para>
109           </formalpara>
110
111           <formalpara>
112             <title>Color Sample Location.</title>
113             <para>
114                 <informaltable frame="none">
115                 <tgroup cols="7" align="center">
116                   <tbody valign="top">
117                     <row>
118                       <entry></entry>
119                       <entry>0</entry><entry></entry><entry>1</entry><entry></entry>
120                       <entry>2</entry><entry></entry><entry>3</entry>
121                     </row>
122                     <row>
123                       <entry>0</entry>
124                       <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
125                       <entry>Y</entry><entry></entry><entry>Y</entry>
126                     </row>
127                     <row>
128                       <entry></entry>
129                       <entry></entry><entry>C</entry><entry></entry><entry></entry>
130                       <entry></entry><entry>C</entry><entry></entry>
131                     </row>
132                     <row>
133                       <entry>1</entry>
134                       <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
135                       <entry>Y</entry><entry></entry><entry>Y</entry>
136                     </row>
137                     <row>
138                       <entry></entry>
139                     </row>
140                     <row>
141                       <entry>2</entry>
142                       <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
143                       <entry>Y</entry><entry></entry><entry>Y</entry>
144                     </row>
145                     <row>
146                       <entry></entry>
147                       <entry></entry><entry>C</entry><entry></entry><entry></entry>
148                       <entry></entry><entry>C</entry><entry></entry>
149                     </row>
150                     <row>
151                       <entry>3</entry>
152                       <entry>Y</entry><entry></entry><entry>Y</entry><entry></entry>
153                       <entry>Y</entry><entry></entry><entry>Y</entry>
154                     </row>
155                   </tbody>
156                 </tgroup>
157                 </informaltable>
158               </para>
159           </formalpara>
160         </example>
161       </refsect1>
162     </refentry>