diff options
author | Tom Rondeau <tom@trondeau.com> | 2013-11-18 20:25:23 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2013-11-18 21:18:39 -0500 |
commit | d04a3d340145ed14a64cf1e0e0615cab806ab357 (patch) | |
tree | da51f734678f54ba76fa27e4cc76d12014e92958 /gr-fft/lib | |
parent | 38ecfe9a63f3b35359930bfb04ca2929f42f6658 (diff) |
filter: remove use of magic numbers for calculating number of taps in firdes filters.
New way uses known max attenuation values for the windows to estimate the number of taps used in a filter. This produces smaller filters but needed QA code with pre-defined values updated.
Diffstat (limited to 'gr-fft/lib')
-rw-r--r-- | gr-fft/lib/window.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gr-fft/lib/window.cc b/gr-fft/lib/window.cc index 1610b46f5d..015e2d9943 100644 --- a/gr-fft/lib/window.cc +++ b/gr-fft/lib/window.cc @@ -74,7 +74,24 @@ namespace gr { return 1.0/(ntaps >> 1); } - std::vector<float> + double + window::max_attenuation(win_type type, double beta) + { + switch(type) { + case(WIN_HAMMING): return 53; break; + case(WIN_HANN): return 44; break; + case(WIN_BLACKMAN): return 74; break; + case(WIN_RECTANGULAR): return 21; break; + case(WIN_KAISER): return (beta/0.1102 + 8.7); break; + case(WIN_BLACKMAN_hARRIS): return 92; break; + case(WIN_BARTLETT): return 27; break; + case(WIN_FLATTOP): return 93; break; + default: + throw std::out_of_range("window::max_attenuation: unknown window type provided."); + } + } + + std::vector<float> window::coswindow(int ntaps, float c0, float c1, float c2) { std::vector<float> taps(ntaps); |