Browse Source

* blur.c: improve the Gaussian kernel generation by interpolating its

values in a quincunx pattern.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2719 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
sam 16 years ago
parent
commit
37ab68e449
1 changed files with 21 additions and 5 deletions
  1. +21
    -5
      pipi/filter/blur.c

+ 21
- 5
pipi/filter/blur.c View File

@@ -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;


Loading…
Cancel
Save