diff options
author | Tom Rondeau | 2012-01-22 17:46:22 -0500 |
---|---|---|
committer | Tom Rondeau | 2012-01-22 17:46:22 -0500 |
commit | accc35f380e56af156153cd01540a46c7eb98f12 (patch) | |
tree | a917f0113747de84770b06980f0bb509a864c461 | |
parent | 32cbee3e091021741bb2bcf0d4a8bddd6581c8ab (diff) | |
download | gnuradio-accc35f380e56af156153cd01540a46c7eb98f12.tar.gz gnuradio-accc35f380e56af156153cd01540a46c7eb98f12.tar.bz2 gnuradio-accc35f380e56af156153cd01540a46c7eb98f12.zip |
core: test case of using Volk to convert from float to short.
-rw-r--r-- | gnuradio-core/src/lib/general/gr_float_to_short.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.cc b/gnuradio-core/src/lib/general/gr_float_to_short.cc index 084f76f9c..415ea6982 100644 --- a/gnuradio-core/src/lib/general/gr_float_to_short.cc +++ b/gnuradio-core/src/lib/general/gr_float_to_short.cc @@ -27,6 +27,9 @@ #include <gr_float_to_short.h> #include <gr_io_signature.h> #include <gri_float_to_short.h> +#include <volk/volk.h> + +#include <iostream> gr_float_to_short_sptr gr_make_float_to_short () @@ -39,6 +42,9 @@ gr_float_to_short::gr_float_to_short () gr_make_io_signature (1, 1, sizeof (float)), gr_make_io_signature (1, 1, sizeof (short))) { + const int alignment_multiple = + volk_get_alignment() / sizeof(short); + set_alignment(alignment_multiple); } int @@ -49,8 +55,22 @@ gr_float_to_short::work (int noutput_items, const float *in = (const float *) input_items[0]; short *out = (short *) output_items[0]; - gri_float_to_short (in, out, noutput_items); - +#if 0 + if(is_unaligned()) { + float d_scale = 1.0; + //gri_float_to_short (in, out, noutput_items); + volk_32f_s32f_convert_16i_u(out, in, d_scale, noutput_items); + } + else { + float d_scale = 1.0; + volk_32f_s32f_convert_16i_a(out, in, d_scale, noutput_items); + } +#else + float d_scale = 1.0; + volk_32f_s32f_convert_16i_u(out, in, d_scale, noutput_items); + //gri_float_to_short (in, out, noutput_items); +#endif + return noutput_items; } |