diff --git a/pipi/filter/blur.c b/pipi/filter/blur.c index 1533cdc..9b54225 100644 --- a/pipi/filter/blur.c +++ b/pipi/filter/blur.c @@ -71,11 +71,27 @@ pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *src, float rx, float ry, { for(i = -krx; i <= krx; i++) { - double u = (double)i * cost - (double)j * sint + dx; - double v = (double)j * cost + (double)i * sint + dy; - double ex = Kx * u * u; - double ey = Ky * v * v; - double d = exp(ex + ey); + static double const samples[] = + { + -.50, -.50, 0.5, + .50, -.50, 0.5, + .0, .0, 1, + -.50, .50, 0.5, + .50, .50, 0.5 + }; + double u, v, ex, ey, d = 0.; + int k; + + for(k = 0; k < 5; k++) + { + u = ((double)i + samples[k * 3]) * cost + - ((double)j + samples[k * 3 + 1]) * sint + dx; + v = ((double)i + samples[k * 3]) * sint + + ((double)j + samples[k * 3 + 1]) * cost + dy; + ex = Kx * u * u; + ey = Ky * v * v; + d += samples[k * 3 + 2] * exp(ex + ey); + } kernel[(j + kry) * m + i + krx] = d; t += d;