[Pixman] [PATCH 09/15] pixman-filter: put filter error on center pixel
Oded Gabbay
oded.gabbay at gmail.com
Tue Dec 22 02:41:59 PST 2015
On Sat, Dec 12, 2015 at 8:06 PM, <spitzak at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
>
> Any error in filter normalization is placed on the center of odd-sized filters,
> rather than 1 pixel to the right.
>
> In particular this fixes the 1-wide filters produced by impulse sampling
> so they are 1.0 rather than 0.0.
> ---
> pixman/pixman-filter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
> index 0cd4a68..fbc657d 100644
> --- a/pixman/pixman-filter.c
> +++ b/pixman/pixman-filter.c
> @@ -299,7 +299,7 @@ create_1d_filter (int width,
> }
>
> if (new_total != pixman_fixed_1)
> - *(p - width / 2) += (pixman_fixed_1 - new_total);
> + *(p - (width + 1) / 2) += (pixman_fixed_1 - new_total);
> }
> }
>
> --
> 1.9.1
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman
I see that the result is indeed better (in the scale demo), but do you
mind explaining a bit more about the underlying of this patch ?
I indeed see that the width is 1, so without your patch, the new value
is written to *p and with your patch, it is written to *(p-1). But I
have no idea what that means :(
Oded
More information about the Pixman
mailing list