[Theora] problems understanding yuv_buffer format
ogg at illiminable.com
Tue Sep 27 13:46:38 PDT 2005
----- Original Message -----
From: "David Kment" <davidkment at web.de>
To: <theora at xiph.org>
Sent: Wednesday, September 28, 2005 3:59 AM
Subject: [Theora] problems understanding yuv_buffer format
> hi folks!
> once again i am trying to decode a yuv_buffer to a 24 bit RGB buffer.
> last time nobody seemed willing to tell me how to do this, so i am trying
convert yuv to rgb into google and press i'm feeling lucky.
Also in here... if you look through the code here... you'll find various
conversions... primarily going RGB to YUV... but it also has diagrams of the
memory layouts of most of the different yuv formats in comments.
> i try to make my questions more simple. what i need to know is:
> how many bytes are in each y, u, v array?
Depends on the type of YUV... in theora's yuv_buffer, almost always
stride*height in y and stride*height/4 in each of u and v... look for info
on YV12... it's the fourcc format most similar to what theora uses.
> what for are these strides?
A stride is the width of a contiguous block of memory... eg if the width was
7... it might be advantageous to have the stride be 8 for various reasons...
so the extra byte is not used... basically the stride is the memory distance
between the start of each line.
> 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.
Well because of the way it's sampled, there will be a Y sample for every
pixel... but each U and V will be shared by four pixels
More information about the Theora