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 | d88a051aff15fdf5c57e1e5a4083bbd9635af3ad (patch) | |
tree | 20bb8548ab209ab54df6e19f19e16e834a0a63f0 /tools/resampler_tools | |
parent | c0214ba2e267f87437bc2629dc99512054fc7a4d (diff) | |
download | frameworks_av-d88a051aff15fdf5c57e1e5a4083bbd9635af3ad.zip frameworks_av-d88a051aff15fdf5c57e1e5a4083bbd9635af3ad.tar.gz frameworks_av-d88a051aff15fdf5c57e1e5a4083bbd9635af3ad.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/resampler_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); |