[gst-devel] Using cairo/pixman for raw video in GStreamer

Benjamin Otte otte at gnome.org
Mon Sep 14 15:57:38 CEST 2009


Stefan Kost <ensonic <at> hora-obscura.de> writes:

> But having read_pixel/write_pixel will be slow. How can that be
> optimized (and/or vectorized). If I recall right "graphics-drivers" for
> turbo pascal in dos worked that way and they were slow!
> 
As I said, pixman is very sophisticated. 

The first step is implementing the pixman_image ops - see
http://cgit.freedesktop.org/pixman/tree/pixman/pixman-private.h#n160 - I think
fetch_scanline_raw_32 and store_scanline_raw_32 are required, the rest can will
use defaults.
Once you've done that, all cairo ops work on this format. And it'll probably be
incredibly slow.

After that, you have a look at pixman_implementation_t - see
http://cgit.freedesktop.org/pixman/tree/pixman/pixman-private.h#n372 - and
realize that for every rendering operation, there is a vfunc that you can
implement specifically tuned for that operation. So you can make "AYUV OVER
I420" or "I420 SOURCE RGB" really fast and keep "YVU9 DIFFERENCE NV12" as slow
as you want.

Of course, that's a lot of work. So there's also steps in between, like the
ability to implement blit and fill function for simple copies or fills with a
single color - see
http://cgit.freedesktop.org/pixman/tree/pixman/pixman-private.h#n405 - which get
called automatically by the general functions.

Of course, those functions can be separately optimized for different
architectures - see
http://cgit.freedesktop.org/pixman/tree/pixman/pixman-arm-neon.c for an example
- so you can do all the optimizations you want.

So I fail to see any reason why some important code would be slow.

Benjamin





More information about the gstreamer-devel mailing list