commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 04/07: filter: switched from using fft::mal


From: git
Subject: [Commit-gnuradio] [gnuradio] 04/07: filter: switched from using fft::malloc to volk_malloc.
Date: Sat, 18 Jan 2014 20:31:59 +0000 (UTC)

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

trondeau pushed a commit to branch master
in repository gnuradio.

commit 44437ce278984e6aedc1b7010edf06c3e9dbb6a8
Author: Tom Rondeau <address@hidden>
Date:   Tue Jan 14 18:13:58 2014 -0500

    filter: switched from using fft::malloc to volk_malloc.
---
 gr-filter/lib/fft_filter.cc                  | 16 +++++--
 gr-filter/lib/fir_filter.cc                  | 60 +++++++++++++-------------
 gr-filter/lib/fir_filter_with_buffer.cc      | 49 ++++++++++-----------
 gr-filter/lib/qa_fir_filter_with_buffer.cc   | 64 +++++++++++++++-------------
 gr-filter/lib/qa_mmse_fir_interpolator_cc.cc |  6 ++-
 gr-filter/lib/qa_mmse_fir_interpolator_ff.cc |  5 ++-
 6 files changed, 108 insertions(+), 92 deletions(-)

diff --git a/gr-filter/lib/fft_filter.cc b/gr-filter/lib/fft_filter.cc
index 8293757..b45344d 100644
--- a/gr-filter/lib/fft_filter.cc
+++ b/gr-filter/lib/fft_filter.cc
@@ -48,7 +48,8 @@ namespace gr {
       {
        delete d_fwdfft;
        delete d_invfft;
-       fft::free(d_xformed_taps);
+        if(d_xformed_taps != NULL)
+          volk_free(d_xformed_taps);
       }
 
       /*
@@ -106,9 +107,12 @@ namespace gr {
        if(d_fftsize != old_fftsize) {
          delete d_fwdfft;
          delete d_invfft;
+          if(d_xformed_taps != NULL)
+            volk_free(d_xformed_taps);
          d_fwdfft = new fft::fft_real_fwd(d_fftsize);
          d_invfft = new fft::fft_real_rev(d_fftsize);
-         d_xformed_taps = fft::malloc_complex(d_fftsize/2+1);
+         d_xformed_taps = 
(gr_complex*)volk_malloc(sizeof(gr_complex)*d_fftsize/2+1,
+                                                    volk_get_alignment());
        }
       }
 
@@ -201,7 +205,8 @@ namespace gr {
       {
        delete d_fwdfft;
        delete d_invfft;
-       fft::free(d_xformed_taps);
+        if(d_xformed_taps != NULL)
+          volk_free(d_xformed_taps);
       }
 
       /*
@@ -259,9 +264,12 @@ namespace gr {
        if(d_fftsize != old_fftsize) {
          delete d_fwdfft;
          delete d_invfft;
+          if(d_xformed_taps != NULL)
+            volk_free(d_xformed_taps);
          d_fwdfft = new fft::fft_complex(d_fftsize, true, d_nthreads);
          d_invfft = new fft::fft_complex(d_fftsize, false, d_nthreads);
-         d_xformed_taps = fft::malloc_complex(d_fftsize);
+         d_xformed_taps = 
(gr_complex*)volk_malloc(sizeof(gr_complex)*d_fftsize,
+                                                    volk_get_alignment());
        }
       }
 
diff --git a/gr-filter/lib/fir_filter.cc b/gr-filter/lib/fir_filter.cc
index 552936b..e322cfb 100644
--- a/gr-filter/lib/fir_filter.cc
+++ b/gr-filter/lib/fir_filter.cc
@@ -40,7 +40,7 @@ namespace gr {
        set_taps(taps);
 
        // Make sure the output sample is always aligned, too.
-       d_output = fft::malloc_float(1);
+       d_output = (float*)volk_malloc(1*sizeof(float), d_align);
       }
       
       fir_filter_fff::~fir_filter_fff()
@@ -48,14 +48,14 @@ namespace gr {
        // Free all aligned taps
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
        }
 
        // Free output sample
-       fft::free(d_output);
+       volk_free(d_output);
       }
       
       void
@@ -64,7 +64,7 @@ namespace gr {
        // Free the taps if already allocated
        if(d_aligned_taps!= NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
@@ -77,7 +77,7 @@ namespace gr {
        // Make a set of taps at all possible arch alignments
        d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
        for(int i = 0; i < d_naligned; i++) {
-         d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+          d_aligned_taps[i] = 
(float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
          memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
          for(unsigned int j = 0; j < d_ntaps; j++)
            d_aligned_taps[i][i+j] = d_taps[j];
@@ -154,7 +154,7 @@ namespace gr {
        set_taps(taps);
 
        // Make sure the output sample is always aligned, too.
-       d_output = fft::malloc_complex(1);
+       d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
       }
       
       fir_filter_ccf::~fir_filter_ccf()
@@ -162,14 +162,14 @@ namespace gr {
        // Free all aligned taps
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
        }
 
        // Free output sample
-       fft::free(d_output);
+       volk_free(d_output);
       }
       
       void
@@ -178,7 +178,7 @@ namespace gr {
        // Free the taps if already allocated
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
@@ -191,7 +191,7 @@ namespace gr {
        // Make a set of taps at all possible arch alignments
        d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
        for(int i = 0; i < d_naligned; i++) {
-         d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+          d_aligned_taps[i] = 
(float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
          memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
          for(unsigned int j = 0; j < d_ntaps; j++)
            d_aligned_taps[i][i+j] = d_taps[j];
@@ -270,7 +270,7 @@ namespace gr {
        set_taps(taps);
 
        // Make sure the output sample is always aligned, too.
-       d_output = fft::malloc_complex(1);
+       d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
       }
       
       fir_filter_fcc::~fir_filter_fcc()
@@ -278,14 +278,14 @@ namespace gr {
        // Free all aligned taps
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
        }
 
        // Free output sample
-       fft::free(d_output);
+       volk_free(d_output);
       }
       
       void
@@ -294,7 +294,7 @@ namespace gr {
        // Free the taps if already allocated
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
@@ -307,7 +307,7 @@ namespace gr {
        // Make a set of taps at all possible arch alignments
        d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
        for(int i = 0; i < d_naligned; i++) {
-         d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
+          d_aligned_taps[i] = 
(gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
          memset(d_aligned_taps[i], 0, 
sizeof(gr_complex)*(d_ntaps+d_naligned-1));
          for(unsigned int j = 0; j < d_ntaps; j++)
            d_aligned_taps[i][i+j] = d_taps[j];
@@ -386,7 +386,7 @@ namespace gr {
        set_taps(taps);
 
        // Make sure the output sample is always aligned, too.
-       d_output = fft::malloc_complex(1);
+       d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
       }
       
       fir_filter_ccc::~fir_filter_ccc()
@@ -394,14 +394,14 @@ namespace gr {
        // Free all aligned taps
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
        }
 
        // Free output sample
-       fft::free(d_output);
+       volk_free(d_output);
       }
       
       void
@@ -410,7 +410,7 @@ namespace gr {
        // Free the taps if already allocated
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
@@ -423,7 +423,7 @@ namespace gr {
        // Make a set of taps at all possible arch alignments
        d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
        for(int i = 0; i < d_naligned; i++) {
-         d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
+          d_aligned_taps[i] = 
(gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
          memset(d_aligned_taps[i], 0, 
sizeof(gr_complex)*(d_ntaps+d_naligned-1));
          for(unsigned int j = 0; j < d_ntaps; j++)
            d_aligned_taps[i][i+j] = d_taps[j];
@@ -500,7 +500,7 @@ namespace gr {
        set_taps(taps);
 
        // Make sure the output sample is always aligned, too.
-       d_output = fft::malloc_complex(1);
+       d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
       }
       
       fir_filter_scc::~fir_filter_scc()
@@ -508,14 +508,14 @@ namespace gr {
        // Free all aligned taps
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
        }
 
        // Free output sample
-       fft::free(d_output);
+       volk_free(d_output);
       }
       
       void
@@ -524,7 +524,7 @@ namespace gr {
        // Free the taps if already allocated
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
@@ -537,7 +537,7 @@ namespace gr {
        // Make a set of taps at all possible arch alignments
        d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
        for(int i = 0; i < d_naligned; i++) {
-         d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
+          d_aligned_taps[i] = 
(gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
          memset(d_aligned_taps[i], 0, 
sizeof(gr_complex)*(d_ntaps+d_naligned-1));
          for(unsigned int j = 0; j < d_ntaps; j++)
            d_aligned_taps[i][i+j] = d_taps[j];
@@ -615,7 +615,7 @@ namespace gr {
        set_taps(taps);
 
        // Make sure the output sample is always aligned, too.
-       d_output = (short*)fft::malloc_float(1);
+       d_output = (short*)volk_malloc(1*sizeof(short), d_align);
       }
       
       fir_filter_fsf::~fir_filter_fsf()
@@ -623,14 +623,14 @@ namespace gr {
        // Free all aligned taps
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
        }
 
        // Free output sample
-       fft::free(d_output);
+       volk_free(d_output);
       }
       
       void
@@ -639,7 +639,7 @@ namespace gr {
        // Free the taps if already allocated
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
@@ -652,7 +652,7 @@ namespace gr {
        // Make a set of taps at all possible arch alignments
        d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
        for(int i = 0; i < d_naligned; i++) {
-         d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+          d_aligned_taps[i] = 
(float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
          memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
          for(unsigned int j = 0; j < d_ntaps; j++)
            d_aligned_taps[i][i+j] = d_taps[j];
diff --git a/gr-filter/lib/fir_filter_with_buffer.cc 
b/gr-filter/lib/fir_filter_with_buffer.cc
index 9953d48..4191dc3 100644
--- a/gr-filter/lib/fir_filter_with_buffer.cc
+++ b/gr-filter/lib/fir_filter_with_buffer.cc
@@ -45,41 +45,41 @@ namespace gr {
        set_taps(taps);
 
        // Make sure the output sample is always aligned, too.
-       d_output = fft::malloc_float(1);
+       d_output = (float*)volk_malloc(1*sizeof(float), d_align);
       }
 
       fir_filter_with_buffer_fff::~fir_filter_with_buffer_fff()
       {
        if(d_buffer_ptr != NULL) {
-         fft::free(d_buffer_ptr);
+         volk_free(d_buffer_ptr);
          d_buffer_ptr = NULL;
        }
        
        // Free aligned taps
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
        }
 
        // Free output sample
-       fft::free(d_output);
+       volk_free(d_output);
       }
 
       void
       fir_filter_with_buffer_fff::set_taps(const std::vector<float> &taps)
       {
        if(d_buffer_ptr != NULL) {
-         fft::free(d_buffer_ptr);
+         volk_free(d_buffer_ptr);
          d_buffer_ptr = NULL;
        }
 
        // Free the taps if already allocated
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
@@ -95,14 +95,15 @@ namespace gr {
        // problems). We then set d_buffer to the position in the
        // d_buffer_ptr such that we only touch the internally
        // allocated space.
-       d_buffer_ptr = fft::malloc_float(2*(d_ntaps + d_naligned));
+        d_buffer_ptr = (float*)volk_malloc((2*(d_ntaps + 
d_naligned))*sizeof(float), d_align);
+
        memset(d_buffer_ptr, 0, 2*(d_ntaps + d_naligned)*sizeof(float));
        d_buffer = d_buffer_ptr + d_naligned;
 
        // Allocate aligned taps
        d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
        for(int i = 0; i < d_naligned; i++) {
-         d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+         d_aligned_taps[i] = 
(float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
          memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
          for(unsigned int j = 0; j < d_ntaps; j++)
            d_aligned_taps[i][i+j] = d_taps[j];
@@ -198,41 +199,41 @@ namespace gr {
        set_taps(taps);
 
        // Make sure the output sample is always aligned, too.
-       d_output = fft::malloc_complex(1);
+       d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
       }
 
       fir_filter_with_buffer_ccc::~fir_filter_with_buffer_ccc()
       {
        if(d_buffer_ptr != NULL) {
-         fft::free(d_buffer_ptr);
+         volk_free(d_buffer_ptr);
          d_buffer_ptr = NULL;
        }
        
        // Free aligned taps
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
        }
 
        // Free output sample
-       fft::free(d_output);
+       volk_free(d_output);
       }
 
       void
       fir_filter_with_buffer_ccc::set_taps(const std::vector<gr_complex> &taps)
       {
        if(d_buffer_ptr != NULL) {
-         fft::free(d_buffer_ptr);
+         volk_free(d_buffer_ptr);
          d_buffer_ptr = NULL;
        }
 
        // Free the taps if already allocated
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
@@ -248,14 +249,14 @@ namespace gr {
        // problems). We then set d_buffer to the position in the
        // d_buffer_ptr such that we only touch the internally
        // allocated space.
-       d_buffer_ptr = fft::malloc_complex(2*(d_ntaps + d_naligned));
+        d_buffer_ptr = (gr_complex*)volk_malloc((2*(d_ntaps + 
d_naligned))*sizeof(gr_complex), d_align);
        memset(d_buffer_ptr, 0, 2*(d_ntaps + d_naligned)*sizeof(gr_complex));
        d_buffer = d_buffer_ptr + d_naligned;
 
        // Allocate aligned taps
        d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
        for(int i = 0; i < d_naligned; i++) {
-         d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
+         d_aligned_taps[i] = 
(gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
          memset(d_aligned_taps[i], 0, 
sizeof(gr_complex)*(d_ntaps+d_naligned-1));
          for(unsigned int j = 0; j < d_ntaps; j++)
            d_aligned_taps[i][i+j] = d_taps[j];
@@ -351,41 +352,41 @@ namespace gr {
        set_taps(taps);
 
        // Make sure the output sample is always aligned, too.
-       d_output = fft::malloc_complex(1);
+       d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
       }
 
       fir_filter_with_buffer_ccf::~fir_filter_with_buffer_ccf()
       {
        if(d_buffer_ptr != NULL) {
-         fft::free(d_buffer_ptr);
+         volk_free(d_buffer_ptr);
          d_buffer_ptr = NULL;
        }
        
        // Free aligned taps
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
        }
 
        // Free output sample
-       fft::free(d_output);
+       volk_free(d_output);
       }
 
       void
       fir_filter_with_buffer_ccf::set_taps(const std::vector<float> &taps)
       {
        if(d_buffer_ptr != NULL) {
-         fft::free(d_buffer_ptr);
+         volk_free(d_buffer_ptr);
          d_buffer_ptr = NULL;
        }
 
        // Free the taps if already allocated
        if(d_aligned_taps != NULL) {
          for(int i = 0; i < d_naligned; i++) {
-           fft::free(d_aligned_taps[i]);
+           volk_free(d_aligned_taps[i]);
          }
          ::free(d_aligned_taps);
          d_aligned_taps = NULL;
@@ -401,14 +402,14 @@ namespace gr {
        // problems). We then set d_buffer to the position in the
        // d_buffer_ptr such that we only touch the internally
        // allocated space.
-       d_buffer_ptr = fft::malloc_complex(2*(d_ntaps + d_naligned));
+        d_buffer_ptr = (gr_complex*)volk_malloc((2*(d_ntaps + 
d_naligned))*sizeof(gr_complex), d_align);
        memset(d_buffer_ptr, 0, 2*(d_ntaps + d_naligned)*sizeof(gr_complex));
        d_buffer = d_buffer_ptr + d_naligned;
 
        // Allocate aligned taps
        d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
        for(int i = 0; i < d_naligned; i++) {
-         d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
+         d_aligned_taps[i] = 
(float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
          memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
          for(unsigned int j = 0; j < d_ntaps; j++)
            d_aligned_taps[i][i+j] = d_taps[j];
diff --git a/gr-filter/lib/qa_fir_filter_with_buffer.cc 
b/gr-filter/lib/qa_fir_filter_with_buffer.cc
index 92aca73..06d44f6 100644
--- a/gr-filter/lib/qa_fir_filter_with_buffer.cc
+++ b/gr-filter/lib/qa_fir_filter_with_buffer.cc
@@ -28,6 +28,7 @@
 #include <qa_fir_filter_with_buffer.h>
 #include <gnuradio/filter/fir_filter_with_buffer.h>
 #include <gnuradio/fft/fft.h>
+#include <volk/volk.h>
 #include <cppunit/TestAssert.h>
 #include <cmath>
 #include <gnuradio/random.h>
@@ -110,13 +111,14 @@ namespace gr {
        const int MAX_TAPS   = 29;
        const int OUTPUT_LEN = 37;
        const int INPUT_LEN  = MAX_TAPS + OUTPUT_LEN;
+        size_t align = volk_get_alignment();
 
        // Mem aligned buffer not really necessary, but why not?
-       i_type   *input = fft::malloc_float(INPUT_LEN);
-       i_type   *dline = fft::malloc_float(INPUT_LEN);
-       o_type   *expected_output = fft::malloc_float(OUTPUT_LEN);
-       o_type   *actual_output = fft::malloc_float(OUTPUT_LEN);
-       tap_type *taps = fft::malloc_float(MAX_TAPS);
+       i_type   *input = (float*)volk_malloc(INPUT_LEN*sizeof(float), align);
+       i_type   *dline = (float*)volk_malloc(INPUT_LEN*sizeof(float), align);
+       o_type   *expected_output = 
(float*)volk_malloc(OUTPUT_LEN*sizeof(float), align);
+       o_type   *actual_output = (float*)volk_malloc(OUTPUT_LEN*sizeof(float), 
align);
+       tap_type *taps = (float*)volk_malloc(MAX_TAPS*sizeof(float), align);
 
        srandom(0);     // we want reproducibility
        memset(dline, 0, INPUT_LEN*sizeof(i_type));
@@ -163,11 +165,11 @@ namespace gr {
            delete f1;
          }
        }
-       fft::free(input);
-       fft::free(dline);
-       fft::free(expected_output);
-       fft::free(actual_output);
-       fft::free(taps);
+       volk_free(input);
+       volk_free(dline);
+       volk_free(expected_output);
+       volk_free(actual_output);
+       volk_free(taps);
       }
 
     } /* namespace fff */
@@ -225,13 +227,14 @@ namespace gr {
        const int MAX_TAPS   = 29;
        const int OUTPUT_LEN = 37;
        const int INPUT_LEN  = MAX_TAPS + OUTPUT_LEN;
+        size_t align = volk_get_alignment();
 
        // Mem aligned buffer not really necessary, but why not?
-       i_type   *input = fft::malloc_complex(INPUT_LEN);
-       i_type   *dline = fft::malloc_complex(INPUT_LEN);
-       o_type   *expected_output = fft::malloc_complex(OUTPUT_LEN);
-       o_type   *actual_output = fft::malloc_complex(OUTPUT_LEN);
-       tap_type *taps = fft::malloc_complex(MAX_TAPS);
+       i_type   *input = 
(gr_complex*)volk_malloc(INPUT_LEN*sizeof(gr_complex), align);
+       i_type   *dline = 
(gr_complex*)volk_malloc(INPUT_LEN*sizeof(gr_complex), align);
+       o_type   *expected_output = 
(gr_complex*)volk_malloc(OUTPUT_LEN*sizeof(gr_complex), align);
+       o_type   *actual_output = 
(gr_complex*)volk_malloc(OUTPUT_LEN*sizeof(gr_complex), align);
+       tap_type *taps = (gr_complex*)volk_malloc(MAX_TAPS*sizeof(gr_complex), 
align);
 
        srandom(0);     // we want reproducibility
        memset(dline, 0, INPUT_LEN*sizeof(i_type));
@@ -278,11 +281,11 @@ namespace gr {
            delete f1;
          }
        }
-       fft::free(input);
-       fft::free(dline);
-       fft::free(expected_output);
-       fft::free(actual_output);
-       fft::free(taps);
+       volk_free(input);
+       volk_free(dline);
+       volk_free(expected_output);
+       volk_free(actual_output);
+       volk_free(taps);
       }
 
     } /* namespace ccc */
