[cairo] Using cairo/pixman for raw video in GStreamer
sandmann at daimi.au.dk
Sun Sep 13 23:54:43 PDT 2009
All of this sounds good to me. Below are a few comments on how YUV
formats could be integrated in pixman.
> 1) Add extensive YUV support to pixman
Extensive YUV support would be a very useful addition to pixman. Apart
from the benefits you listed, I think it also makes sense to have YUV
support in XRender as a more powerful way of doing textured video than
Writing one pixel in a chroma subsampled format requires access to a
2x2 tile of RGB pixels, but the current general compositing only
provides one scanline.
A solution to that may be to move to a tiled architectured where
general_composite() processes destination tiles instead of
scanlines. This would require changing all the scanline accessors, but
hopefully that is a mostly mechanical process.
Aside from hopefully solving the subsampling problem, tiles would also
have better cache behavior for rotated or filtered sources.
* Format specification
Pixman already has some support for YUV formats:
PIXMAN_yuy2 = PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
PIXMAN_yv12 = PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
but you can't write to them because of the subsampling problem
mentioned above, and so there is pixman_format_supported_destination()
API. It was probably a mistake to add that API, and future formats
should always be supported for both reading and writing.
Having a pixman_format_type_t like PIXMAN_TYPE_YUY2 and TYPE_YV12 for
each video format is not going to scale, so we'll need some new scheme
to describe video formats. I don't know enough about video formats to
have an opinion on how to do this, but I don't think there is anything
particularly great about the two exisiting format codes, so hopefully
we can get away with deprecating them and respecifiying within the new
More information about the cairo