diff options
author | ghostop14 <ghostop14@gmail.com> | 2020-01-13 22:07:49 -0500 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2020-01-21 21:03:21 -0800 |
commit | 1d60888071c5ccabbe20395e76f504a6172251d9 (patch) | |
tree | d941fc22b56d90704ebf973ceb9c5e81e66c5081 | |
parent | b46396fe899470cf34dc288fe78d2619c7d21b68 (diff) |
Filter: Improve performance in xlating FIR filter
Re-ordered work call to let rotate take advantage of volk. Rather
than rotating individually with each for iteration, the rotate
happens after with a rotateN to use the volk version for the data.
-rw-r--r-- | gr-filter/lib/freq_xlating_fir_filter_impl.cc | 13 | ||||
-rw-r--r-- | gr-filter/lib/freq_xlating_fir_filter_impl.h | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/gr-filter/lib/freq_xlating_fir_filter_impl.cc b/gr-filter/lib/freq_xlating_fir_filter_impl.cc index 8ddc967ba1..e94560d447 100644 --- a/gr-filter/lib/freq_xlating_fir_filter_impl.cc +++ b/gr-filter/lib/freq_xlating_fir_filter_impl.cc @@ -57,7 +57,8 @@ freq_xlating_fir_filter_impl<IN_T, OUT_T, TAP_T>::freq_xlating_fir_filter_impl( d_proto_taps(taps), d_center_freq(center_freq), d_sampling_freq(sampling_freq), - d_updated(false) + d_updated(false), + d_decim(decimation) { std::vector<gr_complex> dummy_taps; d_composite_fir = @@ -175,10 +176,16 @@ int freq_xlating_fir_filter_impl<IN_T, OUT_T, TAP_T>::work( unsigned j = 0; for (int i = 0; i < noutput_items; i++) { - out[i] = d_r.rotate(d_composite_fir->filter(&in[j])); - j += this->decimation(); + out[i] = d_composite_fir->filter(&in[j]); + j += d_decim; } + // re-use of the same buffer as the input and output is safe for many volk functions + // and faster than creating local temporary memory in the work function and doing an + // extra copy. So out is used below as both the in and out params to the rotate + // function. + d_r.rotateN(out, out, noutput_items); + return noutput_items; } diff --git a/gr-filter/lib/freq_xlating_fir_filter_impl.h b/gr-filter/lib/freq_xlating_fir_filter_impl.h index 73b83a2567..3475107a8a 100644 --- a/gr-filter/lib/freq_xlating_fir_filter_impl.h +++ b/gr-filter/lib/freq_xlating_fir_filter_impl.h @@ -42,6 +42,7 @@ protected: double d_center_freq; double d_sampling_freq; bool d_updated; + const int d_decim; virtual void build_composite_fir(); |