2013/6/4 Chris Wilson <chris@...2923...>:
On Sun, Mar 31, 2013 at 05:03:36AM +0200, Krzysztof Kosiński wrote:
Hello
I had a look at how complex would it be to add correct downscaling to Cairo now that Pixman supports convolution filters. It turns out it this is rather easy. Here is an initial, minimal attempt. It uses convolution filters only if the image is being downscaled by more than half a pixel in at least one dimension.
Looks very nice. My plan at the moment is to finish a bugfix 1.12 release, then start on 1.14 to add some new API. This improvement would be better in a major release, so I'll add it then.
Great! Having proper downscaling in Cairo would really make our life easier :)
Some discussion:
- The sampling and reconstruction kernels are picked in a way that
gives comparable quality when upscaling and downscaling. I paired box sampling with bilinear reconstruction and impulse (point) sampling with box reconstruction. This gives the expected result for NEAREST filter. BEST filter uses Lanczos3 for both kernels.
Do we need to use a reconstruction filter for NEAREST at all? Or maybe differentiate between NEAREST and FAST in that case?
If impulse (point) sampling is used, there must be some reconstruction filter, otherwise no image is produced. That's because the sampling grid does not match the data grid, and since there is no reconstruction filter, values between data points are undefined. The alternative is to use box sampling + no reconstruction.
Regards, Krzysztof