[Pixman] [PATCH v14 11/22] pixman-filter: Directly calculate normalized values

spitzak at gmail.com spitzak at gmail.com
Mon Mar 7 01:06:46 UTC 2016


From: Bill Spitzak <spitzak at gmail.com>

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 at gmail.com>
---
 pixman/pixman-filter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pixman/pixman-filter.c b/pixman/pixman-filter.c
index fef2189..ac89dda 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;
     }
 }
 
-- 
1.9.1



More information about the Pixman mailing list