Re: gdk_pixbuf_rotate_simple



ma, 14-10-2002 kello 12:41, Sven Neumann kirjoitti:
> I'd suggest to replace the calls to memcpy() by direct assignments;
> this should give a significant speed improvement. You should also
> consider to write separate functions for the 3 and 4 byte per channel
> cases in order to move the if-clause out of the inner loop. The 4-byte
> case can then be rewritten using 32bit access to the pixel data.

I did this. Doing gdk_pixbuf_rotate_simple for an 180 degree rotation
1000 times with a 600 by 400 pixel image took 20 seconds before and 6
seconds afterward. On the other hand, the code is somewhat less clear
now, since I resorted to preprocessor trickery.

The new function is at
http://liw.iki.fi/liw/gdk-pixbuf-rotate/gdk-pixbuf-rotate.c and inside
http://liw.iki.fi/liw/gdk-pixbuf-rotate/gdk-pixbuf-rotate-2.tar.gz .

The original code is in
http://liw.iki.fi/liw/gdk-pixbuf-rotate/gdk-pixbuf-rotate-1.tar.gz if
you wish to compare.

(I'm not subscribed to gtk-devel-list, please Cc. Thanks.)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]