diff options
author | Tom Rondeau | 2010-04-12 20:50:56 -0400 |
---|---|---|
committer | Tom Rondeau | 2010-04-12 20:50:56 -0400 |
commit | 1e5d21b4ff14e19593909092ea67593ba0d4c086 (patch) | |
tree | a7cada49a54601d934157dd551c87ae2e441cfbd /gnuradio-core | |
parent | f1cda009dfd5edd7e1e234b97a4456076aebac0a (diff) | |
download | gnuradio-1e5d21b4ff14e19593909092ea67593ba0d4c086.tar.gz gnuradio-1e5d21b4ff14e19593909092ea67593ba0d4c086.tar.bz2 gnuradio-1e5d21b4ff14e19593909092ea67593ba0d4c086.zip |
Reworking variables to avoid recalculations/assignments.
Diffstat (limited to 'gnuradio-core')
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc | 19 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h | 1 |
2 files changed, 8 insertions, 12 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 1296c71f3..e13a933ea 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc @@ -66,16 +66,16 @@ 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 = (int)rintf(d_numchans / d_oversample_rate); + d_rate_ratio = (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; + d_idxlut[i] = d_numchans - ((i + d_rate_ratio) % d_numchans) - 1; } // 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) + while((d_output_multiple * d_rate_ratio) % d_numchans != 0) d_output_multiple++; set_output_multiple(d_output_multiple); } @@ -154,16 +154,11 @@ gr_pfb_channelizer_ccf::general_work (int noutput_items, return 0; // history requirements may have changed. } - float M = d_oversample_rate; - int N = d_numchans; - int r = (int)rintf(N / M); - - int toconsume = (int)rintf(noutput_items/M); - int n=1, i=-1, j=0, last; + int toconsume = (int)rintf(noutput_items/d_oversample_rate); while(n <= toconsume) { j = 0; - i = (i + r) % N; + i = (i + d_rate_ratio) % d_numchans; last = i; while(i >= 0) { in = (gr_complex*)input_items[j]; @@ -172,7 +167,7 @@ gr_pfb_channelizer_ccf::general_work (int noutput_items, i--; } - i = N-1; + i = d_numchans-1; while(i > last) { in = (gr_complex*)input_items[j]; d_fft->get_inbuf()[d_idxlut[j]] = d_filters[i]->filter(&in[n-1]); @@ -180,7 +175,7 @@ gr_pfb_channelizer_ccf::general_work (int noutput_items, i--; } - n += (i+r) >= N; + n += (i+d_rate_ratio) >= d_numchans; // despin through FFT d_fft->execute(); 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 7e71ff292..e33e1938e 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_rate_ratio; int d_output_multiple; /*! |