diff options
Diffstat (limited to 'Documentation/DocBook/v4l/pixfmt.xml')
-rw-r--r-- | Documentation/DocBook/v4l/pixfmt.xml | 119 |
1 files changed, 113 insertions, 6 deletions
diff --git a/Documentation/DocBook/v4l/pixfmt.xml b/Documentation/DocBook/v4l/pixfmt.xml index cfffc88d7383..c6fdcbbd1b41 100644 --- a/Documentation/DocBook/v4l/pixfmt.xml +++ b/Documentation/DocBook/v4l/pixfmt.xml | |||
@@ -2,12 +2,16 @@ | |||
2 | 2 | ||
3 | <para>The V4L2 API was primarily designed for devices exchanging | 3 | <para>The V4L2 API was primarily designed for devices exchanging |
4 | image data with applications. The | 4 | image data with applications. The |
5 | <structname>v4l2_pix_format</structname> structure defines the format | 5 | <structname>v4l2_pix_format</structname> and <structname>v4l2_pix_format_mplane |
6 | and layout of an image in memory. Image formats are negotiated with | 6 | </structname> structures define the format and layout of an image in memory. |
7 | the &VIDIOC-S-FMT; ioctl. (The explanations here focus on video | 7 | The former is used with the single-planar API, while the latter is used with the |
8 | multi-planar version (see <xref linkend="planar-apis"/>). Image formats are | ||
9 | negotiated with the &VIDIOC-S-FMT; ioctl. (The explanations here focus on video | ||
8 | capturing and output, for overlay frame buffer formats see also | 10 | capturing and output, for overlay frame buffer formats see also |
9 | &VIDIOC-G-FBUF;.)</para> | 11 | &VIDIOC-G-FBUF;.)</para> |
10 | 12 | ||
13 | <section> | ||
14 | <title>Single-planar format structure</title> | ||
11 | <table pgwide="1" frame="none" id="v4l2-pix-format"> | 15 | <table pgwide="1" frame="none" id="v4l2-pix-format"> |
12 | <title>struct <structname>v4l2_pix_format</structname></title> | 16 | <title>struct <structname>v4l2_pix_format</structname></title> |
13 | <tgroup cols="3"> | 17 | <tgroup cols="3"> |
@@ -106,6 +110,98 @@ set this field to zero.</entry> | |||
106 | </tbody> | 110 | </tbody> |
107 | </tgroup> | 111 | </tgroup> |
108 | </table> | 112 | </table> |
113 | </section> | ||
114 | |||
115 | <section> | ||
116 | <title>Multi-planar format structures</title> | ||
117 | <para>The <structname>v4l2_plane_pix_format</structname> structures define | ||
118 | size and layout for each of the planes in a multi-planar format. | ||
119 | The <structname>v4l2_pix_format_mplane</structname> structure contains | ||
120 | information common to all planes (such as image width and height) and | ||
121 | an array of <structname>v4l2_plane_pix_format</structname> structures, | ||
122 | describing all planes of that format.</para> | ||
123 | <table pgwide="1" frame="none" id="v4l2-plane-pix-format"> | ||
124 | <title>struct <structname>vl42_plane_pix_format</structname></title> | ||
125 | <tgroup cols="3"> | ||
126 | &cs-str; | ||
127 | <tbody valign="top"> | ||
128 | <row> | ||
129 | <entry>__u32</entry> | ||
130 | <entry><structfield>sizeimage</structfield></entry> | ||
131 | <entry>Maximum size in bytes required for image data in this plane. | ||
132 | </entry> | ||
133 | </row> | ||
134 | <row> | ||
135 | <entry>__u16</entry> | ||
136 | <entry><structfield>bytesperline</structfield></entry> | ||
137 | <entry>Distance in bytes between the leftmost pixels in two adjacent | ||
138 | lines.</entry> | ||
139 | </row> | ||
140 | <row> | ||
141 | <entry>__u16</entry> | ||
142 | <entry><structfield>reserved[7]</structfield></entry> | ||
143 | <entry>Reserved for future extensions. Should be zeroed by the | ||
144 | application.</entry> | ||
145 | </row> | ||
146 | </tbody> | ||
147 | </tgroup> | ||
148 | </table> | ||
149 | <table pgwide="1" frame="none" id="v4l2-pix-format-mplane"> | ||
150 | <title>struct <structname>v4l2_pix_format_mplane</structname></title> | ||
151 | <tgroup cols="3"> | ||
152 | &cs-str; | ||
153 | <tbody valign="top"> | ||
154 | <row> | ||
155 | <entry>__u32</entry> | ||
156 | <entry><structfield>width</structfield></entry> | ||
157 | <entry>Image width in pixels.</entry> | ||
158 | </row> | ||
159 | <row> | ||
160 | <entry>__u32</entry> | ||
161 | <entry><structfield>height</structfield></entry> | ||
162 | <entry>Image height in pixels.</entry> | ||
163 | </row> | ||
164 | <row> | ||
165 | <entry>__u32</entry> | ||
166 | <entry><structfield>pixelformat</structfield></entry> | ||
167 | <entry>The pixel format. Both single- and multi-planar four character | ||
168 | codes can be used.</entry> | ||
169 | </row> | ||
170 | <row> | ||
171 | <entry>&v4l2-field;</entry> | ||
172 | <entry><structfield>field</structfield></entry> | ||
173 | <entry>See &v4l2-pix-format;.</entry> | ||
174 | </row> | ||
175 | <row> | ||
176 | <entry>&v4l2-colorspace;</entry> | ||
177 | <entry><structfield>colorspace</structfield></entry> | ||
178 | <entry>See &v4l2-pix-format;.</entry> | ||
179 | </row> | ||
180 | <row> | ||
181 | <entry>&v4l2-plane-pix-format;</entry> | ||
182 | <entry><structfield>plane_fmt[VIDEO_MAX_PLANES]</structfield></entry> | ||
183 | <entry>An array of structures describing format of each plane this | ||
184 | pixel format consists of. The number of valid entries in this array | ||
185 | has to be put in the <structfield>num_planes</structfield> | ||
186 | field.</entry> | ||
187 | </row> | ||
188 | <row> | ||
189 | <entry>__u8</entry> | ||
190 | <entry><structfield>num_planes</structfield></entry> | ||
191 | <entry>Number of planes (i.e. separate memory buffers) for this format | ||
192 | and the number of valid entries in the | ||
193 | <structfield>plane_fmt</structfield> array.</entry> | ||
194 | </row> | ||
195 | <row> | ||
196 | <entry>__u8</entry> | ||
197 | <entry><structfield>reserved[11]</structfield></entry> | ||
198 | <entry>Reserved for future extensions. Should be zeroed by the | ||
199 | application.</entry> | ||
200 | </row> | ||
201 | </tbody> | ||
202 | </tgroup> | ||
203 | </table> | ||
204 | </section> | ||
109 | 205 | ||
110 | <section> | 206 | <section> |
111 | <title>Standard Image Formats</title> | 207 | <title>Standard Image Formats</title> |
@@ -142,11 +238,19 @@ leftmost pixel of the second row from the top, and so on. The last row | |||
142 | has just as many pad bytes after it as the other rows.</para> | 238 | has just as many pad bytes after it as the other rows.</para> |
143 | 239 | ||
144 | <para>In V4L2 each format has an identifier which looks like | 240 | <para>In V4L2 each format has an identifier which looks like |
145 | <constant>PIX_FMT_XXX</constant>, defined in the <filename>videodev2.h</filename> | 241 | <constant>PIX_FMT_XXX</constant>, defined in the <link |
146 | header file. These identifiers | 242 | linkend="videodev">videodev.h</link> header file. These identifiers |
147 | represent <link linkend="v4l2-fourcc">four character codes</link> | 243 | represent <link linkend="v4l2-fourcc">four character (FourCC) codes</link> |
148 | which are also listed below, however they are not the same as those | 244 | which are also listed below, however they are not the same as those |
149 | used in the Windows world.</para> | 245 | used in the Windows world.</para> |
246 | |||
247 | <para>For some formats, data is stored in separate, discontiguous | ||
248 | memory buffers. Those formats are identified by a separate set of FourCC codes | ||
249 | and are referred to as "multi-planar formats". For example, a YUV422 frame is | ||
250 | normally stored in one memory buffer, but it can also be placed in two or three | ||
251 | separate buffers, with Y component in one buffer and CbCr components in another | ||
252 | in the 2-planar version or with each component in its own buffer in the | ||
253 | 3-planar case. Those sub-buffers are referred to as "planes".</para> | ||
150 | </section> | 254 | </section> |
151 | 255 | ||
152 | <section id="colorspaces"> | 256 | <section id="colorspaces"> |
@@ -599,10 +703,13 @@ information.</para> | |||
599 | &sub-vyuy; | 703 | &sub-vyuy; |
600 | &sub-y41p; | 704 | &sub-y41p; |
601 | &sub-yuv420; | 705 | &sub-yuv420; |
706 | &sub-yuv420m; | ||
602 | &sub-yuv410; | 707 | &sub-yuv410; |
603 | &sub-yuv422p; | 708 | &sub-yuv422p; |
604 | &sub-yuv411p; | 709 | &sub-yuv411p; |
605 | &sub-nv12; | 710 | &sub-nv12; |
711 | &sub-nv12m; | ||
712 | &sub-nv12mt; | ||
606 | &sub-nv16; | 713 | &sub-nv16; |
607 | </section> | 714 | </section> |
608 | 715 | ||