commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8243 - in gnuradio/branches/developers/eb/gcell: conf


From: eb
Subject: [Commit-gnuradio] r8243 - in gnuradio/branches/developers/eb/gcell: config gr-gcell/src
Date: Tue, 22 Apr 2008 15:47:20 -0600 (MDT)

Author: eb
Date: 2008-04-22 15:47:18 -0600 (Tue, 22 Apr 2008)
New Revision: 8243

Modified:
   gnuradio/branches/developers/eb/gcell/config/grc_gcell.m4
   gnuradio/branches/developers/eb/gcell/gr-gcell/src/Makefile.am
   gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.cc
   gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.h
   gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.i
Log:
gr-gcell QA now working

Modified: gnuradio/branches/developers/eb/gcell/config/grc_gcell.m4
===================================================================
--- gnuradio/branches/developers/eb/gcell/config/grc_gcell.m4   2008-04-22 
06:17:57 UTC (rev 8242)
+++ gnuradio/branches/developers/eb/gcell/config/grc_gcell.m4   2008-04-22 
21:47:18 UTC (rev 8243)
@@ -65,6 +65,11 @@
        gcell_spu_LA="\${abs_top_builddir}/gcell/src/lib/spu/libgcell_spu.a"
        AC_SUBST(gcell_spu_INCLUDES)
        AC_SUBST(gcell_spu_LA)