@@ -340,13 +343,14 @@ namespace gr {
        const int MAX_TAPS   = 29;
        const int OUTPUT_LEN = 37;
        const int INPUT_LEN  = MAX_TAPS + OUTPUT_LEN;
+        size_t align = volk_get_alignment();
 
        // Mem aligned buffer not really necessary, but why not?
-       i_type   *input = fft::malloc_complex(INPUT_LEN);
-       i_type   *dline = fft::malloc_complex(INPUT_LEN);
-       o_type   *expected_output = fft::malloc_complex(OUTPUT_LEN);
-       o_type   *actual_output = fft::malloc_complex(OUTPUT_LEN);
-       tap_type *taps = fft::malloc_float(MAX_TAPS);
+       i_type   *input = 
(gr_complex*)volk_malloc(INPUT_LEN*sizeof(gr_complex), align);
+       i_type   *dline = 
(gr_complex*)volk_malloc(INPUT_LEN*sizeof(gr_complex), align);
+       o_type   *expected_output = 
(gr_complex*)volk_malloc(OUTPUT_LEN*sizeof(gr_complex), align);
+       o_type   *actual_output = 
(gr_complex*)volk_malloc(OUTPUT_LEN*sizeof(gr_complex), align);
+       tap_type *taps = (float*)volk_malloc(MAX_TAPS*sizeof(float), align);
 
        srandom(0);     // we want reproducibility
        memset(dline, 0, INPUT_LEN*sizeof(i_type));
@@ -393,11 +397,11 @@ namespace gr {
            delete f1;
          }
        }
