From: Bill Spitzak <spit...@gmail.com> This removes a high-frequency spike in the middle of some filters that is caused by math errors all being in the same direction.
Signed-off-by: Bill Spitzak <spit...@gmail.com> --- pixman/pixman-filter.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c index 36dd811..ab62e0a 100644 --- a/pixman/pixman-filter.c +++ b/pixman/pixman-filter.c @@ -282,8 +282,18 @@ create_1d_filter (int width, p[x] = t; } + /* Distribute any remaining error over all samples */ if (new_total != pixman_fixed_1) - p[width / 2] += (pixman_fixed_1 - new_total); + { + pixman_fixed_t delta = new_total - pixman_fixed_1; + pixman_fixed_t t = 0; + for (x = 0; x < width; ++x) + { + pixman_fixed_t new_t = delta * (x + 1) / width; + p[x] += new_t - t; + t = new_t; + } + } p += width; } -- 1.9.1 _______________________________________________ Pixman mailing list Pixman@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/pixman