[Theora-dev] yuv2rgb

Timothy B. Terriberry tterribe at vt.edu
Thu Dec 9 00:21:26 PST 2004


Alen Ladavac wrote:
> Here are some usefull references:
> 
> a) checkout http://www.fourcc.org/yuv.php
> b) search for "Video Rendering with 8-Bit YUV Formats" on
> http://msdn.microsoft.com/library
> 
> To help you filter the information you are interested in, the format that
> theora uses internally is officially called YV12.
> 
> That's regarding the color format. I hope you understand the image layout
> tricks with negative strides etc.

I would ignore FOURCC codes altogether. They both overspecify things 
like memory layout that do not apply to the libtheora API and 
underspecify things like chroma siting locations, RGB primaries, etc.

Step 1 to understanding video colorspaces: there is no such space as YUV.

Alen nicely proves the point of why you should never use the term by 
suggesting Theora uses YV12. Theora uses Y'CbCr, however most (but not 
all) interpretations of YV12 really mean Y'CrCb, with the chroma 
components swapped. Unlike U and V, Cb and Cr have an unambiguous 
interpretation. In the current libtheora API, U corresponds to Cb and V 
corresponds to Cr (future API revisions will hopefully fix this to refer 
to them as Cb and Cr directly).

Step 2: There is more than one RGB space.
The red, green, and blue primaries in your television are not the same 
as in your monitor. They're not even the same between NTSC and PAL 
televisions. Know what your target is and use the right conversion.

Having said that, Chapter 4 of the Theora spec 
(http://www.theora.org/doc/Theora_I_spec.pdf) provides explicit detail 
on the exact colorspaces Theora supports, and how to convert between them.


More information about the Theora-dev mailing list