Re: Tentative patch for downscaling in Cairo

Carlos Garcia Campos <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Chris Wilson <[email protected]> writes:

> 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.
>> 
>> Some discussion:
>> 
>> 1. 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.
>> 
>> 2. Subsampling bits are always set to 1, since this doesn't seem to
>> affect quality at all.
>> 
>> 3. I am not sure whether this code works correctly for matrices with a
>> skew component. It should be OK for any combination of scale, rotation
>> and translation.
>> 
>> 4. This patch causes new failures in the test suite:
>> - recording-surface*: possibly an effect of improved quality.
>> - surface-pattern-scale-down*, surface-pattern-big-scale-down: the
>> reference images should be updated.
>> - pthread-same-source: I have no idea why this is failing, since this
>> test shouldn't even trigger the new code.
>> - large-source-roi: this test attempts to downscale an image which is
>> 30000 pixels wide down to 7 pixels. The filter parameters seem to be
>> created correctly, but they might trigger an overflow somewhere in the
>> convolution code; the output rectangle is white instead of red, as if
>> nothing was drawn.
>> - device-offset-scale: there are subtle differences which look like
>> convolution-related smoothing; I'm not sure whether this is OK or not.
>> 
>> Note that master currently fails many more tests, I only listed new
>> failures cause by this patch.
>
> Merged to cairo-1.13, many thanks.

\o/ Thank you guys! I'm looking forward to cairo 1.14

> -Chris
>
>
> -- 
> Chris Wilson, Intel Open Source Technology Centre
> -- 
> cairo mailing list
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
-- 
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iEYEARECAAYFAlIopeoACgkQjxBOalI+ZGJw+QCeKQho3CN6lNWYFY8LiNjqryBV
fw0An2kZd5e6+ySnEDyecague8M5Ys86
=uzpK
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.