diff options
author | Mathias Agopian <mathias@google.com> | 2012-10-30 12:49:07 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-10-30 12:49:07 -0700 |
commit | cca56d5784c02a5f02ce5e47c3d6583d71a2469b (patch) | |
tree | dbfeed64df6777b0ba475dc2086abbf6282c23e1 /tools | |
parent | 955f37a0d8c6c441cd811104193970bd7c3bb486 (diff) | |
download | frameworks_av-cca56d5784c02a5f02ce5e47c3d6583d71a2469b.zip frameworks_av-cca56d5784c02a5f02ce5e47c3d6583d71a2469b.tar.gz frameworks_av-cca56d5784c02a5f02ce5e47c3d6583d71a2469b.tar.bz2 |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/resampler_tools/fir.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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 @@ int main(int argc, char** argv) 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 @@ int main(int argc, char** argv) // 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); |