aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-11-27 08:16:08 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-12-01 12:40:29 -0500
commit1afed88381bb332040f2cb80ab1fa1d70506d593 (patch)
tree73bb978b2392ee7bf17d245bbea534687fd69eab
parent736d96b5972a5c5a25afab0c5dd33cb7831a6780 (diff)
[media] DocBook media: rewrite the Colorspace chapter
The colorspace chapter in the V4L2 Specification was always poorly written. This patch rewrites it, documenting the new Y'CbCr encoding and quantization defines and going into much more detail with respect to how colorspaces are used and what it all means. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--Documentation/DocBook/media/v4l/biblio.xml85
-rw-r--r--Documentation/DocBook/media/v4l/pixfmt.xml1274
2 files changed, 1052 insertions, 307 deletions
diff --git a/Documentation/DocBook/media/v4l/biblio.xml b/Documentation/DocBook/media/v4l/biblio.xml
index d2eb79e41a01..7ff01a23c2fe 100644
--- a/Documentation/DocBook/media/v4l/biblio.xml
+++ b/Documentation/DocBook/media/v4l/biblio.xml
@@ -178,6 +178,75 @@ Signal - NTSC for Studio Applications"</title>
1781125-Line High-Definition Production"</title> 1781125-Line High-Definition Production"</title>
179 </biblioentry> 179 </biblioentry>
180 180
181 <biblioentry id="srgb">
182 <abbrev>sRGB</abbrev>
183 <authorgroup>
184 <corpauthor>International Electrotechnical Commission
185(<ulink url="http://www.iec.ch">http://www.iec.ch</ulink>)</corpauthor>
186 </authorgroup>
187 <title>IEC 61966-2-1 ed1.0 "Multimedia systems and equipment - Colour measurement
188and management - Part 2-1: Colour management - Default RGB colour space - sRGB"</title>
189 </biblioentry>
190
191 <biblioentry id="sycc">
192 <abbrev>sYCC</abbrev>
193 <authorgroup>
194 <corpauthor>International Electrotechnical Commission
195(<ulink url="http://www.iec.ch">http://www.iec.ch</ulink>)</corpauthor>
196 </authorgroup>
197 <title>IEC 61966-2-1-am1 ed1.0 "Amendment 1 - Multimedia systems and equipment - Colour measurement
198and management - Part 2-1: Colour management - Default RGB colour space - sRGB"</title>
199 </biblioentry>
200
201 <biblioentry id="xvycc">
202 <abbrev>xvYCC</abbrev>
203 <authorgroup>
204 <corpauthor>International Electrotechnical Commission
205(<ulink url="http://www.iec.ch">http://www.iec.ch</ulink>)</corpauthor>
206 </authorgroup>
207 <title>IEC 61966-2-4 ed1.0 "Multimedia systems and equipment - Colour measurement
208and management - Part 2-4: Colour management - Extended-gamut YCC colour space for video
209applications - xvYCC"</title>
210 </biblioentry>
211
212 <biblioentry id="adobergb">
213 <abbrev>AdobeRGB</abbrev>
214 <authorgroup>
215 <corpauthor>Adobe Systems Incorporated (<ulink url="http://www.adobe.com">http://www.adobe.com</ulink>)</corpauthor>
216 </authorgroup>
217 <title>Adobe&copy; RGB (1998) Color Image Encoding Version 2005-05</title>
218 </biblioentry>
219
220 <biblioentry id="oprgb">
221 <abbrev>opRGB</abbrev>
222 <authorgroup>
223 <corpauthor>International Electrotechnical Commission
224(<ulink url="http://www.iec.ch">http://www.iec.ch</ulink>)</corpauthor>
225 </authorgroup>
226 <title>IEC 61966-2-5 "Multimedia systems and equipment - Colour measurement
227and management - Part 2-5: Colour management - Optional RGB colour space - opRGB"</title>
228 </biblioentry>
229
230 <biblioentry id="itu2020">
231 <abbrev>ITU&nbsp;BT.2020</abbrev>
232 <authorgroup>
233 <corpauthor>International Telecommunication Union (<ulink
234url="http://www.itu.ch">http://www.itu.ch</ulink>)</corpauthor>
235 </authorgroup>
236 <title>ITU-R Recommendation BT.2020 (08/2012) "Parameter values for ultra-high
237definition television systems for production and international programme exchange"
238</title>
239 </biblioentry>
240
241 <biblioentry id="tech3213">
242 <abbrev>EBU&nbsp;Tech&nbsp;3213</abbrev>
243 <authorgroup>
244 <corpauthor>European Broadcast Union (<ulink
245url="http://www.ebu.ch">http://www.ebu.ch</ulink>)</corpauthor>
246 </authorgroup>
247 <title>E.B.U. Standard for Chromaticity Tolerances for Studio Monitors"</title>
248 </biblioentry>
249
181 <biblioentry id="iec62106"> 250 <biblioentry id="iec62106">
182 <abbrev>IEC&nbsp;62106</abbrev> 251 <abbrev>IEC&nbsp;62106</abbrev>
183 <authorgroup> 252 <authorgroup>
@@ -266,4 +335,20 @@ in the frequency range from 87,5 to 108,0 MHz</title>
266 <subtitle>Version 1, Revision 2</subtitle> 335 <subtitle>Version 1, Revision 2</subtitle>
267 </biblioentry> 336 </biblioentry>
268 337
338 <biblioentry id="poynton">
339 <abbrev>poynton</abbrev>
340 <authorgroup>
341 <corpauthor>Charles Poynton</corpauthor>
342 </authorgroup>
343 <title>Digital Video and HDTV, Algorithms and Interfaces</title>
344 </biblioentry>
345
346 <biblioentry id="colimg">
347 <abbrev>colimg</abbrev>
348 <authorgroup>
349 <corpauthor>Erik Reinhard et al.</corpauthor>
350 </authorgroup>
351 <title>Color Imaging: Fundamentals and Applications</title>
352 </biblioentry>
353
269 </bibliography> 354 </bibliography>
diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml
index df5b23d46552..ccf6053c1ae4 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -296,343 +296,1003 @@ in the 2-planar version or with each component in its own buffer in the
296 <section id="colorspaces"> 296 <section id="colorspaces">
297 <title>Colorspaces</title> 297 <title>Colorspaces</title>
298 298
299 <para>[intro]</para> 299 <para>'Color' is a very complex concept and depends on physics, chemistry and
300biology. Just because you have three numbers that describe the 'red', 'green'
301and 'blue' components of the color of a pixel does not mean that you can accurately
302display that color. A colorspace defines what it actually <emphasis>means</emphasis>
303to have an RGB value of e.g. (255,&nbsp;0,&nbsp;0). That is, which color should be
304reproduced on the screen in a perfectly calibrated environment.</para>
300 305
301 <!-- See proposal by Billy Biggs, video4linux-list@redhat.com 306 <para>In order to do that we first need to have a good definition of
302on 11 Oct 2002, subject: "Re: [V4L] Re: v4l2 api", and 307color, i.e. some way to uniquely and unambiguously define a color so that someone
303http://vektor.theorem.ca/graphics/ycbcr/ and 308else can reproduce it. Human color vision is trichromatic since the human eye has
304http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html --> 309color receptors that are sensitive to three different wavelengths of light. Hence
310the need to use three numbers to describe color. Be glad you are not a mantis shrimp
311as those are sensitive to 12 different wavelengths, so instead of RGB we would be
312using the ABCDEFGHIJKL colorspace...</para>
305 313
306 <para> 314 <para>Color exists only in the eye and brain and is the result of how strongly
307 <variablelist> 315color receptors are stimulated. This is based on the Spectral
308 <varlistentry> 316Power Distribution (SPD) which is a graph showing the intensity (radiant power)
309 <term>Gamma Correction</term> 317of the light at wavelengths covering the visible spectrum as it enters the eye.
310 <listitem> 318The science of colorimetry is about the relationship between the SPD and color as
311 <para>[to do]</para> 319perceived by the human brain.</para>
312 <para>E'<subscript>R</subscript> = f(R)</para> 320
313 <para>E'<subscript>G</subscript> = f(G)</para> 321 <para>Since the human eye has only three color receptors it is perfectly
314 <para>E'<subscript>B</subscript> = f(B)</para> 322possible that different SPDs will result in the same stimulation of those receptors
315 </listitem> 323and are perceived as the same color, even though the SPD of the light is
316 </varlistentry> 324different.</para>
317 <varlistentry> 325
318 <term>Construction of luminance and color-difference 326 <para>In the 1920s experiments were devised to determine the relationship
319signals</term> 327between SPDs and the perceived color and that resulted in the CIE 1931 standard
320 <listitem> 328that defines spectral weighting functions that model the perception of color.
321 <para>[to do]</para> 329Specifically that standard defines functions that can take an SPD and calculate
322 <para>E'<subscript>Y</subscript> = 330the stimulus for each color receptor. After some further mathematical transforms
323Coeff<subscript>R</subscript> E'<subscript>R</subscript> 331these stimuli are known as the <emphasis>CIE XYZ tristimulus</emphasis> values
324+ Coeff<subscript>G</subscript> E'<subscript>G</subscript> 332and these X, Y and Z values describe a color as perceived by a human unambiguously.
325+ Coeff<subscript>B</subscript> E'<subscript>B</subscript></para> 333These X, Y and Z values are all in the range [0&hellip;1].</para>
326 <para>(E'<subscript>R</subscript> - E'<subscript>Y</subscript>) = E'<subscript>R</subscript> 334
327- Coeff<subscript>R</subscript> E'<subscript>R</subscript> 335 <para>The Y value in the CIE XYZ colorspace corresponds to luminance. Often
328- Coeff<subscript>G</subscript> E'<subscript>G</subscript> 336the CIE XYZ colorspace is transformed to the normalized CIE xyY colorspace:</para>
329- Coeff<subscript>B</subscript> E'<subscript>B</subscript></para> 337
330 <para>(E'<subscript>B</subscript> - E'<subscript>Y</subscript>) = E'<subscript>B</subscript> 338 <para>x = X / (X + Y + Z)</para>
331- Coeff<subscript>R</subscript> E'<subscript>R</subscript> 339 <para>y = Y / (X + Y + Z)</para>
332- Coeff<subscript>G</subscript> E'<subscript>G</subscript> 340
333- Coeff<subscript>B</subscript> E'<subscript>B</subscript></para> 341 <para>The x and y values are the chromaticity coordinates and can be used to
334 </listitem> 342define a color without the luminance component Y. It is very confusing to
335 </varlistentry> 343have such similar names for these colorspaces. Just be aware that if colors
336 <varlistentry> 344are specified with lower case 'x' and 'y', then the CIE xyY colorspace is
337 <term>Re-normalized color-difference signals</term> 345used. Upper case 'X' and 'Y' refer to the CIE XYZ colorspace. Also, y has nothing
338 <listitem> 346to do with luminance. Together x and y specify a color, and Y the luminance.
339 <para>The color-difference signals are scaled back to unity 347That is really all you need to remember from a practical point of view. At
340range [-0.5;+0.5]:</para> 348the end of this section you will find reading resources that go into much more
341 <para>K<subscript>B</subscript> = 0.5 / (1 - Coeff<subscript>B</subscript>)</para> 349detail if you are interested.
342 <para>K<subscript>R</subscript> = 0.5 / (1 - Coeff<subscript>R</subscript>)</para> 350</para>
343 <para>P<subscript>B</subscript> = 351
344K<subscript>B</subscript> (E'<subscript>B</subscript> - E'<subscript>Y</subscript>) = 352 <para>A monitor or TV will reproduce colors by emitting light at three
345 0.5 (Coeff<subscript>R</subscript> / Coeff<subscript>B</subscript>) E'<subscript>R</subscript> 353different wavelengths, the combination of which will stimulate the color receptors
346+ 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>B</subscript>) E'<subscript>G</subscript> 354in the eye and thus cause the perception of color. Historically these wavelengths
347+ 0.5 E'<subscript>B</subscript></para> 355were defined by the red, green and blue phosphors used in the displays. These
348 <para>P<subscript>R</subscript> = 356<emphasis>color primaries</emphasis> are part of what defines a colorspace.</para>
349K<subscript>R</subscript> (E'<subscript>R</subscript> - E'<subscript>Y</subscript>) = 357
350 0.5 E'<subscript>R</subscript> 358 <para>Different display devices will have different primaries and some
351+ 0.5 (Coeff<subscript>G</subscript> / Coeff<subscript>R</subscript>) E'<subscript>G</subscript> 359primaries are more suitable for some display technologies than others. This has
352+ 0.5 (Coeff<subscript>B</subscript> / Coeff<subscript>R</subscript>) E'<subscript>B</subscript></para> 360resulted in a variety of colorspaces that are used for different display
353 </listitem> 361technologies or uses. To define a colorspace you need to define the three
354 </varlistentry> 362color primaries (these are typically defined as x,&nbsp;y chromaticity coordinates
355 <varlistentry> 363from the CIE xyY colorspace) but also the white reference: that is the color obtained
356 <term>Quantization</term> 364when all three primaries are at maximum power. This determines the relative power
357 <listitem> 365or energy of the primaries. This is usually chosen to be close to daylight which has
358 <para>[to do]</para> 366been defined as the CIE D65 Illuminant.</para>
359 <para>Y' = (Lum. Levels - 1) &middot; E'<subscript>Y</subscript> + Lum. Offset</para> 367
360 <para>C<subscript>B</subscript> = (Chrom. Levels - 1) 368 <para>To recapitulate: the CIE XYZ colorspace uniquely identifies colors.
361&middot; P<subscript>B</subscript> + Chrom. Offset</para> 369Other colorspaces are defined by three chromaticity coordinates defined in the
362 <para>C<subscript>R</subscript> = (Chrom. Levels - 1) 370CIE xyY colorspace. Based on those a 3x3 matrix can be constructed that
363&middot; P<subscript>R</subscript> + Chrom. Offset</para> 371transforms CIE XYZ colors to colors in the new colorspace.
364 <para>Rounding to the nearest integer and clamping to the range 372</para>
365[0;255] finally yields the digital color components Y'CbCr 373
366stored in YUV images.</para> 374 <para>Both the CIE XYZ and the RGB colorspace that are derived from the
367 </listitem> 375specific chromaticity primaries are linear colorspaces. But neither the eye,
368 </varlistentry> 376nor display technology is linear. Doubling the values of all components in
369 </variablelist> 377the linear colorspace will not be perceived as twice the intensity of the color.
370 </para> 378So each colorspace also defines a transfer function that takes a linear color
371 379component value and transforms it to the non-linear component value, which is a
372 <example> 380closer match to the non-linear performance of both the eye and displays. Linear
373 <title>ITU-R Rec. BT.601 color conversion</title> 381component values are denoted RGB, non-linear are denoted as R'G'B'. In general
374 382colors used in graphics are all R'G'B', except in openGL which uses linear RGB.
375 <para>Forward Transformation</para> 383Special care should be taken when dealing with openGL to provide linear RGB colors
376 384or to use the built-in openGL support to apply the inverse transfer function.</para>
377 <programlisting> 385
378int ER, EG, EB; /* gamma corrected RGB input [0;255] */ 386 <para>The final piece that defines a colorspace is a function that
379int Y1, Cb, Cr; /* output [0;255] */ 387transforms non-linear R'G'B' to non-linear Y'CbCr. This function is determined
380 388by the so-called luma coefficients. There may be multiple possible Y'CbCr
381double r, g, b; /* temporaries */ 389encodings allowed for the same colorspace. Many encodings of color
382double y1, pb, pr; 390prefer to use luma (Y') and chroma (CbCr) instead of R'G'B'. Since the human
383 391eye is more sensitive to differences in luminance than in color this encoding
384int 392allows one to reduce the amount of color information compared to the luma
385clamp (double x) 393data. Note that the luma (Y') is unrelated to the Y in the CIE XYZ colorspace.
386{ 394Also note that Y'CbCr is often called YCbCr or YUV even though these are
387 int r = x; /* round to nearest */ 395strictly speaking wrong.</para>
388 396
389 if (r &lt; 0) return 0; 397 <para>Sometimes people confuse Y'CbCr as being a colorspace. This is not
390 else if (r &gt; 255) return 255; 398correct, it is just an encoding of an R'G'B' color into luma and chroma
391 else return r; 399values. The underlying colorspace that is associated with the R'G'B' color
392} 400is also associated with the Y'CbCr color.</para>
393 401
394r = ER / 255.0; 402 <para>The final step is how the RGB, R'G'B' or Y'CbCr values are
395g = EG / 255.0; 403quantized. The CIE XYZ colorspace where X, Y and Z are in the range
396b = EB / 255.0; 404[0&hellip;1] describes all colors that humans can perceive, but the transform to
397 405another colorspace will produce colors that are outside the [0&hellip;1] range.
398y1 = 0.299 * r + 0.587 * g + 0.114 * b; 406Once clamped to the [0&hellip;1] range those colors can no longer be reproduced
399pb = -0.169 * r - 0.331 * g + 0.5 * b; 407in that colorspace. This clamping is what reduces the extent or gamut of the
400pr = 0.5 * r - 0.419 * g - 0.081 * b; 408colorspace. How the range of [0&hellip;1] is translated to integer values in the
401 409range of [0&hellip;255] (or higher, depending on the color depth) is called the
402Y1 = clamp (219 * y1 + 16); 410quantization. This is <emphasis>not</emphasis> part of the colorspace
403Cb = clamp (224 * pb + 128); 411definition. In practice RGB or R'G'B' values are full range, i.e. they
404Cr = clamp (224 * pr + 128); 412use the full [0&hellip;255] range. Y'CbCr values on the other hand are limited
405 413range with Y' using [16&hellip;235] and Cb and Cr using [16&hellip;240].</para>
406/* or shorter */ 414
407 415 <para>Unfortunately, in some cases limited range RGB is also used
408y1 = 0.299 * ER + 0.587 * EG + 0.114 * EB; 416where the components use the range [16&hellip;235]. And full range Y'CbCr also exists
409 417using the [0&hellip;255] range.</para>
410Y1 = clamp ( (219 / 255.0) * y1 + 16); 418
411Cb = clamp (((224 / 255.0) / (2 - 2 * 0.114)) * (EB - y1) + 128); 419 <para>In order to correctly interpret a color you need to know the
412Cr = clamp (((224 / 255.0) / (2 - 2 * 0.299)) * (ER - y1) + 128); 420quantization range, whether it is R'G'B' or Y'CbCr, the used Y'CbCr encoding
413 </programlisting> 421and the colorspace.
414 422From that information you can calculate the corresponding CIE XYZ color
415 <para>Inverse Transformation</para> 423and map that again to whatever colorspace your display device uses.</para>
416 424
417 <programlisting> 425 <para>The colorspace definition itself consists of the three
418int Y1, Cb, Cr; /* gamma pre-corrected input [0;255] */ 426chromaticity primaries, the white reference chromaticity, a transfer
419int ER, EG, EB; /* output [0;255] */ 427function and the luma coefficients needed to transform R'G'B' to Y'CbCr. While
420 428some colorspace standards correctly define all four, quite often the colorspace
421double r, g, b; /* temporaries */ 429standard only defines some, and you have to rely on other standards for
422double y1, pb, pr; 430the missing pieces. The fact that colorspaces are often a mix of different
423 431standards also led to very confusing naming conventions where the name of
424int 432a standard was used to name a colorspace when in fact that standard was
425clamp (double x) 433part of various other colorspaces as well.</para>
426{ 434
427 int r = x; /* round to nearest */ 435 <para>If you want to read more about colors and colorspaces, then the
428 436following resources are useful: <xref linkend="poynton" /> is a good practical
429 if (r &lt; 0) return 0; 437book for video engineers, <xref linkend="colimg" /> has a much broader scope and
430 else if (r &gt; 255) return 255; 438describes many more aspects of color (physics, chemistry, biology, etc.).
431 else return r; 439The <ulink url="http://www.brucelindbloom.com">http://www.brucelindbloom.com</ulink>
432} 440website is an excellent resource, especially with respect to the mathematics behind
433 441colorspace conversions. The wikipedia <ulink url="http://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space">CIE 1931 colorspace</ulink> article
434y1 = (Y1 - 16) / 219.0; 442is also very useful.</para>
435pb = (Cb - 128) / 224.0; 443 </section>
436pr = (Cr - 128) / 224.0; 444
437 445 <section>
438r = 1.0 * y1 + 0 * pb + 1.402 * pr; 446 <title>Defining Colorspaces in V4L2</title>
439g = 1.0 * y1 - 0.344 * pb - 0.714 * pr; 447 <para>In V4L2 colorspaces are defined by three values. The first is the colorspace
440b = 1.0 * y1 + 1.772 * pb + 0 * pr; 448identifier (&v4l2-colorspace;) which defines the chromaticities, the transfer
441 449function, the default Y'CbCr encoding and the default quantization method. The second
442ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */ 450is the Y'CbCr encoding identifier (&v4l2-ycbcr-encoding;) to specify non-standard
443EG = clamp (g * 255); 451Y'CbCr encodings and the third is the quantization identifier (&v4l2-quantization;)
444EB = clamp (b * 255); 452to specify non-standard quantization methods. Most of the time only the colorspace
445 </programlisting> 453field of &v4l2-pix-format; or &v4l2-pix-format-mplane; needs to be filled in. Note
446 </example> 454that the default R'G'B' quantization is always full range for all colorspaces,
447 455so this won't be mentioned explicitly for each colorspace description.</para>
448 <table pgwide="1" id="v4l2-colorspace" orient="land"> 456
449 <title>enum v4l2_colorspace</title> 457 <table pgwide="1" frame="none" id="v4l2-colorspace">
450 <tgroup cols="11" align="center"> 458 <title>V4L2 Colorspaces</title>
451 <colspec align="left" /> 459 <tgroup cols="2" align="left">
452 <colspec align="center" /> 460 &cs-def;
453 <colspec align="left" />
454 <colspec colname="cr" />
455 <colspec colname="cg" />
456 <colspec colname="cb" />
457 <colspec colname="wp" />
458 <colspec colname="gc" />
459 <colspec colname="lum" />
460 <colspec colname="qy" />
461 <colspec colname="qc" />
462 <spanspec namest="cr" nameend="cb" spanname="chrom" />
463 <spanspec namest="qy" nameend="qc" spanname="quant" />
464 <spanspec namest="lum" nameend="qc" spanname="spam" />
465 <thead> 461 <thead>
466 <row> 462 <row>
467 <entry morerows="1">Identifier</entry> 463 <entry>Identifier</entry>
468 <entry morerows="1">Value</entry> 464 <entry>Details</entry>
469 <entry morerows="1">Description</entry>
470 <entry spanname="chrom">Chromaticities<footnote>
471 <para>The coordinates of the color primaries are
472given in the CIE system (1931)</para>
473 </footnote></entry>
474 <entry morerows="1">White Point</entry>
475 <entry morerows="1">Gamma Correction</entry>
476 <entry morerows="1">Luminance E'<subscript>Y</subscript></entry>
477 <entry spanname="quant">Quantization</entry>
478 </row>
479 <row>
480 <entry>Red</entry>
481 <entry>Green</entry>
482 <entry>Blue</entry>
483 <entry>Y'</entry>
484 <entry>Cb, Cr</entry>
485 </row> 465 </row>
486 </thead> 466 </thead>
487 <tbody valign="top"> 467 <tbody valign="top">
488 <row> 468 <row>
489 <entry><constant>V4L2_COLORSPACE_SMPTE170M</constant></entry> 469 <entry><constant>V4L2_COLORSPACE_SMPTE170M</constant></entry>
490 <entry>1</entry> 470 <entry>See <xref linkend="col-smpte-170m" />.</entry>
491 <entry>NTSC/PAL according to <xref linkend="smpte170m" />,
492<xref linkend="itu601" /></entry>
493 <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
494 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
495 <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
496 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
497 Illuminant D<subscript>65</subscript></entry>
498 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
4991.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
500 <entry>0.299&nbsp;E'<subscript>R</subscript>
501+&nbsp;0.587&nbsp;E'<subscript>G</subscript>
502+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
503 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
504 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
505 </row> 471 </row>
506 <row> 472 <row>
507 <entry><constant>V4L2_COLORSPACE_SMPTE240M</constant></entry> 473 <entry><constant>V4L2_COLORSPACE_REC709</constant></entry>
508 <entry>2</entry> 474 <entry>See <xref linkend="col-rec709" />.</entry>
509 <entry>1125-Line (US) HDTV, see <xref
510linkend="smpte240m" /></entry>
511 <entry>x&nbsp;=&nbsp;0.630, y&nbsp;=&nbsp;0.340</entry>
512 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.595</entry>
513 <entry>x&nbsp;=&nbsp;0.155, y&nbsp;=&nbsp;0.070</entry>
514 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
515 Illuminant D<subscript>65</subscript></entry>
516 <entry>E' = 4&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.0228,
5171.1115&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.1115&nbsp;for&nbsp;0.0228&nbsp;&lt;&nbsp;I</entry>
518 <entry>0.212&nbsp;E'<subscript>R</subscript>
519+&nbsp;0.701&nbsp;E'<subscript>G</subscript>
520+&nbsp;0.087&nbsp;E'<subscript>B</subscript></entry>
521 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
522 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
523 </row> 475 </row>
524 <row> 476 <row>
525 <entry><constant>V4L2_COLORSPACE_REC709</constant></entry> 477 <entry><constant>V4L2_COLORSPACE_SRGB</constant></entry>
526 <entry>3</entry> 478 <entry>See <xref linkend="col-srgb" />.</entry>
527 <entry>HDTV and modern devices, see <xref
528linkend="itu709" /></entry>
529 <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry>
530 <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry>
531 <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry>
532 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290,
533 Illuminant D<subscript>65</subscript></entry>
534 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018,
5351.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry>
536 <entry>0.2125&nbsp;E'<subscript>R</subscript>
537+&nbsp;0.7154&nbsp;E'<subscript>G</subscript>
538+&nbsp;0.0721&nbsp;E'<subscript>B</subscript></entry>
539 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
540 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
541 </row> 479 </row>
542 <row> 480 <row>
543 <entry><constant>V4L2_COLORSPACE_BT878</constant></entry> 481 <entry><constant>V4L2_COLORSPACE_ADOBERGB</constant></entry>
544 <entry>4</entry> 482 <entry>See <xref linkend="col-adobergb" />.</entry>
545 <entry>Broken Bt878 extents<footnote> 483 </row>
546 <para>The ubiquitous Bt878 video capture chip 484 <row>
547quantizes E'<subscript>Y</subscript> to 238 levels, yielding a range 485 <entry><constant>V4L2_COLORSPACE_BT2020</constant></entry>
548of Y' = 16 &hellip; 253, unlike Rec. 601 Y' = 16 &hellip; 486 <entry>See <xref linkend="col-bt2020" />.</entry>
549235. This is not a typo in the Bt878 documentation, it has been 487 </row>
550implemented in silicon. The chroma extents are unclear.</para> 488 <row>
551 </footnote>, <xref linkend="itu601" /></entry> 489 <entry><constant>V4L2_COLORSPACE_SMPTE240M</constant></entry>
552 <entry>?</entry> 490 <entry>See <xref linkend="col-smpte-240m" />.</entry>
553 <entry>?</entry>
554 <entry>?</entry>
555 <entry>?</entry>
556 <entry>?</entry>
557 <entry>0.299&nbsp;E'<subscript>R</subscript>
558+&nbsp;0.587&nbsp;E'<subscript>G</subscript>
559+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
560 <entry><emphasis>237</emphasis>&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
561 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128 (probably)</entry>
562 </row> 491 </row>
563 <row> 492 <row>
564 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_M</constant></entry> 493 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_M</constant></entry>
565 <entry>5</entry> 494 <entry>See <xref linkend="col-sysm" />.</entry>
566 <entry>M/NTSC<footnote>
567 <para>No identifier exists for M/PAL which uses
568the chromaticities of M/NTSC, the remaining parameters are equal to B and
569G/PAL.</para>
570 </footnote> according to <xref linkend="itu470" />, <xref
571 linkend="itu601" /></entry>
572 <entry>x&nbsp;=&nbsp;0.67, y&nbsp;=&nbsp;0.33</entry>
573 <entry>x&nbsp;=&nbsp;0.21, y&nbsp;=&nbsp;0.71</entry>
574 <entry>x&nbsp;=&nbsp;0.14, y&nbsp;=&nbsp;0.08</entry>
575 <entry>x&nbsp;=&nbsp;0.310, y&nbsp;=&nbsp;0.316, Illuminant C</entry>
576 <entry>?</entry>
577 <entry>0.299&nbsp;E'<subscript>R</subscript>
578+&nbsp;0.587&nbsp;E'<subscript>G</subscript>
579+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
580 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
581 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
582 </row> 495 </row>
583 <row> 496 <row>
584 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant></entry> 497 <entry><constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant></entry>
585 <entry>6</entry> 498 <entry>See <xref linkend="col-sysbg" />.</entry>
586 <entry>625-line PAL and SECAM systems according to <xref
587linkend="itu470" />, <xref linkend="itu601" /></entry>
588 <entry>x&nbsp;=&nbsp;0.64, y&nbsp;=&nbsp;0.33</entry>
589 <entry>x&nbsp;=&nbsp;0.29, y&nbsp;=&nbsp;0.60</entry>
590 <entry>x&nbsp;=&nbsp;0.15, y&nbsp;=&nbsp;0.06</entry>
591 <entry>x&nbsp;=&nbsp;0.313, y&nbsp;=&nbsp;0.329,
592Illuminant D<subscript>65</subscript></entry>
593 <entry>?</entry>
594 <entry>0.299&nbsp;E'<subscript>R</subscript>
595+&nbsp;0.587&nbsp;E'<subscript>G</subscript>
596+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry>
597 <entry>219&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16</entry>
598 <entry>224&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
599 </row> 499 </row>
600 <row> 500 <row>
601 <entry><constant>V4L2_COLORSPACE_JPEG</constant></entry> 501 <entry><constant>V4L2_COLORSPACE_JPEG</constant></entry>
602 <entry>7</entry> 502 <entry>See <xref linkend="col-jpeg" />.</entry>
603 <entry>JPEG Y'CbCr, see <xref linkend="jfif" />, <xref linkend="itu601" /></entry> 503 </row>
604 <entry>?</entry> 504 </tbody>
605 <entry>?</entry> 505 </tgroup>
606 <entry>?</entry> 506 </table>
607 <entry>?</entry> 507
608 <entry>?</entry> 508 <table pgwide="1" frame="none" id="v4l2-ycbcr-encoding">
609 <entry>0.299&nbsp;E'<subscript>R</subscript> 509 <title>V4L2 Y'CbCr Encodings</title>
610+&nbsp;0.587&nbsp;E'<subscript>G</subscript> 510 <tgroup cols="2" align="left">
611+&nbsp;0.114&nbsp;E'<subscript>B</subscript></entry> 511 &cs-def;
612 <entry>256&nbsp;E'<subscript>Y</subscript>&nbsp;+&nbsp;16<footnote> 512 <thead>
613 <para>Note JFIF quantizes 513 <row>
614Y'P<subscript>B</subscript>P<subscript>R</subscript> in range [0;+1] and 514 <entry>Identifier</entry>
615[-0.5;+0.5] to <emphasis>257</emphasis> levels, however Y'CbCr signals 515 <entry>Details</entry>
616are still clamped to [0;255].</para>
617 </footnote></entry>
618 <entry>256&nbsp;P<subscript>B,R</subscript>&nbsp;+&nbsp;128</entry>
619 </row> 516 </row>
517 </thead>
518 <tbody valign="top">
620 <row> 519 <row>
621 <entry><constant>V4L2_COLORSPACE_SRGB</constant></entry> 520 <entry><constant>V4L2_YCBCR_ENC_DEFAULT</constant></entry>
622 <entry>8</entry> 521 <entry>Use the default Y'CbCr encoding as defined by the colorspace.</entry>
623 <entry>[?]</entry> 522 </row>
624 <entry>x&nbsp;=&nbsp;0.640, y&nbsp;=&nbsp;0.330</entry> 523 <row>
625 <entry>x&nbsp;=&nbsp;0.300, y&nbsp;=&nbsp;0.600</entry> 524 <entry><constant>V4L2_YCBCR_ENC_601</constant></entry>
626 <entry>x&nbsp;=&nbsp;0.150, y&nbsp;=&nbsp;0.060</entry> 525 <entry>Use the BT.601 Y'CbCr encoding.</entry>
627 <entry>x&nbsp;=&nbsp;0.3127, y&nbsp;=&nbsp;0.3290, 526 </row>
628 Illuminant D<subscript>65</subscript></entry> 527 <row>
629 <entry>E' = 4.5&nbsp;I&nbsp;for&nbsp;I&nbsp;&le;0.018, 528 <entry><constant>V4L2_YCBCR_ENC_709</constant></entry>
6301.099&nbsp;I<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&lt;&nbsp;I</entry> 529 <entry>Use the Rec. 709 Y'CbCr encoding.</entry>
631 <entry spanname="spam">n/a</entry> 530 </row>
531 <row>
532 <entry><constant>V4L2_YCBCR_ENC_XV601</constant></entry>
533 <entry>Use the extended gamut xvYCC BT.601 encoding.</entry>
534 </row>
535 <row>
536 <entry><constant>V4L2_YCBCR_ENC_XV709</constant></entry>
537 <entry>Use the extended gamut xvYCC Rec. 709 encoding.</entry>
538 </row>
539 <row>
540 <entry><constant>V4L2_YCBCR_ENC_SYCC</constant></entry>
541 <entry>Use the extended gamut sYCC encoding.</entry>
542 </row>
543 <row>
544 <entry><constant>V4L2_YCBCR_ENC_BT2020</constant></entry>
545 <entry>Use the default non-constant luminance BT.2020 Y'CbCr encoding.</entry>
546 </row>
547 <row>
548 <entry><constant>V4L2_YCBCR_ENC_BT2020_CONST_LUM</constant></entry>
549 <entry>Use the constant luminance BT.2020 Yc'CbcCrc encoding.</entry>
632 </row> 550 </row>
633 </tbody> 551 </tbody>
634 </tgroup> 552 </tgroup>
635 </table> 553 </table>
554
555 <table pgwide="1" frame="none" id="v4l2-quantization">
556 <title>V4L2 Quantization Methods</title>
557 <tgroup cols="2" align="left">
558 &cs-def;
559 <thead>
560 <row>
561 <entry>Identifier</entry>
562 <entry>Details</entry>
563 </row>
564 </thead>
565 <tbody valign="top">
566 <row>
567 <entry><constant>V4L2_QUANTIZATION_DEFAULT</constant></entry>
568 <entry>Use the default quantization encoding as defined by the colorspace.
569This is always full range for R'G'B' and usually limited range for Y'CbCr.</entry>
570 </row>
571 <row>
572 <entry><constant>V4L2_QUANTIZATION_FULL_RANGE</constant></entry>
573 <entry>Use the full range quantization encoding. I.e. the range [0&hellip;1]
574is mapped to [0&hellip;255] (with possible clipping to [1&hellip;254] to avoid the
5750x00 and 0xff values). Cb and Cr are mapped from [-0.5&hellip;0.5] to [0&hellip;255]
576(with possible clipping to [1&hellip;254] to avoid the 0x00 and 0xff values).</entry>
577 </row>
578 <row>
579 <entry><constant>V4L2_QUANTIZATION_LIM_RANGE</constant></entry>
580 <entry>Use the limited range quantization encoding. I.e. the range [0&hellip;1]
581is mapped to [16&hellip;235]. Cb and Cr are mapped from [-0.5&hellip;0.5] to [16&hellip;240].
582</entry>
583 </row>
584 </tbody>
585 </tgroup>
586 </table>
587 </section>
588
589 <section>
590 <title>Detailed Colorspace Descriptions</title>
591 <section>
592 <title id="col-smpte-170m">Colorspace SMPTE 170M (<constant>V4L2_COLORSPACE_SMPTE170M</constant>)</title>
593 <para>The <xref linkend="smpte170m" /> standard defines the colorspace used by NTSC and PAL and by SDTV
594in general. The default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_601</constant>.
595The default Y'CbCr quantization is limited range. The chromaticities of the primary colors and
596the white reference are:</para>
597 <table frame="none">
598 <title>SMPTE 170M Chromaticities</title>
599 <tgroup cols="3" align="left">
600 &cs-str;
601 <thead>
602 <row>
603 <entry>Color</entry>
604 <entry>x</entry>
605 <entry>y</entry>
606 </row>
607 </thead>
608 <tbody valign="top">
609 <row>
610 <entry>Red</entry>
611 <entry>0.630</entry>
612 <entry>0.340</entry>
613 </row>
614 <row>
615 <entry>Green</entry>
616 <entry>0.310</entry>
617 <entry>0.595</entry>
618 </row>
619 <row>
620 <entry>Blue</entry>
621 <entry>0.155</entry>
622 <entry>0.070</entry>
623 </row>
624 <row>
625 <entry>White Reference (D65)</entry>
626 <entry>0.3127</entry>
627 <entry>0.3290</entry>
628 </row>
629 </tbody>
630 </tgroup>
631 </table>
632 <para>The red, green and blue chromaticities are also often referred to
633as the SMPTE C set, so this colorspace is sometimes called SMPTE C as well.</para>
634 <variablelist>
635 <varlistentry>
636 <term>The transfer function defined for SMPTE 170M is the same as the
637one defined in Rec. 709. Normally L is in the range [0&hellip;1], but for the extended
638gamut xvYCC encoding values outside that range are allowed.</term>
639 <listitem>
640 <para>L' = -1.099(-L)<superscript>0.45</superscript>&nbsp;+&nbsp;0.099&nbsp;for&nbsp;L&nbsp;&le;&nbsp;-0.018</para>
641 <para>L' = 4.5L&nbsp;for&nbsp;-0.018&nbsp;&lt;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
642 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;L&nbsp;&ge;&nbsp;0.018</para>
643 </listitem>
644 </varlistentry>
645 </variablelist>
646 <variablelist>
647 <varlistentry>
648 <term>Inverse Transfer function:</term>
649 <listitem>
650 <para>L = -((L'&nbsp;-&nbsp;0.099)&nbsp;/&nbsp;-1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&le;&nbsp;-0.081</para>
651 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;-0.081&nbsp;&lt;&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
652 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
653 </listitem>
654 </varlistentry>
655 </variablelist>
656 <variablelist>
657 <varlistentry>
658 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with
659the following <constant>V4L2_YCBCR_ENC_601</constant> encoding:</term>
660 <listitem>
661 <para>Y'&nbsp;=&nbsp;0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B'</para>
662 <para>Cb&nbsp;=&nbsp;-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B'</para>
663 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B'</para>
664 </listitem>
665 </varlistentry>
666 </variablelist>
667 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
668clamped to the range [-0.5&hellip;0.5]. This conversion to Y'CbCr is identical to the one
669defined in the <xref linkend="itu601" /> standard and this colorspace is sometimes called BT.601 as well, even
670though BT.601 does not mention any color primaries.</para>
671 <para>The default quantization is limited range, but full range is possible although
672rarely seen.</para>
673 <para>The <constant>V4L2_YCBCR_ENC_601</constant> encoding as described above is the
674default for this colorspace, but it can be overridden with <constant>V4L2_YCBCR_ENC_709</constant>,
675in which case the Rec. 709 Y'CbCr encoding is used.</para>
676 <variablelist>
677 <varlistentry>
678 <term>The xvYCC 601 encoding (<constant>V4L2_YCBCR_ENC_XV601</constant>, <xref linkend="xvycc" />) is similar
679to the BT.601 encoding, but it allows for R', G' and B' values that are outside the range
680[0&hellip;1]. The resulting Y', Cb and Cr values are scaled and offset:</term>
681 <listitem>
682 <para>Y'&nbsp;=&nbsp;(219&nbsp;/&nbsp;255)&nbsp;*&nbsp;(0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B')&nbsp;+&nbsp;(16&nbsp;/&nbsp;255)</para>
683 <para>Cb&nbsp;=&nbsp;(224&nbsp;/&nbsp;255)&nbsp;*&nbsp;(-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B')</para>
684 <para>Cr&nbsp;=&nbsp;(224&nbsp;/&nbsp;255)&nbsp;*&nbsp;(0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B')</para>
685 </listitem>
686 </varlistentry>
687 </variablelist>
688 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are clamped
689to the range [-0.5&hellip;0.5]. The non-standard xvYCC 709 encoding can also be used by selecting
690<constant>V4L2_YCBCR_ENC_XV709</constant>. The xvYCC encodings always use full range
691quantization.</para>
692 </section>
693
694 <section>
695 <title id="col-rec709">Colorspace Rec. 709 (<constant>V4L2_COLORSPACE_REC709</constant>)</title>
696 <para>The <xref linkend="itu709" /> standard defines the colorspace used by HDTV in general. The default
697Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_709</constant>. The default Y'CbCr quantization is
698limited range. The chromaticities of the primary colors and the white reference are:</para>
699 <table frame="none">
700 <title>Rec. 709 Chromaticities</title>
701 <tgroup cols="3" align="left">
702 &cs-str;
703 <thead>
704 <row>
705 <entry>Color</entry>
706 <entry>x</entry>
707 <entry>y</entry>
708 </row>
709 </thead>
710 <tbody valign="top">
711 <row>
712 <entry>Red</entry>
713 <entry>0.640</entry>
714 <entry>0.330</entry>
715 </row>
716 <row>
717 <entry>Green</entry>
718 <entry>0.300</entry>
719 <entry>0.600</entry>
720 </row>
721 <row>
722 <entry>Blue</entry>
723 <entry>0.150</entry>
724 <entry>0.060</entry>
725 </row>
726 <row>
727 <entry>White Reference (D65)</entry>
728 <entry>0.3127</entry>
729 <entry>0.3290</entry>
730 </row>
731 </tbody>
732 </tgroup>
733 </table>
734 <para>The full name of this standard is Rec. ITU-R BT.709-5.</para>
735 <variablelist>
736 <varlistentry>
737 <term>Transfer function. Normally L is in the range [0&hellip;1], but for the extended
738gamut xvYCC encoding values outside that range are allowed.</term>
739 <listitem>
740 <para>L' = -1.099(-L)<superscript>0.45</superscript>&nbsp;+&nbsp;0.099&nbsp;for&nbsp;L&nbsp;&le;&nbsp;-0.018</para>
741 <para>L' = 4.5L&nbsp;for&nbsp;-0.018&nbsp;&lt;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
742 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;L&nbsp;&ge;&nbsp;0.018</para>
743 </listitem>
744 </varlistentry>
745 </variablelist>
746 <variablelist>
747 <varlistentry>
748 <term>Inverse Transfer function:</term>
749 <listitem>
750 <para>L = -((L'&nbsp;-&nbsp;0.099)&nbsp;/&nbsp;-1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&le;&nbsp;-0.081</para>
751 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;-0.081&nbsp;&lt;&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
752 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
753 </listitem>
754 </varlistentry>
755 </variablelist>
756 <variablelist>
757 <varlistentry>
758 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the following
759<constant>V4L2_YCBCR_ENC_709</constant> encoding:</term>
760 <listitem>
761 <para>Y'&nbsp;=&nbsp;0.2126R'&nbsp;+&nbsp;0.7152G'&nbsp;+&nbsp;0.0722B'</para>
762 <para>Cb&nbsp;=&nbsp;-0.1146R'&nbsp;-&nbsp;0.3854G'&nbsp;+&nbsp;0.5B'</para>
763 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.4542G'&nbsp;-&nbsp;0.0458B'</para>
764 </listitem>
765 </varlistentry>
766 </variablelist>
767 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
768clamped to the range [-0.5&hellip;0.5].</para>
769 <para>The default quantization is limited range, but full range is possible although
770rarely seen.</para>
771 <para>The <constant>V4L2_YCBCR_ENC_709</constant> encoding described above is the default
772for this colorspace, but it can be overridden with <constant>V4L2_YCBCR_ENC_601</constant>, in which
773case the BT.601 Y'CbCr encoding is used.</para>
774 <variablelist>
775 <varlistentry>
776 <term>The xvYCC 709 encoding (<constant>V4L2_YCBCR_ENC_XV709</constant>, <xref linkend="xvycc" />)
777is similar to the Rec. 709 encoding, but it allows for R', G' and B' values that are outside the range
778[0&hellip;1]. The resulting Y', Cb and Cr values are scaled and offset:</term>
779 <listitem>
780 <para>Y'&nbsp;=&nbsp;(219&nbsp;/&nbsp;255)&nbsp;*&nbsp;(0.2126R'&nbsp;+&nbsp;0.7152G'&nbsp;+&nbsp;0.0722B')&nbsp;+&nbsp;(16&nbsp;/&nbsp;255)</para>
781 <para>Cb&nbsp;=&nbsp;(224&nbsp;/&nbsp;255)&nbsp;*&nbsp;(-0.1146R'&nbsp;-&nbsp;0.3854G'&nbsp;+&nbsp;0.5B')</para>
782 <para>Cr&nbsp;=&nbsp;(224&nbsp;/&nbsp;255)&nbsp;*&nbsp;(0.5R'&nbsp;-&nbsp;0.4542G'&nbsp;-&nbsp;0.0458B')</para>
783 </listitem>
784 </varlistentry>
785 </variablelist>
786 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are clamped
787to the range [-0.5&hellip;0.5]. The non-standard xvYCC 601 encoding can also be used by
788selecting <constant>V4L2_YCBCR_ENC_XV601</constant>. The xvYCC encodings always use full
789range quantization.</para>
790 </section>
791
792 <section>
793 <title id="col-srgb">Colorspace sRGB (<constant>V4L2_COLORSPACE_SRGB</constant>)</title>
794 <para>The <xref linkend="srgb" /> standard defines the colorspace used by most webcams and computer graphics. The
795default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_SYCC</constant>. The default Y'CbCr quantization
796is full range. The chromaticities of the primary colors and the white reference are:</para>
797 <table frame="none">
798 <title>sRGB Chromaticities</title>
799 <tgroup cols="3" align="left">
800 &cs-str;
801 <thead>
802 <row>
803 <entry>Color</entry>
804 <entry>x</entry>
805 <entry>y</entry>
806 </row>
807 </thead>
808 <tbody valign="top">
809 <row>
810 <entry>Red</entry>
811 <entry>0.640</entry>
812 <entry>0.330</entry>
813 </row>
814 <row>
815 <entry>Green</entry>
816 <entry>0.300</entry>
817 <entry>0.600</entry>
818 </row>
819 <row>
820 <entry>Blue</entry>
821 <entry>0.150</entry>
822 <entry>0.060</entry>
823 </row>
824 <row>
825 <entry>White Reference (D65)</entry>
826 <entry>0.3127</entry>
827 <entry>0.3290</entry>
828 </row>
829 </tbody>
830 </tgroup>
831 </table>
832 <para>These chromaticities are identical to the Rec. 709 colorspace.</para>
833 <variablelist>
834 <varlistentry>
835 <term>Transfer function. Note that negative values for L are only used by the Y'CbCr conversion.</term>
836 <listitem>
837 <para>L' = -1.055(-L)<superscript>1/2.4</superscript>&nbsp;+&nbsp;0.055&nbsp;for&nbsp;L&nbsp;&lt;&nbsp;-0.0031308</para>
838 <para>L' = 12.92L&nbsp;for&nbsp;-0.0031308&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;0.0031308</para>
839 <para>L' = 1.055L<superscript>1/2.4</superscript>&nbsp;-&nbsp;0.055&nbsp;for&nbsp;0.0031308&nbsp;&lt;&nbsp;L&nbsp;&le;&nbsp;1</para>
840 </listitem>
841 </varlistentry>
842 <varlistentry>
843 <term>Inverse Transfer function:</term>
844 <listitem>
845 <para>L = -((-L'&nbsp;+&nbsp;0.055)&nbsp;/&nbsp;1.055)<superscript>2.4</superscript>&nbsp;for&nbsp;L'&nbsp;&lt;&nbsp;-0.04045</para>
846 <para>L = L'&nbsp;/&nbsp;12.92&nbsp;for&nbsp;-0.04045&nbsp;&le;&nbsp;L'&nbsp;&le;&nbsp;0.04045</para>
847 <para>L = ((L'&nbsp;+&nbsp;0.055)&nbsp;/&nbsp;1.055)<superscript>2.4</superscript>&nbsp;for&nbsp;L'&nbsp;&gt;&nbsp;0.04045</para>
848 </listitem>
849 </varlistentry>
850 </variablelist>
851 <variablelist>
852 <varlistentry>
853 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the following
854<constant>V4L2_YCBCR_ENC_SYCC</constant> encoding as defined by <xref linkend="sycc" />:</term>
855 <listitem>
856 <para>Y'&nbsp;=&nbsp;0.2990R'&nbsp;+&nbsp;0.5870G'&nbsp;+&nbsp;0.1140B'</para>
857 <para>Cb&nbsp;=&nbsp;-0.1687R'&nbsp;-&nbsp;0.3313G'&nbsp;+&nbsp;0.5B'</para>
858 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.4187G'&nbsp;-&nbsp;0.0813B'</para>
859 </listitem>
860 </varlistentry>
861 </variablelist>
862 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are clamped
863to the range [-0.5&hellip;0.5]. The <constant>V4L2_YCBCR_ENC_SYCC</constant> quantization is always
864full range. Although this Y'CbCr encoding looks very similar to the <constant>V4L2_YCBCR_ENC_XV601</constant>
865encoding, it is not. The <constant>V4L2_YCBCR_ENC_XV601</constant> scales and offsets the Y'CbCr
866values before quantization, but this encoding does not do that.</para>
867 </section>
868
869 <section>
870 <title id="col-adobergb">Colorspace Adobe RGB (<constant>V4L2_COLORSPACE_ADOBERGB</constant>)</title>
871 <para>The <xref linkend="adobergb" /> standard defines the colorspace used by computer graphics
872that use the AdobeRGB colorspace. This is also known as the <xref linkend="oprgb" /> standard.
873The default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_601</constant>. The default Y'CbCr
874quantization is limited range. The chromaticities of the primary colors and the white reference
875are:</para>
876 <table frame="none">
877 <title>Adobe RGB Chromaticities</title>
878 <tgroup cols="3" align="left">
879 &cs-str;
880 <thead>
881 <row>
882 <entry>Color</entry>
883 <entry>x</entry>
884 <entry>y</entry>
885 </row>
886 </thead>
887 <tbody valign="top">
888 <row>
889 <entry>Red</entry>
890 <entry>0.6400</entry>
891 <entry>0.3300</entry>
892 </row>
893 <row>
894 <entry>Green</entry>
895 <entry>0.2100</entry>
896 <entry>0.7100</entry>
897 </row>
898 <row>
899 <entry>Blue</entry>
900 <entry>0.1500</entry>
901 <entry>0.0600</entry>
902 </row>
903 <row>
904 <entry>White Reference (D65)</entry>
905 <entry>0.3127</entry>
906 <entry>0.3290</entry>
907 </row>
908 </tbody>
909 </tgroup>
910 </table>
911 <variablelist>
912 <varlistentry>
913 <term>Transfer function:</term>
914 <listitem>
915 <para>L' = L<superscript>1/2.19921875</superscript></para>
916 </listitem>
917 </varlistentry>
918 <varlistentry>
919 <term>Inverse Transfer function:</term>
920 <listitem>
921 <para>L = L'<superscript>2.19921875</superscript></para>
922 </listitem>
923 </varlistentry>
924 </variablelist>
925 <variablelist>
926 <varlistentry>
927 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
928following <constant>V4L2_YCBCR_ENC_601</constant> encoding:</term>
929 <listitem>
930 <para>Y'&nbsp;=&nbsp;0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B'</para>
931 <para>Cb&nbsp;=&nbsp;-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B'</para>
932 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B'</para>
933 </listitem>
934 </varlistentry>
935 </variablelist>
936 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
937clamped to the range [-0.5&hellip;0.5]. This transform is identical to one defined in
938SMPTE 170M/BT.601. The Y'CbCr quantization is limited range.</para>
939 </section>
940
941 <section>
942 <title id="col-bt2020">Colorspace BT.2020 (<constant>V4L2_COLORSPACE_BT2020</constant>)</title>
943 <para>The <xref linkend="itu2020" /> standard defines the colorspace used by Ultra-high definition
944television (UHDTV). The default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_BT2020</constant>.
945The default Y'CbCr quantization is limited range. The chromaticities of the primary colors and
946the white reference are:</para>
947 <table frame="none">
948 <title>BT.2020 Chromaticities</title>
949 <tgroup cols="3" align="left">
950 &cs-str;
951 <thead>
952 <row>
953 <entry>Color</entry>
954 <entry>x</entry>
955 <entry>y</entry>
956 </row>
957 </thead>
958 <tbody valign="top">
959 <row>
960 <entry>Red</entry>
961 <entry>0.708</entry>
962 <entry>0.292</entry>
963 </row>
964 <row>
965 <entry>Green</entry>
966 <entry>0.170</entry>
967 <entry>0.797</entry>
968 </row>
969 <row>
970 <entry>Blue</entry>
971 <entry>0.131</entry>
972 <entry>0.046</entry>
973 </row>
974 <row>
975 <entry>White Reference (D65)</entry>
976 <entry>0.3127</entry>
977 <entry>0.3290</entry>
978 </row>
979 </tbody>
980 </tgroup>
981 </table>
982 <variablelist>
983 <varlistentry>
984 <term>Transfer function (same as Rec. 709):</term>
985 <listitem>
986 <para>L' = 4.5L&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
987 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;1</para>
988 </listitem>
989 </varlistentry>
990 <varlistentry>
991 <term>Inverse Transfer function:</term>
992 <listitem>
993 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
994 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
995 </listitem>
996 </varlistentry>
997 </variablelist>
998 <variablelist>
999 <varlistentry>
1000 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
1001following <constant>V4L2_YCBCR_ENC_BT2020</constant> encoding:</term>
1002 <listitem>
1003 <para>Y'&nbsp;=&nbsp;0.2627R'&nbsp;+&nbsp;0.6789G'&nbsp;+&nbsp;0.0593B'</para>
1004 <para>Cb&nbsp;=&nbsp;-0.1396R'&nbsp;-&nbsp;0.3604G'&nbsp;+&nbsp;0.5B'</para>
1005 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.4598G'&nbsp;-&nbsp;0.0402B'</para>
1006 </listitem>
1007 </varlistentry>
1008 </variablelist>
1009 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
1010clamped to the range [-0.5&hellip;0.5]. The Y'CbCr quantization is limited range.</para>
1011 <para>There is also an alternate constant luminance R'G'B' to Yc'CbcCrc
1012(<constant>V4L2_YCBCR_ENC_BT2020_CONST_LUM</constant>) encoding:</para>
1013 <variablelist>
1014 <varlistentry>
1015 <term>Luma:</term>
1016 <listitem>
1017 <para>Yc'&nbsp;=&nbsp;(0.2627R&nbsp;+&nbsp;0.6789G&nbsp;+&nbsp;0.0593B)'</para>
1018 </listitem>
1019 </varlistentry>
1020 </variablelist>
1021 <variablelist>
1022 <varlistentry>
1023 <term>B'&nbsp;-&nbsp;Yc'&nbsp;&le;&nbsp;0:</term>
1024 <listitem>
1025 <para>Cbc&nbsp;=&nbsp;(B'&nbsp;-&nbsp;Y')&nbsp;/&nbsp;1.9404</para>
1026 </listitem>
1027 </varlistentry>
1028 </variablelist>
1029 <variablelist>
1030 <varlistentry>
1031 <term>B'&nbsp;-&nbsp;Yc'&nbsp;&gt;&nbsp;0:</term>
1032 <listitem>
1033 <para>Cbc&nbsp;=&nbsp;(B'&nbsp;-&nbsp;Y')&nbsp;/&nbsp;1.5816</para>
1034 </listitem>
1035 </varlistentry>
1036 </variablelist>
1037 <variablelist>
1038 <varlistentry>
1039 <term>R'&nbsp;-&nbsp;Yc'&nbsp;&le;&nbsp;0:</term>
1040 <listitem>
1041 <para>Crc&nbsp;=&nbsp;(R'&nbsp;-&nbsp;Y')&nbsp;/&nbsp;1.7184</para>
1042 </listitem>
1043 </varlistentry>
1044 </variablelist>
1045 <variablelist>
1046 <varlistentry>
1047 <term>R'&nbsp;-&nbsp;Yc'&nbsp;&gt;&nbsp;0:</term>
1048 <listitem>
1049 <para>Crc&nbsp;=&nbsp;(R'&nbsp;-&nbsp;Y')&nbsp;/&nbsp;0.9936</para>
1050 </listitem>
1051 </varlistentry>
1052 </variablelist>
1053 <para>Yc' is clamped to the range [0&hellip;1] and Cbc and Crc are
1054clamped to the range [-0.5&hellip;0.5]. The Yc'CbcCrc quantization is limited range.</para>
1055 </section>
1056
1057 <section>
1058 <title id="col-smpte-240m">Colorspace SMPTE 240M (<constant>V4L2_COLORSPACE_SMPTE240M</constant>)</title>
1059 <para>The <xref linkend="smpte240m" /> standard was an interim standard used during the early days of HDTV (1988-1998).
1060It has been superseded by Rec. 709. The default Y'CbCr encoding is <constant>V4L2_YCBCR_ENC_SMPTE240M</constant>.
1061The default Y'CbCr quantization is limited range. The chromaticities of the primary colors and the
1062white reference are:</para>
1063 <table frame="none">
1064 <title>SMPTE 240M Chromaticities</title>
1065 <tgroup cols="3" align="left">
1066 &cs-str;
1067 <thead>
1068 <row>
1069 <entry>Color</entry>
1070 <entry>x</entry>
1071 <entry>y</entry>
1072 </row>
1073 </thead>
1074 <tbody valign="top">
1075 <row>
1076 <entry>Red</entry>
1077 <entry>0.630</entry>
1078 <entry>0.340</entry>
1079 </row>
1080 <row>
1081 <entry>Green</entry>
1082 <entry>0.310</entry>
1083 <entry>0.595</entry>
1084 </row>
1085 <row>
1086 <entry>Blue</entry>
1087 <entry>0.155</entry>
1088 <entry>0.070</entry>
1089 </row>
1090 <row>
1091 <entry>White Reference (D65)</entry>
1092 <entry>0.3127</entry>
1093 <entry>0.3290</entry>
1094 </row>
1095 </tbody>
1096 </tgroup>
1097 </table>
1098 <para>These chromaticities are identical to the SMPTE 170M colorspace.</para>
1099 <variablelist>
1100 <varlistentry>
1101 <term>Transfer function:</term>
1102 <listitem>
1103 <para>L' = 4L&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L&nbsp;&lt;&nbsp;0.0228</para>
1104 <para>L' = 1.1115L<superscript>0.45</superscript>&nbsp;-&nbsp;0.1115&nbsp;for&nbsp;0.0228&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;1</para>
1105 </listitem>
1106 </varlistentry>
1107 <varlistentry>
1108 <term>Inverse Transfer function:</term>
1109 <listitem>
1110 <para>L = L'&nbsp;/&nbsp;4&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L'&nbsp;&lt;&nbsp;0.0913</para>
1111 <para>L = ((L'&nbsp;+&nbsp;0.1115)&nbsp;/&nbsp;1.1115)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.0913</para>
1112 </listitem>
1113 </varlistentry>
1114 </variablelist>
1115 <variablelist>
1116 <varlistentry>
1117 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
1118following <constant>V4L2_YCBCR_ENC_SMPTE240M</constant> encoding:</term>
1119 <listitem>
1120 <para>Y'&nbsp;=&nbsp;0.2122R'&nbsp;+&nbsp;0.7013G'&nbsp;+&nbsp;0.0865B'</para>
1121 <para>Cb&nbsp;=&nbsp;-0.1161R'&nbsp;-&nbsp;0.3839G'&nbsp;+&nbsp;0.5B'</para>
1122 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.4451G'&nbsp;-&nbsp;0.0549B'</para>
1123 </listitem>
1124 </varlistentry>
1125 </variablelist>
1126 <para>Yc' is clamped to the range [0&hellip;1] and Cbc and Crc are
1127clamped to the range [-0.5&hellip;0.5]. The Y'CbCr quantization is limited range.</para>
1128 </section>
1129
1130 <section>
1131 <title id="col-sysm">Colorspace NTSC 1953 (<constant>V4L2_COLORSPACE_470_SYSTEM_M</constant>)</title>
1132 <para>This standard defines the colorspace used by NTSC in 1953. In practice this
1133colorspace is obsolete and SMPTE 170M should be used instead. The default Y'CbCr encoding
1134is <constant>V4L2_YCBCR_ENC_601</constant>. The default Y'CbCr quantization is limited range.
1135The chromaticities of the primary colors and the white reference are:</para>
1136 <table frame="none">
1137 <title>NTSC 1953 Chromaticities</title>
1138 <tgroup cols="3" align="left">
1139 &cs-str;
1140 <thead>
1141 <row>
1142 <entry>Color</entry>
1143 <entry>x</entry>
1144 <entry>y</entry>
1145 </row>
1146 </thead>
1147 <tbody valign="top">
1148 <row>
1149 <entry>Red</entry>
1150 <entry>0.67</entry>
1151 <entry>0.33</entry>
1152 </row>
1153 <row>
1154 <entry>Green</entry>
1155 <entry>0.21</entry>
1156 <entry>0.71</entry>
1157 </row>
1158 <row>
1159 <entry>Blue</entry>
1160 <entry>0.14</entry>
1161 <entry>0.08</entry>
1162 </row>
1163 <row>
1164 <entry>White Reference (C)</entry>
1165 <entry>0.310</entry>
1166 <entry>0.316</entry>
1167 </row>
1168 </tbody>
1169 </tgroup>
1170 </table>
1171 <para>Note that this colorspace uses Illuminant C instead of D65 as the
1172white reference. To correctly convert an image in this colorspace to another
1173that uses D65 you need to apply a chromatic adaptation algorithm such as the
1174Bradford method.</para>
1175 <variablelist>
1176 <varlistentry>
1177 <term>The transfer function was never properly defined for NTSC 1953. The
1178Rec. 709 transfer function is recommended in the literature:</term>
1179 <listitem>
1180 <para>L' = 4.5L&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
1181 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;1</para>
1182 </listitem>
1183 </varlistentry>
1184 <varlistentry>
1185 <term>Inverse Transfer function:</term>
1186 <listitem>
1187 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
1188 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
1189 </listitem>
1190 </varlistentry>
1191 </variablelist>
1192 <variablelist>
1193 <varlistentry>
1194 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
1195following <constant>V4L2_YCBCR_ENC_601</constant> encoding:</term>
1196 <listitem>
1197 <para>Y'&nbsp;=&nbsp;0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B'</para>
1198 <para>Cb&nbsp;=&nbsp;-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B'</para>
1199 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B'</para>
1200 </listitem>
1201 </varlistentry>
1202 </variablelist>
1203 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
1204clamped to the range [-0.5&hellip;0.5]. The Y'CbCr quantization is limited range.
1205This transform is identical to one defined in SMPTE 170M/BT.601.</para>
1206 </section>
1207
1208 <section>
1209 <title id="col-sysbg">Colorspace EBU Tech. 3213 (<constant>V4L2_COLORSPACE_470_SYSTEM_BG</constant>)</title>
1210 <para>The <xref linkend="tech3213" /> standard defines the colorspace used by PAL/SECAM in 1975. In practice this
1211colorspace is obsolete and SMPTE 170M should be used instead. The default Y'CbCr encoding
1212is <constant>V4L2_YCBCR_ENC_601</constant>. The default Y'CbCr quantization is limited range.
1213The chromaticities of the primary colors and the white reference are:</para>
1214 <table frame="none">
1215 <title>EBU Tech. 3213 Chromaticities</title>
1216 <tgroup cols="3" align="left">
1217 &cs-str;
1218 <thead>
1219 <row>
1220 <entry>Color</entry>
1221 <entry>x</entry>
1222 <entry>y</entry>
1223 </row>
1224 </thead>
1225 <tbody valign="top">
1226 <row>
1227 <entry>Red</entry>
1228 <entry>0.64</entry>
1229 <entry>0.33</entry>
1230 </row>
1231 <row>
1232 <entry>Green</entry>
1233 <entry>0.29</entry>
1234 <entry>0.60</entry>
1235 </row>
1236 <row>
1237 <entry>Blue</entry>
1238 <entry>0.15</entry>
1239 <entry>0.06</entry>
1240 </row>
1241 <row>
1242 <entry>White Reference (D65)</entry>
1243 <entry>0.3127</entry>
1244 <entry>0.3290</entry>
1245 </row>
1246 </tbody>
1247 </tgroup>
1248 </table>
1249 <variablelist>
1250 <varlistentry>
1251 <term>The transfer function was never properly defined for this colorspace.
1252The Rec. 709 transfer function is recommended in the literature:</term>
1253 <listitem>
1254 <para>L' = 4.5L&nbsp;for&nbsp;0&nbsp;&le;&nbsp;L&nbsp;&lt;&nbsp;0.018</para>
1255 <para>L' = 1.099L<superscript>0.45</superscript>&nbsp;-&nbsp;0.099&nbsp;for&nbsp;0.018&nbsp;&le;&nbsp;L&nbsp;&le;&nbsp;1</para>
1256 </listitem>
1257 </varlistentry>
1258 <varlistentry>
1259 <term>Inverse Transfer function:</term>
1260 <listitem>
1261 <para>L = L'&nbsp;/&nbsp;4.5&nbsp;for&nbsp;L'&nbsp;&lt;&nbsp;0.081</para>
1262 <para>L = ((L'&nbsp;+&nbsp;0.099)&nbsp;/&nbsp;1.099)<superscript>1/0.45</superscript>&nbsp;for&nbsp;L'&nbsp;&ge;&nbsp;0.081</para>
1263 </listitem>
1264 </varlistentry>
1265 </variablelist>
1266 <variablelist>
1267 <varlistentry>
1268 <term>The luminance (Y') and color difference (Cb and Cr) are obtained with the
1269following <constant>V4L2_YCBCR_ENC_601</constant> encoding:</term>
1270 <listitem>
1271 <para>Y'&nbsp;=&nbsp;0.299R'&nbsp;+&nbsp;0.587G'&nbsp;+&nbsp;0.114B'</para>
1272 <para>Cb&nbsp;=&nbsp;-0.169R'&nbsp;-&nbsp;0.331G'&nbsp;+&nbsp;0.5B'</para>
1273 <para>Cr&nbsp;=&nbsp;0.5R'&nbsp;-&nbsp;0.419G'&nbsp;-&nbsp;0.081B'</para>
1274 </listitem>
1275 </varlistentry>
1276 </variablelist>
1277 <para>Y' is clamped to the range [0&hellip;1] and Cb and Cr are
1278clamped to the range [-0.5&hellip;0.5]. The Y'CbCr quantization is limited range.
1279This transform is identical to one defined in SMPTE 170M/BT.601.</para>
1280 </section>
1281
1282 <section>
1283 <title id="col-jpeg">Colorspace JPEG (<constant>V4L2_COLORSPACE_JPEG</constant>)</title>
1284 <para>This colorspace defines the colorspace used by most (Motion-)JPEG formats. The chromaticities
1285of the primary colors and the white reference are identical to sRGB. The Y'CbCr encoding is
1286<constant>V4L2_YCBCR_ENC_601</constant> with full range quantization where
1287Y' is scaled to [0&hellip;255] and Cb/Cr are scaled to [-128&hellip;128] and
1288then clipped to [-128&hellip;127].</para>
1289 <para>Note that the JPEG standard does not actually store colorspace information.
1290So if something other than sRGB is used, then the driver will have to set that information
1291explicitly. Effectively <constant>V4L2_COLORSPACE_JPEG</constant> can be considered to be
1292an abbreviation for <constant>V4L2_COLORSPACE_SRGB</constant>, <constant>V4L2_YCBCR_ENC_601</constant>
1293and <constant>V4L2_QUANTIZATION_FULL_RANGE</constant>.</para>
1294 </section>
1295
636 </section> 1296 </section>
637 1297
638 <section id="pixfmt-indexed"> 1298 <section id="pixfmt-indexed">