Re: Speeding up thumbnail generation (like multi threaded). Thoughts please.



2009/8/28 Mark <markg85 gmail com>:
> static GdkPixbuf *
> scale_pixbuf_preserve_aspect_ratio (GdkPixbuf *pixbuf,
>                                    gint size,
>                                    GdkInterpType interp)

One more idea: this will be very slow for JPEGs (your use case, I think).

It will decode the whole file, then shrink. libjpeg supports
shrink-on-load where it only decompresses enough of the file to be
able to supply pixels at a certain size. In particular, libjpeg can do
a very quick load-at-1/8th-size read where it just decompresses enough
to be able to get the DC component of each 8x8 block. If you use
libjpeg like this you can expect around a 100x speedup of the
decompress step.

I have some code that does this lying around, I'll try to clean it up
and post it next week so you can test it. Or maybe glib does this
already? I know imagemagick uses this trick for it's thumbnailing (if
it didn't it'd be far slower than glib, heh).

John


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