diff options
author | Tom Rondeau | 2012-01-19 21:31:14 -0500 |
---|---|---|
committer | Tom Rondeau | 2012-01-19 21:31:14 -0500 |
commit | 26de2814ed10cb3a03d0209e8cbaf22540f2650e (patch) | |
tree | 6951fff7c4c6d21137a5b4f93a1a1691757d2521 /gnuradio-core/src/lib/general | |
parent | da8f67595847f63358792f24ad88582f4c16efed (diff) | |
download | gnuradio-26de2814ed10cb3a03d0209e8cbaf22540f2650e.tar.gz gnuradio-26de2814ed10cb3a03d0209e8cbaf22540f2650e.tar.bz2 gnuradio-26de2814ed10cb3a03d0209e8cbaf22540f2650e.zip |
core: fixed bug in FFT shift operation.
Diffstat (limited to 'gnuradio-core/src/lib/general')
-rw-r--r-- | gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc index 3293e3ab8..c66015c11 100644 --- a/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc +++ b/gnuradio-core/src/lib/general/gr_fft_vcc_fftw.cc @@ -67,8 +67,17 @@ gr_fft_vcc_fftw::work (int noutput_items, if (d_window.size()){ gr_complex *dst = d_fft->get_inbuf(); - for (unsigned int i = 0; i < d_fft_size; i++) // apply window - dst[i] = in[i] * d_window[i]; + if(!d_forward && d_shift){ + int offset = (!d_forward && d_shift)?floor(d_fft_size/2):0; + int fft_m_offset = d_fft_size - offset; + for (unsigned int i = 0; i < offset; i++) // apply window + dst[i+fft_m_offset] = in[i] * d_window[i]; + for (unsigned int i = offset; i < d_fft_size; i++) // apply window + dst[i-offset] = in[i] * d_window[i]; + } else { + for (unsigned int i = 0; i < d_fft_size; i++) // apply window + dst[i] = in[i] * d_window[i]; + } } else { if(!d_forward && d_shift) { // apply an ifft shift on the data |