commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 09/10: qtgui: in sink_c and sink_f, use vol


From: git
Subject: [Commit-gnuradio] [gnuradio] 09/10: qtgui: in sink_c and sink_f, use volk_malloc/volk_free instead of new for buffers.
Date: Tue, 11 Feb 2014 21:11:23 +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 0c226aa65ef6c5427708cffca71e5dfb1cebecb5
Author: Tom Rondeau <address@hidden>
Date:   Tue Feb 11 15:07:29 2014 -0500

    qtgui: in sink_c and sink_f, use volk_malloc/volk_free instead of new for 
buffers.
---
 gr-qtgui/lib/sink_c_impl.cc | 30 +++++++++++++++++-------------
 gr-qtgui/lib/sink_f_impl.cc | 30 +++++++++++++++++-------------
 2 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc
index ddeabf8..d9341ba 100644
--- a/gr-qtgui/lib/sink_c_impl.cc
+++ b/gr-qtgui/lib/sink_c_impl.cc
@@ -31,7 +31,7 @@
 
 namespace gr {
   namespace qtgui {
-    
+
     sink_c::sptr
     sink_c::make(int fftsize, int wintype,
                 double fc, double bw,
@@ -78,11 +78,13 @@ namespace gr {
       // this is usually desired when plotting
       d_shift = true;
 
-      d_fft = new fft::fft_complex (d_fftsize, true);
+      d_fft = new fft::fft_complex(d_fftsize, true);
 
       d_index = 0;
-      d_residbuf = new gr_complex[d_fftsize];
-      d_magbuf = new float[d_fftsize];
+      d_residbuf = (gr_complex*)volk_malloc(d_fftsize*sizeof(gr_complex),
+                                            volk_get_alignment());
+      d_magbuf = (float*)volk_malloc(d_fftsize*sizeof(float),
+                                     volk_get_alignment());
 
       buildwindow();
 
@@ -92,10 +94,10 @@ namespace gr {
     sink_c_impl::~sink_c_impl()
     {
       delete d_main_gui;
-      delete [] d_residbuf;
-      delete [] d_magbuf;
       delete d_fft;
       delete d_argv;
+      volk_free(d_residbuf);
+      volk_free(d_magbuf);
     }
 
     bool
@@ -272,14 +274,16 @@ namespace gr {
       if(newfftsize != d_fftsize) {
 
        // Resize residbuf and replace data
-       delete [] d_residbuf;
-       d_residbuf = new gr_complex[newfftsize];
+        volk_free(d_residbuf);
+        d_residbuf = (gr_complex*)volk_malloc(newfftsize*sizeof(gr_complex),
+                                              volk_get_alignment());
 
-       delete [] d_magbuf;
-       d_magbuf = new float[newfftsize];
+        volk_free(d_magbuf);
+        d_magbuf = (float*)volk_malloc(newfftsize*sizeof(float),
+                                       volk_get_alignment());
 
-       // Set new fft size and reset buffer index 
-       // (throws away any currently held data, but who cares?) 
+       // Set new fft size and reset buffer index
+       // (throws away any currently held data, but who cares?)
        d_fftsize = newfftsize;
        d_index = 0;
 
@@ -328,7 +332,7 @@ namespace gr {
 
          j += resid;
          fft(d_magbuf, d_residbuf, d_fftsize);
-      
+
          d_main_gui->updateWindow(true, d_magbuf, d_fftsize,
                                   NULL, 0, (float*)d_residbuf, d_fftsize,
                                   currentTime, true);
diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc
index 63f4b55..178eb1b 100644
--- a/gr-qtgui/lib/sink_f_impl.cc
+++ b/gr-qtgui/lib/sink_f_impl.cc
@@ -31,7 +31,7 @@
 
 namespace gr {
   namespace qtgui {
-    
+
     sink_f::sptr
     sink_f::make(int fftsize, int wintype,
                 double fc, double bw,
@@ -78,11 +78,13 @@ namespace gr {
       // this is usually desired when plotting
       d_shift = true;
 
-      d_fft = new fft::fft_complex (d_fftsize, true);
+      d_fft = new fft::fft_complex(d_fftsize, true);
 
       d_index = 0;
-      d_residbuf = new float[d_fftsize];
-      d_magbuf = new float[d_fftsize];
+      d_residbuf = (float*)volk_malloc(d_fftsize*sizeof(float),
+                                       volk_get_alignment());
+      d_magbuf = (float*)volk_malloc(d_fftsize*sizeof(float),
+                                     volk_get_alignment());
 
       buildwindow();
 
@@ -92,10 +94,10 @@ namespace gr {
     sink_f_impl::~sink_f_impl()
     {
       delete d_main_gui;
-      delete [] d_residbuf;
-      delete [] d_magbuf;
       delete d_fft;
       delete d_argv;
+      volk_free(d_residbuf);
+      volk_free(d_magbuf);
     }
 
     bool
@@ -267,14 +269,16 @@ namespace gr {
       if(newfftsize != d_fftsize) {
 
        // Resize residbuf and replace data
-       delete [] d_residbuf;
-       d_residbuf = new float[newfftsize];
+        volk_free(d_residbuf);
+        d_residbuf = (float*)volk_malloc(newfftsize*sizeof(float),
+                                         volk_get_alignment());
 
-       delete [] d_magbuf;
-       d_magbuf = new float[newfftsize];
+        volk_free(d_magbuf);
+        d_magbuf = (float*)volk_malloc(newfftsize*sizeof(float),
+                                       volk_get_alignment());
 
-       // Set new fft size and reset buffer index 
-       // (throws away any currently held data, but who cares?) 
+       // Set new fft size and reset buffer index
+       // (throws away any currently held data, but who cares?)
        d_fftsize = newfftsize;
        d_index = 0;
 
@@ -314,7 +318,7 @@ namespace gr {
 
          j += resid;
          fft(d_magbuf, d_residbuf, d_fftsize);
-      
+
          d_main_gui->updateWindow(true, d_magbuf, d_fftsize,
                                   (float*)d_residbuf, d_fftsize, NULL, 0,
                                   currentTime, true);



reply via email to

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