[Theora] problems understanding yuv_buffer format

David Kment davidkment at web.de
Wed Sep 28 07:34:09 PDT 2005

Paul Foley wrote:

>How about using ImageMagick's "convert" utility to turn it into an PPM
>or PNG or whatever's most useful to you?
i need conversion during runtime, so this is not an option.

>Assume you have a 640x480 frame.  There are then 307200 (=640×480)
>bytes of Y data followed by 76800 (=320×240) bytes of U data followed
>by 76800 bytes of V data.
>A "plane" is just one set of data - the Y or the U or the V.  It would
>be possible to have them interspersed: one pixel or Y followed by one
>pixel of U followed by one pixel of V, or one scan-line of Y followed
>by one scan-line of U, ..., so then there would be no planes.
ok, thanks,. this information is really useful!

>>what i want to achieve is getting the Y, U and V data for each single 
>>pixel, so i can convert it to one R, G and B value.
>If you just use the Y data, you get a nice grayscale image.
hmm, this sounds very interesting for a start. i tried it, by simply 
copying the Y array to
a file, and viewed it in IrfanView. it worked somewhat, since the 
picture was recognizable, but it was garbled and repeated on itself, 

this would mean the pixels are not in a perfect row (like expected from 
e.g. a raw RGB buffer). so i need to find out how they are positioned.
can i at least assume that a straight line of pixels (euqaling a stride, 
so exactly the frames width) is always non-interrupted, so i can take it 
the way it is without modifying?

More information about the Theora mailing list