[cairo] Tentative patch for downscaling in Cairo

Carlos Garcia Campos carlosgc at gnome.org
Thu Sep 5 08:40:25 PDT 2013


Chris Wilson <chris at chris-wilson.co.uk> 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
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
-- 
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130905/23a251ae/attachment.pgp>


More information about the cairo mailing list