47 if ((g_trunc = (
num *)malloc(
sizeof(
num) * (r + 1))))
49 num accum = g_trunc[0] = 1.0;
52 for (m = 1; m <= r; ++m)
55 g_trunc[m] = exp(-0.5 * temp * temp);
56 accum += 2.0 * g_trunc[m];
60 for (m = 0; m <= r; ++m)
87 for (n = 0; n < N; ++n)
89 num accum = h[0] * src[stride * n];
93 for (m = 1; m <= r; ++m)
94 accum += h[m] * (src[stride *
extension(N, n - m)]
97 dest[stride * n] = accum;
119 assert(c && sigma > 0.0 && 0.0 < tol && tol < 1.0);
140 assert(c.
g_trunc && dest && src && dest != src && N > 0 && stride != 0);
159 const num *src,
int width,
int height,
int num_channels)
161 const long num_pixels = ((long)width) * ((long)height);
164 assert(c.
g_trunc && dest && buffer
165 && src && dest != src && num_pixels > 0);
168 for (channel = 0; channel < num_channels; ++channel)
171 const num *src_y = src;
174 for (x = 0; x < width; ++x)
178 for (y = 0; y < height; ++y)
181 memcpy(dest_y, buffer,
sizeof(
num) * width);