summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
authorTom Rondeau2012-01-30 00:23:11 -0500
committerTom Rondeau2012-01-30 00:23:11 -0500
commit4769d5ff75520661ce52fae229482a96e651f7e2 (patch)
tree229ae17ed5998807facc220b7d7e940d4b6f12ab /gnuradio-core/src/lib
parentcb458204245632ac7a571bfe96b90d3c55a2f01a (diff)
downloadgnuradio-4769d5ff75520661ce52fae229482a96e651f7e2.tar.gz
gnuradio-4769d5ff75520661ce52fae229482a96e651f7e2.tar.bz2
gnuradio-4769d5ff75520661ce52fae229482a96e651f7e2.zip
core: complex_to_xxx (float, real, imag, arg) to volk.
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/general/gr_complex_to_xxx.cc60
1 files changed, 59 insertions, 1 deletions
diff --git a/gnuradio-core/src/lib/general/gr_complex_to_xxx.cc b/gnuradio-core/src/lib/general/gr_complex_to_xxx.cc
index 0bdd06547..9ed86f368 100644
--- a/gnuradio-core/src/lib/general/gr_complex_to_xxx.cc
+++ b/gnuradio-core/src/lib/general/gr_complex_to_xxx.cc
@@ -57,17 +57,41 @@ gr_complex_to_float::work (int noutput_items,
switch (output_items.size ()){
case 1:
+#if 1
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out0[i] = in[i].real ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_real_32f_a(out0, in, noi);
+ }
+#else
for (int i = 0; i < noi; i++){
out0[i] = in[i].real ();
}
+#endif
break;
case 2:
+#if 1
+ out1 = (float *) output_items[1];
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out0[i] = in[i].real ();
+ out1[i] = in[i].imag ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_32f_x2_a(out0, out1, in, noi);
+ }
+#else
out1 = (float *) output_items[1];
for (int i = 0; i < noi; i++){
out0[i] = in[i].real ();
out1[i] = in[i].imag ();
}
+#endif
break;
default:
@@ -102,9 +126,21 @@ gr_complex_to_real::work (int noutput_items,
float *out = (float *) output_items[0];
int noi = noutput_items * d_vlen;
+#if 1
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out[i] = in[i].real ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_real_32f_a(out, in, noi);
+ }
+#else
for (int i = 0; i < noi; i++){
- out[i] = in[i].real ();
+ out0[i] = in[i].real ();
}
+#endif
+
return noutput_items;
}
@@ -133,9 +169,20 @@ gr_complex_to_imag::work (int noutput_items,
float *out = (float *) output_items[0];
int noi = noutput_items * d_vlen;
+#if 1
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out[i] = in[i].imag ();
+ }
+ }
+ else {
+ volk_32fc_deinterleave_imag_32f_a(out, in, noi);
+ }
+#else
for (int i = 0; i < noi; i++){
out[i] = in[i].imag ();
}
+#endif
return noutput_items;
}
@@ -236,9 +283,20 @@ gr_complex_to_arg::work (int noutput_items,
float *out = (float *) output_items[0];
int noi = noutput_items * d_vlen;
+#if 1
+ if(is_unaligned()) {
+ for (int i = 0; i < noi; i++){
+ out[i] = gr_fast_atan2f(in[i]);
+ }
+ }
+ else {
+ volk_32fc_s32f_atan2_32f_a(out, in, 1, noi);
+ }
+#else
for (int i = 0; i < noi; i++){
// out[i] = std::arg (in[i]);
out[i] = gr_fast_atan2f(in[i]);
}
+#endif
return noutput_items;
}