[cairo] Pixman "convolution" filter

Soeren Sandmann sandmann at daimi.au.dk
Mon Feb 15 13:15:45 PST 2010


cu <cairouser at yahoo.com> writes:

> In my never-ending quest for better image downscaling, I stumbled upon
> convolution filter in Pixman. It does not seem to be exposed in Cairo
> 1.8.8 and a naive method of "just enabling" it, using latest pixman
> 0.17.6 does not work - it results in a crash during
> bits_image_fetch_transformed() or thereabouts.
> 
> Does anyone know if 1) it works at all in any way and 2) if it works -
> would it provide a higher quality downscaling?

It does work. The likely reason it crashes for is that you passed in
(NULL, 0) for the filter parameters. The filter parameters have this
format:

        width
        height
        [width * height numbers]

where everything is in fixed-point. Together those specify a width x
height convolution kernel. What pixman does with that is that for each
pixel it centers the kernel on that pixel, and then it computes a
convolution.

It can be used to produce higher-quality downscaling, but the fact
that it snaps the kernel to source pixels and has no way of accessing
subpixels, means it has some limitations.

See this for more discussion about downscaling:

http://lists.cairographics.org/archives/cairo/2009-November/018600.html


Soren


More information about the cairo mailing list