[Pixman] [PATCH v14 12/22] pixman-filter: fix subsample_bits == 0
Bill Spitzak
spitzak at gmail.com
Sat Apr 9 19:45:51 UTC 2016
On 04/03/2016 11:17 AM, SÃ¸ren Sandmann wrote:
> I don't believe this patch is correct.
>
> As an example, consider an image with an identity transformation and a
> cubic filter (which has width 4) with subsample_bits = 0. The current
> code will compute a matrix
>
> [ cubic(-2), cubic(-1), cubic(0), cubic(1) ]
>
> Now suppose we are filtering a pixel located at x = 17.5. The code in
> bits_image_fetch_pixel_separable_convolution() will eventually end up
> convolving with the pixels at locations 15.5, 16.5, 17.5 and 18.5, which
> is the correct result since cubic(-2) = 0 [1].
>
> With your code, the matrix computed would be
>
> [ cubic(-1.5), cubic(-0.5), cubic(0.5), cubic(1) ]
>
> which would not be correct no matter what: With an identity
> transformation, the pixel at 17.5 should be multiplied with cubic(0).
>
> There is a detailed explanation of these issues in the file
> pixman/rounding.txt.
I have finally checked this and it is producing the correct value in the
above example. pos is not the left edge of the range to integrate, it is
the center of it, due to the changes I made to the integrate function.
However the code is incorrect and only works because n_phases&1 is true
only when subsample_bits == 0. The intention was to treat all odd widths
the same.
More information about the Pixman
mailing list