summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fba13a9)
raw | patch | inline | side by side (parent: fba13a9)
author | jaspervdg <jaspervdg@users.sourceforge.net> | |
Tue, 2 Dec 2008 09:37:28 +0000 (09:37 +0000) | ||
committer | jaspervdg <jaspervdg@users.sourceforge.net> | |
Tue, 2 Dec 2008 09:37:28 +0000 (09:37 +0000) |
src/display/nr-filter-gaussian.cpp | patch | blob | history |
index f023bbc5790732f7644f0410d0948c6a5803614b..c1b534b7705addcb019e8ceb45800ffe9f26e9b0 100644 (file)
#include "display/nr-filter-gaussian.h"
#include "display/nr-filter-types.h"
#include "display/nr-filter-units.h"
+#include "libnr/nr-blit.h"
#include "libnr/nr-pixblock.h"
#include "libnr/nr-matrix.h"
#include "libnr/nr-matrix-fns.h"
// Compute scaled filter coefficients
std::complex<double> const d1 = pow(d1_org, 1.0/q);
double const d3 = pow(d3_org, 1.0/q);
- double const absd1sqr = std::norm(d1);
- double const re2d1 = 2*d1.real();
- double const bscale = 1.0/(absd1sqr*d3);
- b[2] = -bscale;
- b[1] = bscale*(d3+re2d1);
- b[0] = -bscale*(absd1sqr+d3*re2d1);
// Compute actual sigma^2
double const ssqr = 2*(2*(d1/sqr(d1-1.)).real()+d3/sqr(d3-1.));
if ( ssqr < sigmasqr ) {
}
s = sqrt(ssqr);
} while(qend-qbeg>(sigma/(1<<30)));
+ // Compute filter coefficients
+ double const q = (qbeg+qend)/2;
+ std::complex<double> const d1 = pow(d1_org, 1.0/q);
+ double const d3 = pow(d3_org, 1.0/q);
+ double const absd1sqr = std::norm(d1); // d1*d2 = d1*conj(d1) = |d1|^2 = std::norm(d1)
+ double const re2d1 = 2*d1.real(); // d1+d2 = d1+conj(d1) = 2*real(d1)
+ double const bscale = 1.0/(absd1sqr*d3);
+ b[2] = -bscale;
+ b[1] = bscale*(d3+re2d1);
+ b[0] = -bscale*(absd1sqr+d3*re2d1);
}
static void calcTriggsSdikaM(double const b[N], double M[N*N]) {
default:
assert(false);
};
- } else { // !use_IIR_x
+ } else if ( scr_len_x > 1 ) { // !use_IIR_x
// Filter kernel for x direction
FIRValue kernel[scr_len_x];
_make_kernel(kernel, deviation_x);
default:
assert(false);
};
+ } else if ( out != ssin ) { // out can be equal to ssin if resampling is used
+ nr_blit_pixblock_pixblock(out, ssin);
}
if (use_IIR_y) {
default:
assert(false);
};
- } else { // !use_IIR_y
+ } else if ( scr_len_y > 1 ) { // !use_IIR_y
// Filter kernel for y direction
FIRValue kernel[scr_len_y];
_make_kernel(kernel, deviation_y);