[Pixman] Better quality downsampling in cairo/pixman

Jonathan Morton jonathan.morton at movial.com
Tue Jun 29 00:15:24 PDT 2010

> 2) How comes Gimp's linear is much like cubic?  Does it seem to do
> something more than just bilinear interpolation?

Nearest-neighbour filtering samples only one source pixel per
destination pixel.  Bilinear and bicubic filters both sample four
adjacent source pixels per destination pixel.  If the scale factor is
1:3 or beyond, source pixels will therefore be missed.

For high-quality scaling at extreme scale factors (as for thumbnails),
the filtering needs to take a number of samples which depends on the
scale factor.

> 3) I know from past experience that even bicubic can be faulty when it
> comes to downsampling by a factor of over 1/4.  I have solved this
> issue by using Lanczos (SinC) filter once.  Should we consider using
> this filter too?

Sinc filtering is indeed a high-quality technique.  It can also be rather slow.

Another technique which fulfils the requirements is plain old box
filtering.  This might be quicker for animation.  When the scale
factor is near 1:1 this needs to switch gracefully to bilinear, or
else it will look like nearest-neighbour.

 - Jonathan Morton

More information about the Pixman mailing list