Explorar el Código

* filter/blur.c: minor optimisation in the kernel generation.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2618 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
sam hace 16 años
padre
commit
ea38654c88
Se han modificado 1 ficheros con 5 adiciones y 7 borrados
  1. +5
    -7
      pipi/filter/blur.c

+ 5
- 7
pipi/filter/blur.c Ver fichero

@@ -39,7 +39,7 @@ pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *src, float rx, float ry,
pipi_pixels_t *srcp, *dstp;
float *srcdata, *dstdata;
double *kernel, *buffer;
double K, L;
double K;
int x, y, i, w, h, kr, kw;

w = src->w;
@@ -56,12 +56,11 @@ pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *src, float rx, float ry,

kr = (int)(3. * rx + 0.99999);
kw = 2 * kr + 1;
K = 1. / (sqrt(2. * M_PI) * rx);
L = -1. / (2. * rx * rx);
K = -1. / (2. * rx * rx);

kernel = malloc(kw * sizeof(double));
for(i = -kr; i <= kr; i++)
kernel[i + kr] = exp(L * ((double)i - dx) * ((double)i - dx)) * K;
kernel[i + kr] = exp(K * ((double)i - dx) * ((double)i - dx));

for(y = 0; y < h; y++)
{
@@ -94,12 +93,11 @@ pipi_image_t *pipi_gaussian_blur_ext(pipi_image_t *src, float rx, float ry,

kr = (int)(3. * ry + 0.99999);
kw = 2 * kr + 1;
K = 1. / (sqrt(2. * M_PI) * ry);
L = -1. / (2. * ry * ry);
K = -1. / (2. * ry * ry);

kernel = malloc(kw * sizeof(double));
for(i = -kr; i <= kr; i++)
kernel[i + kr] = exp(L * ((double)i - dy) * ((double)i - dy)) * K;
kernel[i + kr] = exp(K * ((double)i - dy) * ((double)i - dy));

for(y = 0; y < h; y++)
{


Cargando…
Cancelar
Guardar