+
+        dnl kludge up initial swig dependency files
+        AC_CONFIG_COMMANDS([swig_gcell_deps], [
+            touch gr-gcell/src/gcell.d
+        ])
     fi
 
     AC_CONFIG_FILES([ \

Modified: gnuradio/branches/developers/eb/gcell/gr-gcell/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell/gr-gcell/src/Makefile.am      
2008-04-22 06:17:57 UTC (rev 8242)
+++ gnuradio/branches/developers/eb/gcell/gr-gcell/src/Makefile.am      
2008-04-22 21:47:18 UTC (rev 8243)
@@ -95,9 +95,24 @@
 swiginclude_HEADERS = \
        $(LOCAL_IFILES)
 
-gcell.cc gcell.py: $(LOCAL_IFILES) $(NON_LOCAL_IFILES)
-       $(SWIG) $(SWIGPYTHONARGS) -module gcell -o gcell.cc $(LOCAL_IFILES)
+#gcell.cc gcell.py: $(LOCAL_IFILES) $(NON_LOCAL_IFILES)
+#      $(SWIG) $(SWIGPYTHONARGS) -module gcell -o gcell.cc $(LOCAL_IFILES)
 
+# KLUDGE: Force runtime include of gcell.d dependency file.
+# This is not guaranteed to be portable, but will probably work.
+# If it works, we have accurate dependencies for our swig stuff, which is good.
address@hidden@ @address@hidden/address@hidden@
+
+gcell.py gcell.h: gcell.cc
+
+gcell.cc : gcell.i $(GNURADIO_I)
+       if $(SWIG) $(SWIGPYTHONARGS) -MMD -MF gcell.Td -module gcell -o 
gcell.cc $(srcdir)/gcell.i ;\
+       then if test $(host_os) = mingw32; \
+            then sed 's,\\\\,/,g' <gcell.Td >gcell.d; rm -f gcell.Td; \
+            else mv -f gcell.Td gcell.d; fi \
+       else rm -f gcell.Td; exit 1; fi 
+
+
 noinst_PYTHON =  \
        qa_gcell.py
 
@@ -110,3 +125,6 @@
 dist-hook:
        @for file in $(swig_built_sources); do echo $(RM) $(distdir)/$$file; 
done
        @for file in $(swig_built_sources); do $(RM) $(distdir)/$$file; done
+
+DISTCLEANFILES = \
+       gcell.d

Modified: gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.cc 
2008-04-22 06:17:57 UTC (rev 8242)
+++ gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.cc 
2008-04-22 21:47:18 UTC (rev 8243)
@@ -29,13 +29,20 @@
 #include <gc_job_manager.h>
 #include <gc_aligned_alloc.h>
 #include <gcp_fft_1d_r2.h>
-#include <gr_math.h>
 #include <math.h>
 #include <assert.h>
+#include <stdexcept>
 
+
 #define MIN_FFT_SIZE     32
 #define        MAX_FFT_SIZE    4096
 
+inline static bool
+is_power_of_2(int x)
+{
+  return x != 0 && (x & (x-1)) == 0;
+}
+
 static int 
 log2(int x)    // x is an exact power of 2
 {
@@ -46,22 +53,40 @@
   assert(0);
 }
 
+#if 0
 gr_fft_vcc_sptr
 gcell_make_fft_vcc(int fft_size, bool forward, const std::vector<float> 
&window, bool shift)
 {
   // If it doesn't meet our constraints, use standard implemenation
   if (fft_size < MIN_FFT_SIZE || fft_size > MAX_FFT_SIZE
-      || !gr_is_power_of_2(fft_size)
+      || !is_power_of_2(fft_size)
       || (window.size() != 0 && fft_size > MAX_FFT_SIZE/2))
     return gr_make_fft_vcc(fft_size, forward, window, shift);
   else
     return gr_fft_vcc_sptr (new gcell_fft_vcc(fft_size, forward, window, 
shift));
 }
+#else
 
+gcell_fft_vcc_sptr
+gcell_make_fft_vcc(int fft_size, bool forward, const std::vector<float> 
&window, bool shift)
+{
+  return gcell_fft_vcc_sptr (new gcell_fft_vcc(fft_size, forward, window, 
shift));
+}
+
+#endif
+
 gcell_fft_vcc::gcell_fft_vcc (int fft_size, bool forward,
-                                 const std::vector<float> &window, bool shift)
+                             const std::vector<float> &window, bool shift)
   : gr_fft_vcc("gcell_fft_vcc", fft_size, forward, window, shift)
 {
+  if (fft_size < MIN_FFT_SIZE || fft_size > MAX_FFT_SIZE || 
!is_power_of_2(fft_size)){
+    throw std::invalid_argument("fft_size");
+  }
+
+  if (window.size() != 0 && fft_size > MAX_FFT_SIZE/2){
+    throw std::invalid_argument("fft_size too big to use window");
+  }
+
   d_log2_fft_size = log2(fft_size);
   d_mgr = gc_job_manager::singleton();         // grab the singleton job 
manager
   d_twiddle_boost = gc_aligned_alloc_sptr(sizeof(std::complex<float>) * 
fft_size/4, 128);

Modified: gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.h  
2008-04-22 06:17:57 UTC (rev 8242)
+++ gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.h  
2008-04-22 21:47:18 UTC (rev 8243)
@@ -27,7 +27,10 @@
 
 class gc_job_manager;
 
-gr_fft_vcc_sptr
+class gcell_fft_vcc;
+typedef boost::shared_ptr<gcell_fft_vcc> gcell_fft_vcc_sptr;
+
+gcell_fft_vcc_sptr
 gcell_make_fft_vcc(int fft_size, bool forward, const std::vector<float> 
&window, bool shift=false);
 
 /*!
@@ -43,7 +46,7 @@
   std::complex<float>              *d_twiddle;         // twiddle values 
(16-byte aligned)
   boost::shared_ptr<void>           d_twiddle_boost;   // automatic storage 
mgmt
   
-  friend gr_fft_vcc_sptr
+  friend gcell_fft_vcc_sptr
   gcell_make_fft_vcc(int fft_size, bool forward, const std::vector<float> 
&window, bool shift);
 
   gcell_fft_vcc(int fft_size, bool forward, const std::vector<float> &window, 
bool shift);

Modified: gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.i
===================================================================
--- gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.i  
2008-04-22 06:17:57 UTC (rev 8242)
+++ gnuradio/branches/developers/eb/gcell/gr-gcell/src/gcell_fft_vcc.i  
2008-04-22 21:47:18 UTC (rev 8243)
@@ -19,8 +19,38 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-%rename(fft_vcc) gcell_make_fft_vcc;
+#if 1
 
-gr_fft_vcc_sptr 
-gcell_make_fft_vcc(int fft_size, bool forward, const std::vector<float> 
&window, bool shift=false);
+// This version works.
 
+GR_SWIG_BLOCK_MAGIC(gcell, fft_vcc)
+
+gcell_fft_vcc_sptr 
+gcell_make_fft_vcc (int fft_size, bool forward, const std::vector<float> 
window, bool shift=false);
+
+class gcell_fft_vcc : public gr_sync_block
+{
+ protected:
+  gcell_fft_vcc (int fft_size, bool forward, const std::vector<float> &window, 
bool shift);
+
+ public:
+  bool set_window(const std::vector<float> &window);
+};
+
+#else
+
+// This version gives swig heartburn.  We end up with an object that's
+// not quite usable.
+
+GR_SWIG_BLOCK_MAGIC(gcell, fft_vcc);
+
+gcell_fft_vcc_sptr 
+gcell_make_fft_vcc (int fft_size, bool forward, const std::vector<float> 
window, bool shift=false);
+
+class gcell_fft_vcc : public gr_fft_vcc
+{
+ protected:
+  gr_fft_vcc(int fft_size, bool forward, const std::vector<float> &window, 
bool shift);
+};
+
+#endif





reply via email to

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