summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_char.cc18
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_int.cc18
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_short.cc13
3 files changed, 38 insertions, 11 deletions
diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.cc b/gnuradio-core/src/lib/general/gr_float_to_char.cc
index 88b9d276e..2d7e21f2e 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_char.cc
+++ b/gnuradio-core/src/lib/general/gr_float_to_char.cc
@@ -27,6 +27,7 @@
#include <gr_float_to_char.h>
#include <gr_io_signature.h>
#include <gri_float_to_char.h>
+#include <volk/volk.h>
gr_float_to_char_sptr
gr_make_float_to_char ()
@@ -39,6 +40,9 @@ gr_float_to_char::gr_float_to_char ()
gr_make_io_signature (1, 1, sizeof (float)),
gr_make_io_signature (1, 1, sizeof (char)))
{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(char);
+ set_alignment(alignment_multiple);
}
int
@@ -46,10 +50,22 @@ gr_float_to_char::work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+#if 1
+ float d_scale = 1.0;
const float *in = (const float *) input_items[0];
- char *out = (char *) output_items[0];
+ int8_t *out = (int8_t *) output_items[0];
+ if(is_unaligned()) {
+ volk_32f_s32f_convert_8i_u(out, in, d_scale, noutput_items);
+ }
+ else {
+ volk_32f_s32f_convert_8i_a(out, in, d_scale, noutput_items);
+ }
+#else
+ const float *in = (const float *) input_items[0];
+ char *out = (char *) output_items[0];
gri_float_to_char (in, out, noutput_items);
+#endif
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/general/gr_float_to_int.cc b/gnuradio-core/src/lib/general/gr_float_to_int.cc
index 2349de8cb..2ca723c7c 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_int.cc
+++ b/gnuradio-core/src/lib/general/gr_float_to_int.cc
@@ -27,6 +27,7 @@
#include <gr_float_to_int.h>
#include <gr_io_signature.h>
#include <gri_float_to_int.h>
+#include <volk/volk.h>
gr_float_to_int_sptr
gr_make_float_to_int ()
@@ -39,6 +40,9 @@ gr_float_to_int::gr_float_to_int ()
gr_make_io_signature (1, 1, sizeof (float)),
gr_make_io_signature (1, 1, sizeof (int)))
{
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(int);
+ set_alignment(alignment_multiple);
}
int
@@ -46,10 +50,22 @@ gr_float_to_int::work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+#if 1
+ float d_scale = 1.0;
const float *in = (const float *) input_items[0];
- int *out = (int *) output_items[0];
+ int32_t *out = (int32_t *) output_items[0];
+ if(is_unaligned()) {
+ volk_32f_s32f_convert_32i_u(out, in, d_scale, noutput_items);
+ }
+ else {
+ volk_32f_s32f_convert_32i_a(out, in, d_scale, noutput_items);
+ }
+#else
+ const float *in = (const float *) input_items[0];
+ int *out = (int *) output_items[0];
gri_float_to_int (in, out, noutput_items);
+#endif
return noutput_items;
}
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 415ea6982..6c4d031ac 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_short.cc
+++ b/gnuradio-core/src/lib/general/gr_float_to_short.cc
@@ -29,8 +29,6 @@
#include <gri_float_to_short.h>
#include <volk/volk.h>
-#include <iostream>
-
gr_float_to_short_sptr
gr_make_float_to_short ()
{
@@ -55,20 +53,17 @@ gr_float_to_short::work (int noutput_items,
const float *in = (const float *) input_items[0];
short *out = (short *) output_items[0];
-#if 0
+#if 1
+ float d_scale = 1.0;
+ //volk_32f_s32f_convert_16i_u(out, in, d_scale, noutput_items);
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);
+ gri_float_to_short (in, out, noutput_items);
#endif
return noutput_items;