diff options
author | Bill Spitzak <spitzak@gmail.com> | 2016-03-06 17:06:46 -0800 |
---|---|---|
committer | Søren Sandmann Pedersen <soren.sandmann@gmail.com> | 2016-03-11 00:00:45 -0500 |
commit | 0b7a6ab2382b7f3bd5cdf16a928eab2301a35a69 (patch) | |
tree | 4e63c939140354084d8006be4f28d2e212a4737c | |
parent | 8c8830f12348b51e0d5189a7b8754cf041e6f4af (diff) |
pixman-filter: Directly calculate normalized values
Fix the nice filter and the integral to directly compute normalized values.
This makes it easier to test the normalization as it can be commented out and
still get usable results. Renormalization is still necessary as there are
sufficient math errors to need it.
Signed-off-by: Bill Spitzak <spitzak@gmail.com>
-rw-r--r-- | pixman/pixman-filter.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c index fef21899..ac89dda1 100644 --- a/pixman/pixman-filter.c +++ b/pixman/pixman-filter.c @@ -99,7 +99,7 @@ lanczos3_kernel (double x) static double nice_kernel (double x) { - return lanczos3_kernel (x * 0.75); + return lanczos3_kernel (x * 0.75) * 0.75; } static double @@ -169,7 +169,7 @@ integral (pixman_kernel_t kernel1, } else if (kernel1 == PIXMAN_KERNEL_IMPULSE) { - return filters[kernel2].func (-pos * scale); + return filters[kernel2].func (-pos * scale) * scale; } /* If the integration interval crosses zero, break it into * two separate integrals. This ensures that filters such @@ -199,7 +199,7 @@ integral (pixman_kernel_t kernel1, */ #define N_SEGMENTS 12 #define SAMPLE(a) \ - (filters[kernel1].func ((a)) * filters[kernel2].func (((a) - pos))) + (filters[kernel1].func ((a)) * filters[kernel2].func (((a) - pos) * scale)) double s = 0.0; double h = (high - low) / N_SEGMENTS; @@ -221,7 +221,7 @@ integral (pixman_kernel_t kernel1, s += SAMPLE (high); - return h * s * (1.0 / 3.0); + return h * s * (1.0 / 3.0) * scale; } } |