From 8996a532dfce06ef91c1e917310f9c0275919c5e Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 20 Aug 2008 01:38:46 +0000 Subject: [PATCH] * blur.c: improve the Gaussian kernel interpolation. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2737 92316355-f0b4-4df1-b90c-862c8a59935f --- pipi/filter/blur.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pipi/filter/blur.c b/pipi/filter/blur.c index 9b54225..615788e 100644 --- a/pipi/filter/blur.c +++ b/pipi/filter/blur.c @@ -71,18 +71,24 @@ pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *src, float rx, float ry, { for(i = -krx; i <= krx; i++) { + /* FIXME: this level of interpolation sucks. We should + * interpolate on the full NxN grid for better quality. */ static double const samples[] = { - -.50, -.50, 0.5, - .50, -.50, 0.5, .0, .0, 1, - -.50, .50, 0.5, - .50, .50, 0.5 + -.40, -.40, 0.8, + -.30, .0, 0.9, + -.40, .40, 0.8, + .0, .30, 0.9, + .40, .40, 0.8, + .30, .0, 0.9, + .40, -.40, 0.8, + .0, -.30, 0.9, }; double u, v, ex, ey, d = 0.; - int k; + unsigned int k; - for(k = 0; k < 5; k++) + for(k = 0; k < sizeof(samples) / sizeof(*samples) / 3; k++) { u = ((double)i + samples[k * 3]) * cost - ((double)j + samples[k * 3 + 1]) * sint + dx;