-       fft::free(input);
-       fft::free(dline);
-       fft::free(expected_output);
-       fft::free(actual_output);
-       fft::free(taps);
+       volk_free(input);
+       volk_free(dline);
+       volk_free(expected_output);
+       volk_free(actual_output);
+       volk_free(taps);
       }
 
     } /* namespace ccf */
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc 
b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
index 8d1ec53..8057e1d 100644
--- a/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
@@ -28,6 +28,7 @@
 #include <qa_mmse_fir_interpolator_cc.h>
 #include <gnuradio/filter/mmse_fir_interpolator_cc.h>
 #include <gnuradio/fft/fft.h>
+#include <volk/volk.h>
 #include <cstdio>
 #include <cmath>
 #include <stdexcept>
@@ -61,7 +62,8 @@ namespace gr {
     qa_mmse_fir_interpolator_cc::t1()
     {
       static const unsigned N = 100;
-      gr_complex *input = fft::malloc_complex(N + 10);
+      gr_complex *input = (gr_complex*)volk_malloc((N + 10)*sizeof(gr_complex),
+                                                   volk_get_alignment());
 
       for(unsigned i = 0; i < N+10; i++)
        input[i] = test_fcn((double) i);
@@ -78,7 +80,7 @@ namespace gr {
          // printf ("%9.6f  %9.6f  %9.6f\n", expected, actual, expected - 
actual);
        }
       }
-      fft::free(input);
+      volk_free(input);
     }
 
     /*
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc 
b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
index 9e9c6cf..b2e3d34 100644
--- a/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
@@ -28,6 +28,7 @@
 #include <qa_mmse_fir_interpolator_ff.h>
 #include <gnuradio/filter/mmse_fir_interpolator_ff.h>
 #include <gnuradio/fft/fft.h>
+#include <volk/volk.h>
 #include <cstdio>
 #include <cmath>
 
@@ -47,7 +48,7 @@ namespace gr {
       // use aligned malloc and make sure that everything in this
       // buffer is properly initialized.
       static const unsigned N = 100;
-      float *input = fft::malloc_float(N + 10);
+      float *input = (float*)volk_malloc((N + 10)*sizeof(float), 
volk_get_alignment());
 
       for(unsigned i = 0; i < N+10; i++)
        input[i] = test_fcn((double) i);
@@ -64,7 +65,7 @@ namespace gr {
          // printf ("%9.6f  %9.6f  %9.6f\n", expected, actual, expected - 
actual);
        }
       }
-      fft::free(input);
+      volk_free(input);
     }
 
   } /* namespace filter */



reply via email to

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