diff options
author | Tom Rondeau | 2010-04-12 20:45:10 -0400 |
---|---|---|
committer | Tom Rondeau | 2010-04-12 20:45:10 -0400 |
commit | f1cda009dfd5edd7e1e234b97a4456076aebac0a (patch) | |
tree | bd15aa1f303360d14330f1753e7a7a62c97592be /gnuradio-core | |
parent | 69c6a0739f4df46d49e3ed4c151f99f8eca2a5de (diff) | |
download | gnuradio-f1cda009dfd5edd7e1e234b97a4456076aebac0a.tar.gz gnuradio-f1cda009dfd5edd7e1e234b97a4456076aebac0a.tar.bz2 gnuradio-f1cda009dfd5edd7e1e234b97a4456076aebac0a.zip |
Channelizer can now produce any rational ratio of the sample rate in [fs/N, fs] where fs is the input sample rate and N is the number of channels. The ratios work out to be N/i for i in [1, N].
Diffstat (limited to 'gnuradio-core')
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc | 22 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h | 1 |
2 files changed, 15 insertions, 8 deletions
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc index ba22af99a..1296c71f3 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc @@ -66,13 +66,18 @@ gr_pfb_channelizer_ccf::gr_pfb_channelizer_ccf (unsigned int numchans, // Although the filters change, we use this look up table // to set the index of the FFT input buffer, which equivalently // performs the FFT shift operation on every other turn. - int r = d_numchans / d_oversample_rate; + int r = (int)rintf(d_numchans / d_oversample_rate); d_idxlut = new int[d_numchans]; for(int i = 0; i < d_numchans; i++) { d_idxlut[i] = d_numchans - ((i + r) % d_numchans) - 1; } - set_output_multiple(d_oversample_rate); + // Calculate the number of filtering rounds to do to evenly + // align the input vectors with the output channels + d_output_multiple = 1; + while((d_output_multiple * r) % d_numchans != 0) + d_output_multiple++; + set_output_multiple(d_output_multiple); } gr_pfb_channelizer_ccf::~gr_pfb_channelizer_ccf () @@ -149,13 +154,14 @@ gr_pfb_channelizer_ccf::general_work (int noutput_items, return 0; // history requirements may have changed. } - int M = d_oversample_rate; + float M = d_oversample_rate; int N = d_numchans; - int r = N / M; + int r = (int)rintf(N / M); - int n=1, i=-1, j=0, last; + int toconsume = (int)rintf(noutput_items/M); - while(n <= noutput_items/M) { + int n=1, i=-1, j=0, last; + while(n <= toconsume) { j = 0; i = (i + r) % N; last = i; @@ -181,7 +187,7 @@ gr_pfb_channelizer_ccf::general_work (int noutput_items, memcpy(out, d_fft->get_outbuf(), d_numchans*sizeof(gr_complex)); out += d_numchans; } - - consume_each(noutput_items/M); + + consume_each(toconsume); return noutput_items; } diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h index 1f9189e28..7e71ff292 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h @@ -117,6 +117,7 @@ class gr_pfb_channelizer_ccf : public gr_block unsigned int d_taps_per_filter; gri_fft_complex *d_fft; int *d_idxlut; + int d_output_multiple; /*! * Build the polyphase filterbank decimator. |