[cairo] Release

Bill Spitzak spitzak at gmail.com
Mon Mar 10 11:53:16 PDT 2014


I think everybody wants something better than the Cairo default 
downscaling, and the better downscaling should be the default. It will 
not slow down upscaling, and nobody wants the current downscaling 
behavior so they will always have to change it.

The problem is that "bilinear" as defined as "sample 2 pixels mixed 
together" is only useful for upscaling. For downscaling below .5 it is 
skipping information because some input pixels are not being used (since 
the samples are more than 2 apart, and each only uses 2 pixels, some 
pixels MUST be skipped). This is not correct.

My recommendation is that the current "bilinear" mean something other 
than it does right now for downscaling, and possibly rename it "good".

Bilinear when scaling up can be pictured as a triangular sampling 
filter. The base of the triangle is exactly 2 pixels wide. If it is 
centered on the pixel than only that pixel is multiplied by 1 at the 
peak of the triangle. The two adjacent pixels line up with the ends of 
the triangle and are multiplied by zero. If it is not centered then the 
non-zero part hits two pixels, one is multiplied by x and the other by 1-x.

The problem is that when scaling down THE FILTER MUST BE WIDER. There is 
no way around this. As far as I can tell there are some people working 
on Cairo who refuse to recognize this and are trying to solve it with 
obfuscation of using "sampling" and "reconstruction" filters. If you 
multiply two 2-wide filters you will get a 4-wide filter, which is why 
this appears to help, but it is NOT the solution.

Any user who actually wants the pixelated effect then "nearest" is 
actually more accurate and useful. Such users need to preserve actual 
pixel values, so any filter that does mixing cannot be used.

sandmann at cs.au.dk wrote:
> "Bryce W. Harrington" <b.harrington at samsung.com> writes:
> 
>> The aforementioned downscaling fix appears to have had some performance
>> regression issue associated with it.  That's the only regression I'm
>> aware of in the codebase right now.
> 
> High quality downscaling is inherently much slower than the point
> sampling that cairo used to do. For this reason, and because the names
> CAIRO_FILTER_NEAREST and CAIRO_FILTER_BILINEAR really are names of
> specific algorithms, I always thought that the downscaling should only
> be used after being enabled with new API.
> 
> 
> Søren


More information about the cairo mailing list