[MPlayer-dev-eng] How do the YUV planes work?

Arpi arpi at thot.banki.hu
Sun Dec 16 19:28:51 CET 2001


Hi,

> 	When I initialize an RGB decoder, I malloc (width * height *
> bytes_per_pixel) for sh_video->our_out_buffer. When I decode video, the
> pixel data goes in that buffer, left-to-right, top-to-bottom. Also, the
> decoder sets blit_frame=3. When I get into planar YUV, I have to deal with
> variables that specify planes and strides, right? Do they somehow specify
> offsets into sh_video->our_out_buffer? I also have to set blit_frame=2,
> right?
For packed formats (YUY2, UYVY etc) it's teh same as for RGB, just the
meaning of the bits differ.
For planar formats (currently YV12 and I420==IYUV, these are 4:2:0 formats)
you have to append planes to a single buffer (forst the Y, then U and then
V) and make our_out_buffer to point to yur buffer and set blit_frame=3.
The other way is setting planes[] and stride[] values to your 3 planes and
their bytes_per_line values and set blit_frame=2

> 	I guess what I need to know is, how do I set up the buffers for
> YV12 data? How do I allocate sh_video->our_out_buffer, how do I set up
> planes and strides, and where do I output the Y, U, and V planes?

if you don't need any extra (i mean your Y,U,V planes are exactly the size
of the displayable image, no extra hidden stuff like macroblocks or UMC
area) then you can allocate single buffer and use teh our_out_buffer method.
if your codec has internal buffers (like most mpeg-like codecs) then you
codec can set the planes[] pointers to the current planes in its internal
buffer to be displayed (to avoid memcpy).


A'rpi / Astral & ESP-team

--
mailto:arpi at thot.banki.hu
http://esp-team.scene.hu



More information about the MPlayer-dev-eng mailing list