|
|
@@ -66,13 +66,15 @@ pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *src, float rx, float ry, |
|
|
|
|
|
|
|
buffer = malloc(w * h * (gray ? 1 : 4) * sizeof(double)); |
|
|
|
|
|
|
|
kr = (int)(3. * rx + 1.99999); |
|
|
|
/* FIXME: the kernel becomes far too big with large values of dx, because |
|
|
|
* we grow both left and right. Fix the growing direction. */ |
|
|
|
kr = (int)(3. * rx + .99999 + ceil(abs(dx))); |
|
|
|
kw = 2 * kr + 1; |
|
|
|
K = -1. / (2. * rx * rx); |
|
|
|
|
|
|
|
kernel = malloc(kw * sizeof(double)); |
|
|
|
for(i = -kr; i <= kr; i++) |
|
|
|
kernel[i + kr] = exp(K * ((double)i - dx) * ((double)i - dx)); |
|
|
|
kernel[i + kr] = exp(K * ((double)i + dx) * ((double)i + dx)); |
|
|
|
|
|
|
|
for(y = 0; y < h; y++) |
|
|
|
{ |
|
|
@@ -125,13 +127,13 @@ pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *src, float rx, float ry, |
|
|
|
|
|
|
|
free(kernel); |
|
|
|
|
|
|
|
kr = (int)(3. * ry + 1.99999); |
|
|
|
kr = (int)(3. * ry + .99999 + ceil(abs(dy))); |
|
|
|
kw = 2 * kr + 1; |
|
|
|
K = -1. / (2. * ry * ry); |
|
|
|
|
|
|
|
kernel = malloc(kw * sizeof(double)); |
|
|
|
for(i = -kr; i <= kr; i++) |
|
|
|
kernel[i + kr] = exp(K * ((double)i - dy) * ((double)i - dy)); |
|
|
|
kernel[i + kr] = exp(K * ((double)i + dy) * ((double)i + dy)); |
|
|
|
|
|
|
|
for(y = 0; y < h; y++) |
|
|
|
{ |
|
|
|