pixfmt.xml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801
  1. <title>Image Formats</title>
  2. <para>The V4L2 API was primarily designed for devices exchanging
  3. image data with applications. The
  4. <structname>v4l2_pix_format</structname> structure defines the format
  5. and layout of an image in memory. Image formats are negotiated with
  6. the &VIDIOC-S-FMT; ioctl. (The explanations here focus on video
  7. capturing and output, for overlay frame buffer formats see also
  8. &VIDIOC-G-FBUF;.)</para>
  9. <table pgwide="1" frame="none" id="v4l2-pix-format">
  10. <title>struct <structname>v4l2_pix_format</structname></title>
  11. <tgroup cols="3">
  12. &cs-str;
  13. <tbody valign="top">
  14. <row>
  15. <entry>__u32</entry>
  16. <entry><structfield>width</structfield></entry>
  17. <entry>Image width in pixels.</entry>
  18. </row>
  19. <row>
  20. <entry>__u32</entry>
  21. <entry><structfield>height</structfield></entry>
  22. <entry>Image height in pixels.</entry>
  23. </row>
  24. <row>
  25. <entry spanname="hspan">Applications set these fields to
  26. request an image size, drivers return the closest possible values. In
  27. case of planar formats the <structfield>width</structfield> and
  28. <structfield>height</structfield> applies to the largest plane. To
  29. avoid ambiguities drivers must return values rounded up to a multiple
  30. of the scale factor of any smaller planes. For example when the image
  31. format is YUV 4:2:0, <structfield>width</structfield> and
  32. <structfield>height</structfield> must be multiples of two.</entry>
  33. </row>
  34. <row>
  35. <entry>__u32</entry>
  36. <entry><structfield>pixelformat</structfield></entry>
  37. <entry>The pixel format or type of compression, set by the
  38. application. This is a little endian <link
  39. linkend="v4l2-fourcc">four character code</link>. V4L2 defines
  40. standard RGB formats in <xref linkend="rgb-formats" />, YUV formats in <xref
  41. linkend="yuv-formats" />, and reserved codes in <xref
  42. linkend="reserved-formats" /></entry>
  43. </row>
  44. <row>
  45. <entry>&v4l2-field;</entry>
  46. <entry><structfield>field</structfield></entry>
  47. <entry>Video images are typically interlaced. Applications
  48. can request to capture or output only the top or bottom field, or both
  49. fields interlaced or sequentially stored in one buffer or alternating
  50. in separate buffers. Drivers return the actual field order selected.
  51. For details see <xref linkend="field-order" />.</entry>
  52. </row>
  53. <row>
  54. <entry>__u32</entry>
  55. <entry><structfield>bytesperline</structfield></entry>
  56. <entry>Distance in bytes between the leftmost pixels in two
  57. adjacent lines.</entry>
  58. </row>
  59. <row>
  60. <entry spanname="hspan"><para>Both applications and drivers
  61. can set this field to request padding bytes at the end of each line.
  62. Drivers however may ignore the value requested by the application,
  63. returning <structfield>width</structfield> times bytes per pixel or a
  64. larger value required by the hardware. That implies applications can
  65. just set this field to zero to get a reasonable
  66. default.</para><para>Video hardware may access padding bytes,
  67. therefore they must reside in accessible memory. Consider cases where
  68. padding bytes after the last line of an image cross a system page
  69. boundary. Input devices may write padding bytes, the value is
  70. undefined. Output devices ignore the contents of padding
  71. bytes.</para><para>When the image format is planar the
  72. <structfield>bytesperline</structfield> value applies to the largest
  73. plane and is divided by the same factor as the
  74. <structfield>width</structfield> field for any smaller planes. For
  75. example the Cb and Cr planes of a YUV 4:2:0 image have half as many
  76. padding bytes following each line as the Y plane. To avoid ambiguities
  77. drivers must return a <structfield>bytesperline</structfield> value
  78. rounded up to a multiple of the scale factor.</para></entry>
  79. </row>
  80. <row>
  81. <entry>__u32</entry>
  82. <entry><structfield>sizeimage</structfield></entry>
  83. <entry>Size in bytes of the buffer to hold a complete image,
  84. set by the driver. Usually this is
  85. <structfield>bytesperline</structfield> times
  86. <structfield>height</structfield>. When the image consists of variable
  87. length compressed data this is the maximum number of bytes required to
  88. hold an image.</entry>
  89. </row>
  90. <row>
  91. <entry>&v4l2-colorspace;</entry>
  92. <entry><structfield>colorspace</structfield></entry>
  93. <entry>This information supplements the
  94. <structfield>pixelformat</structfield> and must be set by the driver,
  95. see <xref linkend="colorspaces" />.</entry>
  96. </row>
  97. <row>
  98. <entry>__u32</entry>
  99. <entry><structfield>priv</structfield></entry>
  100. <entry>Reserved for custom (driver defined) additional
  101. information about formats. When not used drivers and applications must
  102. set this field to zero.</entry>
  103. </row>
  104. </tbody>
  105. </tgroup>
  106. </table>
  107. <section>
  108. <title>Standard Image Formats</title>
  109. <para>In order to exchange images between drivers and
  110. applications, it is necessary to have standard image data formats
  111. which both sides will interpret the same way. V4L2 includes several
  112. such formats, and this section is intended to be an unambiguous
  113. specification of the standard image data formats in V4L2.</para>
  114. <para>V4L2 drivers are not limited to these formats, however.
  115. Driver-specific formats are possible. In that case the application may
  116. depend on a codec to convert images to one of the standard formats
  117. when needed. But the data can still be stored and retrieved in the
  118. proprietary format. For example, a device may support a proprietary
  119. compressed format. Applications can still capture and save the data in
  120. the compressed format, saving much disk space, and later use a codec
  121. to convert the images to the X Windows screen format when the video is
  122. to be displayed.</para>
  123. <para>Even so, ultimately, some standard formats are needed, so
  124. the V4L2 specification would not be complete without well-defined
  125. standard formats.</para>
  126. <para>The V4L2 standard formats are mainly uncompressed formats. The
  127. pixels are always arranged in memory from left to right, and from top
  128. to bottom. The first byte of data in the image buffer is always for
  129. the leftmost pixel of the topmost row. Following that is the pixel
  130. immediately to its right, and so on until the end of the top row of
  131. pixels. Following the rightmost pixel of the row there may be zero or
  132. more bytes of padding to guarantee that each row of pixel data has a
  133. certain alignment. Following the pad bytes, if any, is data for the
  134. leftmost pixel of the second row from the top, and so on. The last row
  135. has just as many pad bytes after it as the other rows.</para>
  136. <para>In V4L2 each format has an identifier which looks like
  137. <constant>PIX_FMT_XXX</constant>, defined in the <link
  138. linkend="videodev">videodev.h</link> header file. These identifiers
  139. represent <link linkend="v4l2-fourcc">four character codes</link>
  140. which are also listed below, however they are not the same as those
  141. used in the Windows world.</para>
  142. </section>
  143. <section id="colorspaces">
  144. <title>Colorspaces</title>
  145. <para>[intro]</para>
  146. <!-- See proposal by Billy Biggs, video4linux-list@redhat.com
  147. on 11 Oct 2002, subject: "Re: [V4L] Re: v4l2 api", and
  148. http://vektor.theorem.ca/graphics/ycbcr/ and
  149. http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html -->
  150. <para>
  151. <variablelist>
  152. <varlistentry>
  153. <term>Gamma Correction</term>
  154. <listitem>
  155. <para>[to do]</para>
  156. <para>E'<subscript>R</subscript> = f(R)</para>
  157. <para>E'<subscript>G</subscript> = f(G)</para>
  158. <para>E'<subscript>B</subscript> = f(B)</para>
  159. </listitem>
  160. </varlistentry>
  161. <varlistentry>
  162. <term>Construction of luminance and color-difference
  163. signals</term>
  164. <listitem>
  165. <para>[to do]</para>
  166. <para>E'<subscript>Y</subscript> =
  167. Coeff<subscript>R</subscript> E'<subscript>R</subscript>
  168. + Coeff<subscript>G</subscript> E'<subscript>G</subscript>
  169. + Coeff<subscript>B</subscript> E'<subscript>B</subscript></para>
  170. <para>(E'<subscript>R</subscript> - E'<subscript>Y</subscript>) = E'<subscript>R</subscript>
  171. - Coeff<subscript>R</subscript> E'<subscript>R</subscript>
  172. - Coeff<subscript>G</subscript> E'<subscript>G</subscript>
  173. - Coeff<subscript>B</subscript> E'<subscript>B</subscript></para>
  174. <para>(E'<subscript>B</subscript> - E'<subscript>Y</subscript>) = E'<subscript>B</subscript>
  175. - Coeff<subscript>R</subscript> E'<subscript>R</subscript>
  176. - Coeff<subscript>G</subscript> E'<subscript>G</subscript>
  177. - Coeff<subscript>B</subscript> E'<subscript>B</subscript></para>
  178. </listitem>
  179. </varlistentry>
  180. <varlistentry>
  181. <term>Re-normalized color-difference signals</term>
  182. <listitem>
  183. <para>The color-difference signals are scaled back to unity
  184. range [-0.5;+0.5]:</para>
  185. <para>K<subscript>B</subscript> = 0.5 / (1 - Coeff<subscript>B</subscript>)</para>
  186. <para>K<subscript>R</subscript> = 0.5 / (1 - Coeff<subscript>R</subscript>)</para>
  187. <para>P<subscript>B</subscript> =
  188. K<subscript>B</subscript> (E'<subscript>B</subscript> - E'<subscript>Y</subscript>) =
  189. 0.5 (Coeff<subscript>R</subscript> / Coeff<subscript>B</subscript>) E'<subscript>R</subscript>
  190. + 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>B</subscript>) E'<subscript>G</subscript>
  191. + 0.5 E'<subscript>B</subscript></para>
  192. <para>P<subscript>R</subscript> =
  193. K<subscript>R</subscript> (E'<subscript>R</subscript> - E'<subscript>Y</subscript>) =
  194. 0.5 E'<subscript>R</subscript>
  195. + 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>R</subscript>) E'<subscript>G</subscript>
  196. + 0.5 (Coeff<subscript>B</subscript> / Coeff<subscript>R</subscript>) E'<subscript>B</subscript></para>
  197. </listitem>
  198. </varlistentry>
  199. <varlistentry>
  200. <term>Quantization</term>
  201. <listitem>
  202. <para>[to do]</para>
  203. <para>Y' = (Lum. Levels - 1) &middot; E'<subscript>Y</subscript> + Lum. Offset</para>
  204. <para>C<subscript>B</subscript> = (Chrom. Levels - 1)
  205. &middot; P<subscript>B</subscript> + Chrom. Offset</para>
  206. <para>C<subscript>R</subscript> = (Chrom. Levels - 1)
  207. &middot; P<subscript>R</subscript> + Chrom. Offset</para>
  208. <para>Rounding to the nearest integer and clamping to the range
  209. [0;255] finally yields the digital color components Y'CbCr
  210. stored in YUV images.</para>
  211. </listitem>
  212. </varlistentry>
  213. </variablelist>
  214. </para>
  215. <example>
  216. <title>ITU-R Rec. BT.601 color conversion</title>
  217. <para>Forward Transformation</para>
  218. <programlisting>
  219. int ER, EG, EB; /* gamma corrected RGB input [0;255] */
  220. int Y1, Cb, Cr; /* output [0;255] */
  221. double r, g, b; /* temporaries */
  222. double y1, pb, pr;
  223. int
  224. clamp (double x)
  225. {
  226. int r = x; /* round to nearest */
  227. if (r &lt; 0) return 0;
  228. else if (r &gt; 255) return 255;
  229. else return r;
  230. }
  231. r = ER / 255.0;
  232. g = EG / 255.0;
  233. b = EB / 255.0;
  234. y1 = 0.299 * r + 0.587 * g + 0.114 * b;
  235. pb = -0.169 * r - 0.331 * g + 0.5 * b;
  236. pr = 0.5 * r - 0.419 * g - 0.081 * b;
  237. Y1 = clamp (219 * y1 + 16);
  238. Cb = clamp (224 * pb + 128);
  239. Cr = clamp (224 * pr + 128);
  240. /* or shorter */
  241. y1 = 0.299 * ER + 0.587 * EG + 0.114 * EB;
  242. Y1 = clamp ( (219 / 255.0) * y1 + 16);
  243. Cb = clamp (((224 / 255.0) / (2 - 2 * 0.114)) * (EB - y1) + 128);
  244. Cr = clamp (((224 / 255.0) / (2 - 2 * 0.299)) * (ER - y1) + 128);
  245. </programlisting>
  246. <para>Inverse Transformation</para>
  247. <programlisting>
  248. int Y1, Cb, Cr; /* gamma pre-corrected input [0;255] */
  249. int ER, EG, EB; /* output [0;255] */
  250. double r, g, b; /* temporaries */
  251. double y1, pb, pr;
  252. int
  253. clamp (double x)
  254. {
  255. int r = x; /* round to nearest */
  256. if (r &lt; 0) return 0;
  257. else if (r &gt; 255) return 255;
  258. else return r;
  259. }
  260. y1 = (255 / 219.0) * (Y1 - 16);
  261. pb = (255 / 224.0) * (Cb - 128);
  262. pr = (255 / 224.0) * (Cr - 128);
  263. r = 1.0 * y1 + 0 * pb + 1.402 * pr;
  264. g = 1.0 * y1 - 0.344 * pb - 0.714 * pr;
  265. b = 1.0 * y1 + 1.772 * pb + 0 * pr;
  266. ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */
  267. EG = clamp (g * 255);
  268. EB = clamp (b * 255);
  269. </programlisting>
  270. </example>
  271. <table pgwide="1" id="v4l2-colorspace" orient="land">
  272. <title>enum v4l2_colorspace</title>
  273. <tgroup cols="11" align="center">
  274. <colspec align="left" />
  275. <colspec align="center" />
  276. <colspec align="left" />
  277. <colspec colname="cr" />
  278. <colspec colname="cg" />
  279. <colspec colname="cb" />
  280. <colspec colname="wp" />
  281. <colspec colname="gc" />
  282. <colspec colname="lum" />
  283. <colspec colname="qy" />
  284. <colspec colname="qc" />
  285. <spanspec namest="cr" nameend="cb" spanname="chrom" />
  286. <spanspec namest="qy" nameend="qc" spanname="quant" />
  287. <spanspec namest="lum" nameend="qc" spanname="spam" />
  288. <thead>
  289. <row>
  290. <entry morerows="1">Identifier</entry>
  291. <entry morerows="1">Value</entry>
  292. <entry morerows="1">Description</entry>
  293. <entry spanname="chrom">Chromaticities<footnote>
  294. <para>The coordinates of the color primaries are
  295. given in the CIE system (1931)</para>
  296. </footnote></entry>
  297. <entry morerows="1">White Point</entry>
  298. <entry morerows="1">Gamma Correction</entry>
  299. <entry morerows="1">Luminance E'<subscript>Y</subscript></entry>
  300. <entry spanname="quant">Quantization</entry>
  301. </row>
  302. <row>
  303. <entry>Red</entry>
  304. <entry>Green</entry>
  305. <entry>Blue</entry>
  306. <entry>Y'</entry>
  307. <entry>Cb, Cr</entry>
  308. </row>
  309. </thead>
  310. <tbody valign="top">
  311. <row>
  312. <entry><constant>V4L2_COLORSPACE_SMPTE170M</constant></entry>
  313. <entry>1</entry>
  314. <entry>NTSC/PAL according to <xref linkend="smpte170m" />,
  315. <xref linkend="itu601" /></entry>
  316. <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
  317. <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
  318. <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
  319. <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
  320. Illuminant D<subscript>65</subscript></entry>
  321. <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
  322. 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
  323. <entry>0.299&nbsp;E'<subscript>R</subscript>
  324. +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
  325. +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
  326. <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
  327. <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
  328. </row>
  329. <row>
  330. <entry><constant>V4L2_COLORSPACE_SMPTE240M</constant></entry>
  331. <entry>2</entry>
  332. <entry>1125-Line (US) HDTV, see <xref
  333. linkend="smpte240m" /></entry>
  334. <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
  335. <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
  336. <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
  337. <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
  338. Illuminant D<subscript>65</subscript></entry>
  339. <entry>E' = 4&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.0228,
  340. 1.1115&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.1115&nbsp;for&nbsp;0.0228&nbsp;&lt;&nbsp;I</entry>
  341. <entry>0.212&nbsp;E'<subscript>R</subscript>
  342. +&nbsp;0.701&nbsp;E'<subscript>G</subscript>
  343. +&nbsp;0.087&nbsp;E'<subscript>B</subscript></entry>
  344. <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
  345. <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
  346. </row>
  347. <row>
  348. <entry><constant>V4L2_COLORSPACE_REC709</constant></entry>
  349. <entry>3</entry>
  350. <entry>HDTV and modern devices, see <xref
  351. linkend="itu709" /></entry>
  352. <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry>
  353. <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry>
  354. <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry>
  355. <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
  356. Illuminant D<subscript>65</subscript></entry>
  357. <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
  358. 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
  359. <entry>0.2125&nbsp;E'<subscript>R</subscript>
  360. +&nbsp;0.7154&nbsp;E'<subscript>G</subscript>
  361. +&nbsp;0.0721&nbsp;E'<subscript>B</subscript></entry>
  362. <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
  363. <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
  364. </row>
  365. <row>
  366. <entry><constant>V4L2_COLORSPACE_BT878</constant></entry>
  367. <entry>4</entry>
  368. <entry>Broken Bt878 extents<footnote>
  369. <para>The ubiquitous Bt878 video capture chip
  370. quantizes E'<subscript>Y</subscript> to 238 levels, yielding a range
  371. of Y' = 16 &hellip; 253, unlike Rec. 601 Y' = 16 &hellip;
  372. 235. This is not a typo in the Bt878 documentation, it has been
  373. implemented in silicon. The chroma extents are unclear.</para>
  374. </footnote>, <xref linkend="itu601" /></entry>
  375. <entry>?</entry>
  376. <entry>?</entry>
  377. <entry>?</entry>
  378. <entry>?</entry>
  379. <entry>?</entry>
  380. <entry>0.299&nbsp;E'<subscript>R</subscript>
  381. +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
  382. +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
  383. <entry><emphasis>237</emphasis>&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
  384. <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128 (probably)</entry>
  385. </row>
  386. <row>
  387. <entry><constant>V4L2_COLORSPACE_470_SYSTEM_M</constant></entry>
  388. <entry>5</entry>
  389. <entry>M/NTSC<footnote>
  390. <para>No identifier exists for M/PAL which uses
  391. the chromaticities of M/NTSC, the remaining parameters are equal to B and
  392. G/PAL.</para>
  393. </footnote> according to <xref linkend="itu470" />, <xref
  394. linkend="itu601" /></entry>
  395. <entry>x&nbsp;=&nbsp;0.67, y&nbsp;=&nbsp;0.33</entry>
  396. <entry>x&nbsp;=&nbsp;0.21, y&nbsp;=&nbsp;0.71</entry>
  397. <entry>x&nbsp;=&nbsp;0.14, y&nbsp;=&nbsp;0.08</entry>
  398. <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.316, Illuminant C</entry>
  399. <entry>?</entry>
  400. <entry>0.299&nbsp;E'<subscript>R</subscript>
  401. +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
  402. +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
  403. <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
  404. <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
  405. </row>
  406. <row>
  407. <entry><constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant></entry>
  408. <entry>6</entry>
  409. <entry>625-line PAL and SECAM systems according to <xref
  410. linkend="itu470" />, <xref linkend="itu601" /></entry>
  411. <entry>x&nbsp;=&nbsp;0.64, y&nbsp;=&nbsp;0.33</entry>
  412. <entry>x&nbsp;=&nbsp;0.29, y&nbsp;=&nbsp;0.60</entry>
  413. <entry>x&nbsp;=&nbsp;0.15, y&nbsp;=&nbsp;0.06</entry>
  414. <entry>x&nbsp;=&nbsp;0.313, y&nbsp;=&nbsp;0.329,
  415. Illuminant D<subscript>65</subscript></entry>
  416. <entry>?</entry>
  417. <entry>0.299&nbsp;E'<subscript>R</subscript>
  418. +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
  419. +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
  420. <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
  421. <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
  422. </row>
  423. <row>
  424. <entry><constant>V4L2_COLORSPACE_JPEG</constant></entry>
  425. <entry>7</entry>
  426. <entry>JPEG Y'CbCr, see <xref linkend="jfif" />, <xref linkend="itu601" /></entry>
  427. <entry>?</entry>
  428. <entry>?</entry>
  429. <entry>?</entry>
  430. <entry>?</entry>
  431. <entry>?</entry>
  432. <entry>0.299&nbsp;E'<subscript>R</subscript>
  433. +&nbsp;0.587&nbsp;E'<subscript>G</subscript>
  434. +&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
  435. <entry>256&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16<footnote>
  436. <para>Note JFIF quantizes
  437. Y'P<subscript>B</subscript>P<subscript>R</subscript> in range [0;+1] and
  438. [-0.5;+0.5] to <emphasis>257</emphasis> levels, however Y'CbCr signals
  439. are still clamped to [0;255].</para>
  440. </footnote></entry>
  441. <entry>256&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
  442. </row>
  443. <row>
  444. <entry><constant>V4L2_COLORSPACE_SRGB</constant></entry>
  445. <entry>8</entry>
  446. <entry>[?]</entry>
  447. <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry>
  448. <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry>
  449. <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry>
  450. <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
  451. Illuminant D<subscript>65</subscript></entry>
  452. <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
  453. 1.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
  454. <entry spanname="spam">n/a</entry>
  455. </row>
  456. </tbody>
  457. </tgroup>
  458. </table>
  459. </section>
  460. <section id="pixfmt-indexed">
  461. <title>Indexed Format</title>
  462. <para>In this format each pixel is represented by an 8 bit index
  463. into a 256 entry ARGB palette. It is intended for <link
  464. linkend="osd">Video Output Overlays</link> only. There are no ioctls to
  465. access the palette, this must be done with ioctls of the Linux framebuffer API.</para>
  466. <table pgwide="0" frame="none">
  467. <title>Indexed Image Format</title>
  468. <tgroup cols="37" align="center">
  469. <colspec colname="id" align="left" />
  470. <colspec colname="fourcc" />
  471. <colspec colname="bit" />
  472. <colspec colnum="4" colname="b07" align="center" />
  473. <colspec colnum="5" colname="b06" align="center" />
  474. <colspec colnum="6" colname="b05" align="center" />
  475. <colspec colnum="7" colname="b04" align="center" />
  476. <colspec colnum="8" colname="b03" align="center" />
  477. <colspec colnum="9" colname="b02" align="center" />
  478. <colspec colnum="10" colname="b01" align="center" />
  479. <colspec colnum="11" colname="b00" align="center" />
  480. <spanspec namest="b07" nameend="b00" spanname="b0" />
  481. <spanspec namest="b17" nameend="b10" spanname="b1" />
  482. <spanspec namest="b27" nameend="b20" spanname="b2" />
  483. <spanspec namest="b37" nameend="b30" spanname="b3" />
  484. <thead>
  485. <row>
  486. <entry>Identifier</entry>
  487. <entry>Code</entry>
  488. <entry>&nbsp;</entry>
  489. <entry spanname="b0">Byte&nbsp;0</entry>
  490. </row>
  491. <row>
  492. <entry>&nbsp;</entry>
  493. <entry>&nbsp;</entry>
  494. <entry>Bit</entry>
  495. <entry>7</entry>
  496. <entry>6</entry>
  497. <entry>5</entry>
  498. <entry>4</entry>
  499. <entry>3</entry>
  500. <entry>2</entry>
  501. <entry>1</entry>
  502. <entry>0</entry>
  503. </row>
  504. </thead>
  505. <tbody valign="top">
  506. <row id="V4L2-PIX-FMT-PAL8">
  507. <entry><constant>V4L2_PIX_FMT_PAL8</constant></entry>
  508. <entry>'PAL8'</entry>
  509. <entry></entry>
  510. <entry>i<subscript>7</subscript></entry>
  511. <entry>i<subscript>6</subscript></entry>
  512. <entry>i<subscript>5</subscript></entry>
  513. <entry>i<subscript>4</subscript></entry>
  514. <entry>i<subscript>3</subscript></entry>
  515. <entry>i<subscript>2</subscript></entry>
  516. <entry>i<subscript>1</subscript></entry>
  517. <entry>i<subscript>0</subscript></entry>
  518. </row>
  519. </tbody>
  520. </tgroup>
  521. </table>
  522. </section>
  523. <section id="pixfmt-rgb">
  524. <title>RGB Formats</title>
  525. &sub-packed-rgb;
  526. &sub-sbggr8;
  527. &sub-sgbrg8;
  528. &sub-sgrbg8;
  529. &sub-sbggr16;
  530. </section>
  531. <section id="yuv-formats">
  532. <title>YUV Formats</title>
  533. <para>YUV is the format native to TV broadcast and composite video
  534. signals. It separates the brightness information (Y) from the color
  535. information (U and V or Cb and Cr). The color information consists of
  536. red and blue <emphasis>color difference</emphasis> signals, this way
  537. the green component can be reconstructed by subtracting from the
  538. brightness component. See <xref linkend="colorspaces" /> for conversion
  539. examples. YUV was chosen because early television would only transmit
  540. brightness information. To add color in a way compatible with existing
  541. receivers a new signal carrier was added to transmit the color
  542. difference signals. Secondary in the YUV format the U and V components
  543. usually have lower resolution than the Y component. This is an analog
  544. video compression technique taking advantage of a property of the
  545. human visual system, being more sensitive to brightness
  546. information.</para>
  547. &sub-packed-yuv;
  548. &sub-grey;
  549. &sub-y16;
  550. &sub-yuyv;
  551. &sub-uyvy;
  552. &sub-yvyu;
  553. &sub-vyuy;
  554. &sub-y41p;
  555. &sub-yuv420;
  556. &sub-yuv410;
  557. &sub-yuv422p;
  558. &sub-yuv411p;
  559. &sub-nv12;
  560. &sub-nv16;
  561. </section>
  562. <section>
  563. <title>Compressed Formats</title>
  564. <table pgwide="1" frame="none" id="compressed-formats">
  565. <title>Compressed Image Formats</title>
  566. <tgroup cols="3" align="left">
  567. &cs-def;
  568. <thead>
  569. <row>
  570. <entry>Identifier</entry>
  571. <entry>Code</entry>
  572. <entry>Details</entry>
  573. </row>
  574. </thead>
  575. <tbody valign="top">
  576. <row id="V4L2-PIX-FMT-JPEG">
  577. <entry><constant>V4L2_PIX_FMT_JPEG</constant></entry>
  578. <entry>'JPEG'</entry>
  579. <entry>TBD. See also &VIDIOC-G-JPEGCOMP;,
  580. &VIDIOC-S-JPEGCOMP;.</entry>
  581. </row>
  582. <row id="V4L2-PIX-FMT-MPEG">
  583. <entry><constant>V4L2_PIX_FMT_MPEG</constant></entry>
  584. <entry>'MPEG'</entry>
  585. <entry>MPEG stream. The actual format is determined by
  586. extended control <constant>V4L2_CID_MPEG_STREAM_TYPE</constant>, see
  587. <xref linkend="mpeg-control-id" />.</entry>
  588. </row>
  589. </tbody>
  590. </tgroup>
  591. </table>
  592. </section>
  593. <section id="pixfmt-reserved">
  594. <title>Reserved Format Identifiers</title>
  595. <para>These formats are not defined by this specification, they
  596. are just listed for reference and to avoid naming conflicts. If you
  597. want to register your own format, send an e-mail to the linux-media mailing
  598. list &v4l-ml; for inclusion in the <filename>videodev2.h</filename>
  599. file. If you want to share your format with other developers add a
  600. link to your documentation and send a copy to the linux-media mailing list
  601. for inclusion in this section. If you think your format should be listed
  602. in a standard format section please make a proposal on the linux-media mailing
  603. list.</para>
  604. <table pgwide="1" frame="none" id="reserved-formats">
  605. <title>Reserved Image Formats</title>
  606. <tgroup cols="3" align="left">
  607. &cs-def;
  608. <thead>
  609. <row>
  610. <entry>Identifier</entry>
  611. <entry>Code</entry>
  612. <entry>Details</entry>
  613. </row>
  614. </thead>
  615. <tbody valign="top">
  616. <row id="V4L2-PIX-FMT-DV">
  617. <entry><constant>V4L2_PIX_FMT_DV</constant></entry>
  618. <entry>'dvsd'</entry>
  619. <entry>unknown</entry>
  620. </row>
  621. <row id="V4L2-PIX-FMT-ET61X251">
  622. <entry><constant>V4L2_PIX_FMT_ET61X251</constant></entry>
  623. <entry>'E625'</entry>
  624. <entry>Compressed format of the ET61X251 driver.</entry>
  625. </row>
  626. <row id="V4L2-PIX-FMT-HI240">
  627. <entry><constant>V4L2_PIX_FMT_HI240</constant></entry>
  628. <entry>'HI24'</entry>
  629. <entry><para>8 bit RGB format used by the BTTV driver.</para></entry>
  630. </row>
  631. <row id="V4L2-PIX-FMT-HM12">
  632. <entry><constant>V4L2_PIX_FMT_HM12</constant></entry>
  633. <entry>'HM12'</entry>
  634. <entry><para>YUV 4:2:0 format used by the
  635. IVTV driver, <ulink url="http://www.ivtvdriver.org/">
  636. http://www.ivtvdriver.org/</ulink></para><para>The format is documented in the
  637. kernel sources in the file <filename>Documentation/video4linux/cx2341x/README.hm12</filename>
  638. </para></entry>
  639. </row>
  640. <row id="V4L2-PIX-FMT-SPCA501">
  641. <entry><constant>V4L2_PIX_FMT_SPCA501</constant></entry>
  642. <entry>'S501'</entry>
  643. <entry>YUYV per line used by the gspca driver.</entry>
  644. </row>
  645. <row id="V4L2-PIX-FMT-SPCA505">
  646. <entry><constant>V4L2_PIX_FMT_SPCA505</constant></entry>
  647. <entry>'S505'</entry>
  648. <entry>YYUV per line used by the gspca driver.</entry>
  649. </row>
  650. <row id="V4L2-PIX-FMT-SPCA508">
  651. <entry><constant>V4L2_PIX_FMT_SPCA508</constant></entry>
  652. <entry>'S508'</entry>
  653. <entry>YUVY per line used by the gspca driver.</entry>
  654. </row>
  655. <row id="V4L2-PIX-FMT-SPCA561">
  656. <entry><constant>V4L2_PIX_FMT_SPCA561</constant></entry>
  657. <entry>'S561'</entry>
  658. <entry>Compressed GBRG Bayer format used by the gspca driver.</entry>
  659. </row>
  660. <row id="V4L2-PIX-FMT-SGRBG10">
  661. <entry><constant>V4L2_PIX_FMT_SGRBG10</constant></entry>
  662. <entry>'DA10'</entry>
  663. <entry>10 bit raw Bayer, expanded to 16 bits.</entry>
  664. </row>
  665. <row id="V4L2-PIX-FMT-SGRBG10DPCM8">
  666. <entry><constant>V4L2_PIX_FMT_SGRBG10DPCM8</constant></entry>
  667. <entry>'DB10'</entry>
  668. <entry>10 bit raw Bayer DPCM compressed to 8 bits.</entry>
  669. </row>
  670. <row id="V4L2-PIX-FMT-PAC207">
  671. <entry><constant>V4L2_PIX_FMT_PAC207</constant></entry>
  672. <entry>'P207'</entry>
  673. <entry>Compressed BGGR Bayer format used by the gspca driver.</entry>
  674. </row>
  675. <row id="V4L2-PIX-FMT-MR97310A">
  676. <entry><constant>V4L2_PIX_FMT_MR97310A</constant></entry>
  677. <entry>'M310'</entry>
  678. <entry>Compressed BGGR Bayer format used by the gspca driver.</entry>
  679. </row>
  680. <row id="V4L2-PIX-FMT-OV511">
  681. <entry><constant>V4L2_PIX_FMT_OV511</constant></entry>
  682. <entry>'O511'</entry>
  683. <entry>OV511 JPEG format used by the gspca driver.</entry>
  684. </row>
  685. <row id="V4L2-PIX-FMT-OV518">
  686. <entry><constant>V4L2_PIX_FMT_OV518</constant></entry>
  687. <entry>'O518'</entry>
  688. <entry>OV518 JPEG format used by the gspca driver.</entry>
  689. </row>
  690. <row id="V4L2-PIX-FMT-PJPG">
  691. <entry><constant>V4L2_PIX_FMT_PJPG</constant></entry>
  692. <entry>'PJPG'</entry>
  693. <entry>Pixart 73xx JPEG format used by the gspca driver.</entry>
  694. </row>
  695. <row id="V4L2-PIX-FMT-SQ905C">
  696. <entry><constant>V4L2_PIX_FMT_SQ905C</constant></entry>
  697. <entry>'905C'</entry>
  698. <entry>Compressed RGGB bayer format used by the gspca driver.</entry>
  699. </row>
  700. <row id="V4L2-PIX-FMT-MJPEG">
  701. <entry><constant>V4L2_PIX_FMT_MJPEG</constant></entry>
  702. <entry>'MJPG'</entry>
  703. <entry>Compressed format used by the Zoran driver</entry>
  704. </row>
  705. <row id="V4L2-PIX-FMT-PWC1">
  706. <entry><constant>V4L2_PIX_FMT_PWC1</constant></entry>
  707. <entry>'PWC1'</entry>
  708. <entry>Compressed format of the PWC driver.</entry>
  709. </row>
  710. <row id="V4L2-PIX-FMT-PWC2">
  711. <entry><constant>V4L2_PIX_FMT_PWC2</constant></entry>
  712. <entry>'PWC2'</entry>
  713. <entry>Compressed format of the PWC driver.</entry>
  714. </row>
  715. <row id="V4L2-PIX-FMT-SN9C10X">
  716. <entry><constant>V4L2_PIX_FMT_SN9C10X</constant></entry>
  717. <entry>'S910'</entry>
  718. <entry>Compressed format of the SN9C102 driver.</entry>
  719. </row>
  720. <row id="V4L2-PIX-FMT-SN9C20X-I420">
  721. <entry><constant>V4L2_PIX_FMT_SN9C20X_I420</constant></entry>
  722. <entry>'S920'</entry>
  723. <entry>YUV 4:2:0 format of the gspca sn9c20x driver.</entry>
  724. </row>
  725. <row id="V4L2-PIX-FMT-WNVA">
  726. <entry><constant>V4L2_PIX_FMT_WNVA</constant></entry>
  727. <entry>'WNVA'</entry>
  728. <entry><para>Used by the Winnov Videum driver, <ulink
  729. url="http://www.thedirks.org/winnov/">
  730. http://www.thedirks.org/winnov/</ulink></para></entry>
  731. </row>
  732. <row id="V4L2-PIX-FMT-TM6000">
  733. <entry><constant>V4L2_PIX_FMT_TM6000</constant></entry>
  734. <entry>'TM60'</entry>
  735. <entry><para>Used by Trident tm6000</para></entry>
  736. </row>
  737. <row id="V4L2-PIX-FMT-YYUV">
  738. <entry><constant>V4L2_PIX_FMT_YYUV</constant></entry>
  739. <entry>'YYUV'</entry>
  740. <entry>unknown</entry>
  741. </row>
  742. </tbody>
  743. </tgroup>
  744. </table>
  745. </section>
  746. <!--
  747. Local Variables:
  748. mode: sgml
  749. sgml-parent-document: "v4l2.sgml"
  750. indent-tabs-mode: nil
  751. End:
  752. -->