fix another issue with generating FIR coefficients
the impulse response of a low-pass is 2*f*sinc(2*pi*f*k), we were
missing the 2*f scale factor. This explains why we were seeing
clipping and had to manually scale the filter down.
Change-Id: I86d0bb82ecdd99681c8ba5a8112a8257bf6f0186
diff --git a/tools/resampler_tools/fir.cpp b/tools/resampler_tools/fir.cpp
index acd9911..ea3ef50 100644
--- a/tools/resampler_tools/fir.cpp
+++ b/tools/resampler_tools/fir.cpp
@@ -222,7 +222,7 @@
if (!polyphase) {
for (int i=0 ; i<N ; i++) {
double x = (2.0 * M_PI * i * Fcr) / (1 << nz);
- double y = kaiser(i+N, 2*N, beta) * sinc(x);
+ double y = kaiser(i+N, 2*N, beta) * sinc(x) * 2.0 * Fcr;
y *= atten;
if (!debug) {
@@ -247,7 +247,7 @@
// generate a FIR per phase
for (int i=-nzc ; i<nzc ; i++) {
double x = 2.0 * M_PI * Fcr * (i + p);
- double y = kaiser(i+N, 2*N, beta) * sinc(x);
+ double y = kaiser(i+N, 2*N, beta) * sinc(x) * 2.0 * Fcr;;
y *= atten;
if (!format) {
int64_t yi = floor(y * ((1ULL<<(nc-1))) + 0.5);