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

Maarten Maathuis madman2003 at gmail.com
Thu Aug 12 03:22:42 PDT 2010


On Thu, Aug 12, 2010 at 12:15 PM, Cui, Hunk <Hunk.Cui at amd.com> wrote:
> 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?

That's because (some) YUV formats have 1 U and 1 V pixel per 4 Y
pixels, it's a way to save space. The grayscale is the most important
part, and the colors are lower resolution (this gives an effective 12
bits per pixel).

>
> Thanks,
> Hunk Cui
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>



-- 
Far away from the primal instinct, the song seems to fade away, the
river get wider between your thoughts and the things we do and say.


More information about the xorg-devel mailing list