[cairo] [Pixman] Better quality downsampling in cairo/pixman
sandmann at daimi.au.dk
Thu Jul 15 07:48:23 PDT 2010
Alexander Shulgin <alex.shulgin at gmail.com> writes:
> So if I understand correctly, Jeff's patch is good, but it's too
> specialized for resampling pixman images wholesale,
Basically, Jeff's patch only did scaling, but pixman supports
arbitrary transformations and we need resampling in those cases
too. It may be interesting to look into adding Jeff's code as fast
paths for scaling.
> while it would be better to make possible resampling for individual
> destination pixels when compositing?
Yeah, that's the general idea.
Right now, pixman_image_composite (src, mask, dest) works more or less
For each destination pixel, a transformed location in the source and
mask images is computed. Then, based on the filter attributes,
interpolated values are computed for those locations. Finally, those
values are composited together with the destination pixel and written
back to the destination.
We need to modify this algorithm to work like this:
For each destination pixel, several transformed source/mask
locations are computed corresponding to a subpixel grid in the
destination pixel. The interpolated values for these locations are
then averaged together before being composited.
> I'll try to use sample Emacs screenshots from my first mail in this
> thread for testing. Does anyone have any good samples to demonstrate
> resampling quality difference which I might find useful?
The emacs screenshot is an okay image to use since downscaling text
images is a fairly frequent use case. This one:
is also a good downscaling test because it is big image with lots of
The Adobe RGB test image is another one:
Finally, there is the zone plate, a well-known torture test for image
The attraction of this image is that it contains all representable
frequencies, so poor downscalers will tend to create strange Moire
More information about the cairo