How to calculate the video overlay size? (xf86-video-geode & xf86-video-ati)

Cui, Hunk Hunk.Cui at amd.com
Thu Aug 12 03:15:26 PDT 2010


Hi, Alex,

> > In xf86-video-geode:
> >        lx_video.c -> LXCopyPlanar function, some codes make me confuse,
> >
> > (
> > http://cgit.freedesktop.org/xorg/driver/xf86-video-geode/tree/src/lx_vid
> > eo.c#n224 )
> >    YSrcPitch = (width + 3) & ~3;
> >    YDstPitch = (width + 31) & ~31;
> >
> >    UVSrcPitch = ((width >> 1) + 3) & ~3;
> >    UVDstPitch = ((width >> 1) + 15) & ~15;
> >
> >    USrcOffset = YSrcPitch * height;
> >    VSrcOffset = USrcOffset + (UVSrcPitch * (height >> 1));
> >
> >    UDstOffset = YDstPitch * height;
> >    VDstOffset = UDstOffset + (UVDstPitch * (height >> 1));
> >
> >    size = YDstPitch * height;
> >    size += UVDstPitch * height;
> >
> > What is the formula for reference?
> 
> See http://fourcc.org/
> 
> > How to define and calculate the YDstPitch and UVDstPitch?
> 
> Planar formats store the YUV data in separate planes rather than
> packed as pixel tuples.  Depending on the format the UV portion has
> half the resolution as the Y component.

	Could you give me some more example to explain this? Confuse about "UVDstPitch = ((width >> 1) + 15) & ~15;" 
	Why the UV portion need to the half of the resolution as the Y portion?

Thanks,
Hunk Cui 



More information about the xorg-devel mailing list