[Pixman] Better quality downsampling in cairo/pixman
Soeren Sandmann
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
like this:
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:
http://www.daimi.au.dk/~sandmann/house.jpg
is also a good downscaling test because it is big image with lots of
detail.
The Adobe RGB test image is another one:
http://www.calumetphoto.com/files/iccprofiles/icc-test-image.jpg
Finally, there is the zone plate, a well-known torture test for image
scalers:
http://www.sci.utah.edu/~cscheid/spr05/imageprocessing/project3/imgs/zone_plate.png
The attraction of this image is that it contains all representable
frequencies, so poor downscalers will tend to create strange Moire
patterns.
Soren
More information about the Pixman
mailing list