39 num nu,
long num_terms)
41 num h = 1, accum = data[0];
44 for (m = 1; m < num_terms; ++m)
47 accum += h * data[stride *
extension(N, -m)];
82 double sigma,
int K,
num tol,
int use_adjusted_q)
84 const long stride_N = stride * N;
85 double q, lambda, dnu;
90 assert(dest && src && N > 0 && stride != 0 && sigma > 0
94 q = sigma * (1.0 + (0.3165 * K + 0.5695)
95 / ((K + 0.7818) * (K + 0.7818)));
100 lambda = (q * q) / (2.0 * K);
101 dnu = (1.0 + 2.0*lambda - sqrt(1.0 + 4.0*lambda))/(2.0*lambda);
105 num_terms = (long)ceil(log((1.0 - dnu)*tol) / log(dnu));
107 scale = (
num)(pow(dnu / lambda, K));
110 for (i = 0; i < stride_N; i += stride)
111 dest[i] = src[i] * scale;
114 for (pass = 0; pass < K; ++pass)
125 for (i = stride; i < stride_N; i += stride)
126 dest[i] += nu * dest[i - stride];
136 for (; i > 0; i -= stride)
137 dest[i - stride] += nu * dest[i];
160 int width,
int height,
int num_channels,
161 num sigma,
int K,
num tol,
int use_adjusted_q)
163 const long num_pixels = ((long)width) * ((long)height);
166 assert(dest && src && num_pixels > 0 && sigma > 0
167 && K > 0 && tol > 0);
170 for (channel = 0; channel < num_channels; ++channel)
173 const num *src_y = src;
176 for (y = 0; y < height; ++y)
179 sigma, K, tol, use_adjusted_q);
185 for (x = 0; x < width; ++x)
187 sigma, K, tol, use_adjusted_q);