Re: [PATCH] Revert "image: Use convolution filters for sample reconstruction when downscaling"

Bill Spitzak <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>

On 05/13/2014 01:15 AM, Uli Schlachter wrote:
> This reverts commit fb57ea13e04d82866cbc8e86c83261148bb3e231.
>
> When running cairo-test-suite with the parameter "-a", it also runs each test
> with a non-zero device-offset and device-scaling. The above commit influenced
> the device-scaling results badly. E.g. some test results ended up with a black
> border at the top-most and left-most row that looked like there was an offset of
> "0.5" in drawing the image and thus pixels outside of the image were sampled.

There should be a workaround for this! Reverting proper scaling is not 
the solution.

Obviously there are bugs in pixman. It sounds like it is transforming 
the corner of the input filter to the corner of the output filter, 
rather than the centers. This can be fixed by modifying the transform to 
compensate.

The other thing is that there should be exactly one filter in each 
direction. As far as I can tell that means that one of "reconstruct" and 
"sampling" must be IMPULSE. I am still completely mystified as to what 
pixman is thinking here and have not been able to figure out which is 
which. The attached code certainly can allow both filters to be 
non-impulse which is a bug.

> -	 * TODO: this approach may not be completely correct if the matrix
> -	 * contains a skew component. */
> -	scale_x = hypot (pattern->matrix.xx, pattern->matrix.yx);
> -	scale_y = hypot (pattern->matrix.yx, pattern->matrix.yy);

This is in fact the best value you can get for a skew matrix (or for a 
rotation). Anything better requires sampling where the two filter axis 
are not parallel to the source image axis.
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
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.