[Pixman] [PATCH v14 12/22] pixman-filter: fix subsample_bits == 0

Søren Sandmann soren.sandmann at gmail.com
Mon Apr 11 05:01:44 UTC 2016

> It does look like there is something really wrong. I compared and (except
> for the subsample_bits==0 case) my version produces the same output as the
> current git head.
> I think your intention is that there is a sample at offset=0 whether the
> filter width is even or odd. However (except when subsample_bits==0) the
> filter generator makes a symmetric filter for even sizes, with two equal
> samples around the maximum center value. If a sample was at offset==0 then
> it would be unique and larger than all the other samples.

The root of this confusion is probably that when subsample_bits = k, the
subpixel positions used are:

    0.5 / 2^k, 1.5 / 2^k, ..., (2^k-0.5)/2^k

For example, for subsample_bits = 2:

    0.125, 0.375, 0.625, 0.875

and for subsample_bits = 0:


That is, they are regularly spaced, but centered within the pixel. When
there is an even number of them, this means there will not be a filter
position at 0.5, and therefore no sample at offset 0. And the only case
where number of subpixel locations is odd, is when subsample_bits = 0.

I'm pretty sure that the existing code gets the filter generation right for
these subpixel positions.

[ You can argue that it would be better to use the sampling positions

    0, 0.25, 0.5, 0.75

for subsample_bits = 2, as Owen did here:


and I agree that that would have been better. ]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pixman/attachments/20160411/baa7cca4/attachment.html>

More information about the Pixman mailing list