diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-05-25 09:55:25 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-05-25 09:55:25 -0400 |
commit | beb446311093d132944008a10e256f8781df0010 (patch) | |
tree | 9ded0641ab2f68b24ac98367aea4382b05ede8f4 | |
parent | 76cf21628d3615cfcf01272e6303d577fd1e15d7 (diff) |
analog: using VOLK to do conjugate multiply in quadrature demod block.
Even though this requires unaligned loads (in[0] and in[1] are always off cut), it still provides a speedup.
-rw-r--r-- | gr-analog/lib/quadrature_demod_cf_impl.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gr-analog/lib/quadrature_demod_cf_impl.cc b/gr-analog/lib/quadrature_demod_cf_impl.cc index 583de4dba4..709ff561e1 100644 --- a/gr-analog/lib/quadrature_demod_cf_impl.cc +++ b/gr-analog/lib/quadrature_demod_cf_impl.cc @@ -27,6 +27,7 @@ #include "quadrature_demod_cf_impl.h" #include <gnuradio/io_signature.h> #include <gnuradio/math.h> +#include <volk/volk.h> namespace gr { namespace analog { @@ -44,6 +45,10 @@ namespace gr { io_signature::make(1, 1, sizeof(float))), d_gain(gain) { + const int alignment_multiple = + volk_get_alignment() / sizeof(gr_complex); + set_alignment(std::max(1, alignment_multiple)); + set_history(2); // we need to look at the previous value } @@ -58,11 +63,11 @@ namespace gr { { gr_complex *in = (gr_complex*)input_items[0]; float *out = (float*)output_items[0]; - in++; // ensure that in[-1] is valid + gr_complex tmp[noutput_items]; + volk_32fc_x2_multiply_conjugate_32fc(tmp, &in[1], &in[0], noutput_items); for(int i = 0; i < noutput_items; i++) { - gr_complex product = in[i] * conj(in[i-1]); - out[i] = d_gain * gr::fast_atan2f(imag(product), real(product)); + out[i] = d_gain * gr::fast_atan2f(imag(tmp[i]), real(tmp[i])); } return noutput_items; |