commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/28: gr-basic: volkified the add fn for f


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/28: gr-basic: volkified the add fn for f32
Date: Mon, 15 Aug 2016 00:47:04 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

nwest pushed a commit to annotated tag gr_basic_work
in repository gnuradio.

commit ee747e8a504abc67f8a6c95b5097547a7dca37ea
Author: Nick Foster <address@hidden>
Date:   Tue Nov 8 15:39:48 2011 -0800

    gr-basic: volkified the add fn for f32
---
 gr-basic/lib/CMakeLists.txt  |  2 ++
 gr-basic/lib/gr_basic_add.cc | 10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gr-basic/lib/CMakeLists.txt b/gr-basic/lib/CMakeLists.txt
index dd4e551..71e9ff7 100644
--- a/gr-basic/lib/CMakeLists.txt
+++ b/gr-basic/lib/CMakeLists.txt
@@ -26,6 +26,7 @@ include_directories(
 )
 
 include_directories(${Boost_INCLUDE_DIRS})
+include_directories(${VOLK_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})
 
 ########################################################################
@@ -38,6 +39,7 @@ list(APPEND gr_basic_sources
 list(APPEND basic_libs
     gnuradio-core
     ${Boost_LIBRARIES}
+    volk
 )
 
 add_library(gnuradio-basic SHARED ${gr_basic_sources})
diff --git a/gr-basic/lib/gr_basic_add.cc b/gr-basic/lib/gr_basic_add.cc
index 62e4207..b9bb879 100644
--- a/gr-basic/lib/gr_basic_add.cc
+++ b/gr-basic/lib/gr_basic_add.cc
@@ -23,6 +23,7 @@
 #include <gr_io_signature.h>
 #include <stdexcept>
 #include <complex>
+#include <volk/volk.h>
 
 /***********************************************************************
  * Adder implementation with complex float 32
@@ -39,7 +40,9 @@ public:
         ),
         _vlen(vlen)
     {
-        //TODO this is where you set output multiple for volk
+        int alignment_multiple = volk_get_alignment() / (sizeof(my_type)*vlen);
+        if(alignment_multiple < 1) alignment_multiple = 1;
+        set_output_multiple(alignment_multiple);
     }
 
     int work(
@@ -54,11 +57,16 @@ public:
         for (size_t n = 1; n < input_items.size(); n++){
             const my_type *in = reinterpret_cast<const my_type 
*>(input_items[n]);
             //TODO - this is where you call into volk
+            volk_32f_x2_add_32f_a((float *)out, (float *)in0, (float *)in, 
n_nums*2);
+            /*
             for (size_t i = 0; i < n_nums; i++){
                 out[i] = in0[i] + in[i];
             }
+            */
             in0 = out; //for next input, we do output += input
         }
+
+        return noutput_items;
     }
 
 private:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]