commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8379 - in gnuradio/branches/developers/ngoergen: . gn


From: ngoergen
Subject: [Commit-gnuradio] r8379 - in gnuradio/branches/developers/ngoergen: . gnuradio-gr-gcell/src
Date: Sun, 11 May 2008 00:27:54 -0600 (MDT)

Author: ngoergen
Date: 2008-05-11 00:27:53 -0600 (Sun, 11 May 2008)
New Revision: 8379

Added:
   gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/
   gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc.i
   
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_simd.cc
   
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_simd.h
   
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_spu.cc
   
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_spu.h
   
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.cc
   
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.h
   
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.lo
   gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_util.cc
   gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_util.h
   gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/qa_fir.py
Modified:
   gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/Makefile.am
Log:
branch for work in progress of gr_gcell block for SPU-based fir filter



Copied: gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell (from rev 8371, 
gnuradio/trunk/gr-gcell)

Modified: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/Makefile.am
===================================================================
--- gnuradio/trunk/gr-gcell/src/Makefile.am     2008-05-11 04:19:14 UTC (rev 
8371)
+++ gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/Makefile.am     
2008-05-11 06:27:53 UTC (rev 8379)
@@ -45,10 +45,18 @@
 lib_LTLIBRARIES = libgr_gcell.la
 
 libgr_gcell_la_SOURCES = \
-       gcell_fft_vcc.cc
+       gcell_fft_vcc.cc \
+       gcell_fir_ccc_simd.cc \
+       gcell_fir_ccc_spu.cc \
+       gcell_fir_filter_ccc.cc \
+       gcell_fir_util.cc
 
 grinclude_HEADERS = \
-       gcell_fft_vcc.h
+       gcell_fft_vcc.h \
+       gcell_fir_ccc_simd.h \
+       gcell_fir_ccc_spu.h \
+       gcell_fir_filter_ccc.h \
+       gcell_fir_util.h
 
 libgr_gcell_la_LIBADD = \
        $(GNURADIO_CORE_LA) \
@@ -67,7 +75,8 @@
 LOCAL_IFILES = \
        $(srcdir)/gc_job_manager.i \
        $(srcdir)/gcell.i \
-       $(srcdir)/gcell_fft_vcc.i
+       $(srcdir)/gcell_fft_vcc.i \
+       $(srcdir)/gcell_fir_ccc.i
 
 NON_LOCAL_IFILES = \
        $(GNURADIO_I)

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc.i
===================================================================
--- gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc.i 
                        (rev 0)
+++ gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc.i 
2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#if 1
+
+// This version works.
+
+GR_SWIG_BLOCK_MAGIC(gcell, fir_vccc)
+
+gcell_fir_filter_ccc_sptr gr_make_fir_filter_ccc 
+  (int decimation, const std::vector<gr_complex> &taps);
+
+class gcell_fir_filter_ccc : public gr_sync_decimator
+{
+ private:
+  gcell_fir_filter_ccc (int decimation, const std::vector<gr_complex> &taps);
+
+ public:
+  ~gcell_fir_filter_ccc ();
+
+  void set_taps (const std::vector<gr_complex> &taps);
+};
+
+
+#else
+
+// This version gives swig heartburn.  We end up with an object that
+// 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

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_simd.cc
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_simd.cc
                           (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_simd.cc
   2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,158 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2007 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gcell_fir_ccc_simd.h>
+
+#include <assert.h>
+#include <malloc16.h>
+#include <iostream>
+#include <stdexcept>
+
+using std::cerr;
+using std::endl;
+
+class boost_void_sptr {
+private:
+ /*
+  * Return pointer to cache-aligned chunk of storage of size size bytes.
+  * Throw if can't allocate memory.  The storage should be freed
+  * with "free" when done.  The memory is initialized to zero.
+  */
+  static void *
+  aligned_alloc(size_t size, size_t alignment = 128)
+  {
+    void *p(0);
+    if (posix_memalign(&p, alignment, size) != 0){
+      perror("posix_memalign");
+      throw std::runtime_error("memory");
+    }
+    memset(p, 0, size);           // zero the memory
+    return p;
+  }
+
+  class free_deleter {
+    public:
+      void operator()(void *p) {
+        free(p);
+      }
+  };
+
+public:
+
+  static boost::shared_ptr<void> 
+  aligned_alloc_sptr(size_t size, size_t alignment = 128)
+  {
+     return boost::shared_ptr<void>(aligned_alloc(size, alignment), 
free_deleter());
+  }
+};
+
+gcell_fir_ccc_simd::gcell_fir_ccc_simd ()
+  : gr_fir_ccc_generic (),
+    d_ccomplex_dotprod(0),
+    d_aligned_taps_p(0),
+    d_ntaps(0)
+{
+  // cerr << "@@@ gcell_fir_ccc_simd\n";
+
+}
+
+gcell_fir_ccc_simd::gcell_fir_ccc_simd (const std::vector<gr_complex> 
&new_taps)
+  : gr_fir_ccc_generic (new_taps),
+    d_ccomplex_dotprod(0),
+    d_aligned_taps_p(0),
+    d_ntaps(0)
+{
+  set_taps (new_taps);
+}
+
+gcell_fir_ccc_simd::~gcell_fir_ccc_simd ()
+{
+}
+
+void
+gcell_fir_ccc_simd::set_taps (const std::vector<gr_complex> &inew_taps)
+{
+  gr_fir_ccc::set_taps(inew_taps);     // call superclass
+
+  const std::vector<gr_complex> new_taps(gr_reverse(inew_taps));
+  unsigned long len(new_taps.size());
+  d_ntaps = (unsigned long) (len / 4) * 4 + (len % 4);
+
+  d_aligned_taps = 
+    boost_void_sptr::aligned_alloc_sptr(d_ntaps * sizeof(std::complex<float>), 
128);
+
+  d_aligned_taps_p = (std::complex<float> *) d_aligned_taps.get();
+
+  for (unsigned j = 0; j < len; ++j) {
+    d_aligned_taps_p[j] = new_taps[j];
+  }
+  for (unsigned j = 0; j < d_ntaps - len; ++j) {
+    d_aligned_taps_p[j] = 0.0;
+  }
+}
+
+gr_complex 
+gcell_fir_ccc_simd::filter (const gr_complex input[])
+{
+  if (!ntaps())
+    return 0.0;
+
+  // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al]
+  //  << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl;
+
+  gr_complex result;
+
+  d_ccomplex_dotprod(
+       input, 
+       d_aligned_taps_p, 
+       d_ntaps, 
+        1,
+       &result);
+
+  // cerr << "result = " << result[0] << " " << result[1] << endl;
+
+  return result;
+}
+
+void gcell_fir_ccc_simd::filterN (gr_complex output[], const gr_complex 
input[],
+                        unsigned long n)
+{
+  if ((n < 4) || !(n % 4) || !ntaps())
+    return;
+
+  d_ccomplex_dotprod (
+       input, 
+       d_aligned_taps_p,
+       d_ntaps, 
+       n, 
+       output);
+
+}
+
+void gcell_fir_ccc_simd::filterNdec (gr_complex output[], const gr_complex 
input[],
+                           unsigned long n, unsigned decimate)
+{
+       assert(0);
+}

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_simd.h
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_simd.h
                            (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_simd.h
    2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef INCLUDED_GCELL_FIR_CCC_SIMD_H
+#define INCLUDED_GCELL_FIR_CCC_SIMD_H
+
+#include <gr_fir_ccc_generic.h>
+#include <memory>
+
+/*!
+ * \brief common base class for GCELL versions of gr_fir_ccc
+ * \ingroup filter
+ *
+ * This base class handles alignment issues common to SSE and 3DNOW
+ * subclasses.
+ */
+
+class gcell_fir_ccc_simd : public gr_fir_ccc_generic
+{
+  protected:
+  typedef void (*ccomplex_dotprod_t)(const std::complex<float>* input,
+                                     const std::complex<float>* taps,
+                                     unsigned int n_taps,
+                                     unsigned int n_samples,
+                                     std::complex<float>* result);
+
+  ccomplex_dotprod_t    d_ccomplex_dotprod;     // fast dot product primitive
+
+  // CREATORS
+  gcell_fir_ccc_simd ();
+  gcell_fir_ccc_simd (const std::vector<gr_complex> &taps);
+  ~gcell_fir_ccc_simd ();
+
+  // MANIPULATORS
+  virtual void set_taps (const std::vector<gr_complex> &taps);
+  virtual gr_complex filter (const gr_complex input[]);
+
+  virtual void filterN (gr_complex output[], const gr_complex input[],
+                        unsigned long n);
+
+  virtual void filterNdec (gr_complex output[], const gr_complex input[],
+                           unsigned long n, unsigned decimate);
+
+private:
+
+  boost::shared_ptr<void> d_aligned_taps;
+
+  gr_complex* d_aligned_taps_p;
+
+  unsigned int d_ntaps;
+
+};
+
+#endif

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_spu.cc
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_spu.cc
                            (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_spu.cc
    2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gcell_fir_ccc_spu.h>
+#include <gcp_fir_ccc.h>
+
+/*
+ *     --- SPU version ---
+ */
+
+extern spe_program_handle_t gcell_all;
+
+void gcell_fir_ccc_spu::ccomplex_dotprod_spu(
+                    const std::complex<float>* input,
+                     const std::complex<float>* taps,
+                     unsigned int n_taps,
+                     unsigned int n_samples,
+                     std::complex<float>* result) {
+  gc_job_desc_sptr jd(gcp_fir_ccc_submit(d_mgr, n_samples, n_taps,
+                            result, input, taps));
+
+  if (!d_mgr->wait_job(jd.get())){
+    fprintf(stderr, "ccomplex_dotprod_spu wait_job failed: %s\n", 
gc_job_status_string(jd->status).c_str());
+  }
+}
+
+ 
+gcell_fir_ccc_spu::gcell_fir_ccc_spu ()
+  : gcell_fir_ccc_simd () 
+{
+  d_ccomplex_dotprod = gcell_fir_ccc_spu::ccomplex_dotprod_spu;
+
+  gc_jm_options opts;
+  opts.program_handle = gc_program_handle_from_address(&gcell_all);
+  opts.nspes = 1;
+  d_mgr = gc_make_job_manager(&opts);
+}
+

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_spu.h
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_spu.h 
                            (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_ccc_spu.h 
    2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GCELL_FIR_CCC_X86_H
+#define INCLUDED_GCELL_FIR_CCC_X86_H
+
+#include <gcell_fir_ccc_simd.h>
+#include <gc_job_manager.h>
+
+/*!
+ * \brief SPU version of gcell_fir_ccc
+ */
+class gcell_fir_ccc_spu : public gcell_fir_ccc_simd
+{
+public:
+  gcell_fir_ccc_spu ();
+  gcell_fir_ccc_spu (const std::vector<gr_complex> &taps);
+
+private:
+  static gc_job_manager_sptr d_mgr;
+
+  static void ccomplex_dotprod_spu(
+                     const std::complex<float>* input,
+                     const std::complex<float>* taps,
+                     unsigned int n_taps,
+                     unsigned int n_samples,
+                     std::complex<float>* result);
+};
+
+#endif

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.cc
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.cc
                         (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.cc
 2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,88 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * WARNING: This file is automatically generated by 
generate_gr_fir_filter_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gcell_fir_filter_ccc.h>
+#include <gr_fir_ccc.h>
+#include <gcell_fir_util.h>
+#include <gr_io_signature.h>
+
+gcell_fir_filter_ccc_sptr gr_make_fir_filter_ccc (int decimation, const 
std::vector<gr_complex> &taps)
+{
+  return gcell_fir_filter_ccc_sptr (new gcell_fir_filter_ccc (decimation, 
taps));
+}
+
+
+gcell_fir_filter_ccc::gcell_fir_filter_ccc (int decimation, const 
std::vector<gr_complex> &taps)
+  : gr_sync_decimator ("fir_filter_ccc",
+                      gr_make_io_signature (1, 1, sizeof (gr_complex)),
+                      gr_make_io_signature (1, 1, sizeof (gr_complex)),
+                      decimation),
+    d_updated (false)
+{
+  d_fir = gcell_fir_util::create_gcell_fir_ccc (taps);
+  set_history (d_fir.get()->ntaps ());
+}
+
+gcell_fir_filter_ccc::~gcell_fir_filter_ccc ()
+{
+}
+
+void
+gcell_fir_filter_ccc::set_taps (const std::vector<gr_complex> &taps)
+{
+  d_new_taps = taps;
+  d_updated = true;
+}
+
+int
+gcell_fir_filter_ccc::work (int noutput_items,
+                  gr_vector_const_void_star &input_items,
+                  gr_vector_void_star &output_items)
+{
+  gr_complex *in((gr_complex *) input_items[0U]);
+  gr_complex *out((gr_complex *) output_items[0U]);
+
+  int rnoutput_items((noutput_items >> 2) << 2);
+
+  if (d_updated) {
+    d_fir.get()->set_taps (d_new_taps);
+    set_history (d_fir.get()->ntaps ());
+    d_updated = false;
+    return 0;               // history requirements may have changed.
+  }
+
+  if (decimation() == 1)
+    d_fir.get()->filterN (out, in, rnoutput_items);
+  else
+    d_fir.get()->filterNdec (out, in, rnoutput_items, decimation());
+
+  return rnoutput_items;
+}

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.h
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.h
                          (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.h
  2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * WARNING: This file is automatically generated by 
generate_gr_fir_filter_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifndef INCLUDED_GCELL_FIR_FILTER_CCC_H
+#define        INCLUDED_GCELL_FIR_FILTER_CCC_H
+
+#include <gr_sync_decimator.h>
+#include <memory>
+
+class gcell_fir_filter_ccc;
+
+typedef boost::shared_ptr<gcell_fir_filter_ccc> gcell_fir_filter_ccc_sptr;
+gcell_fir_filter_ccc_sptr gr_make_fir_filter_ccc (int decimation, const 
std::vector<gr_complex> &taps);
+
+class gr_fir_ccc;
+
+/*!
+ * \brief FIR filter with gr_complex input, gr_complex output and gr_complex 
taps
+ * \ingroup filter
+ */
+class gcell_fir_filter_ccc : public gr_sync_decimator
+{
+ private:
+  friend gcell_fir_filter_ccc_sptr gr_make_fir_filter_ccc (int decimation, 
const std::vector<gr_complex> &taps);
+
+  std::auto_ptr<gr_fir_ccc>            d_fir;
+  std::vector<gr_complex>      d_new_taps;
+  bool                 d_updated;
+
+  /*!
+   * Construct a FIR filter with the given taps
+   */
+  gcell_fir_filter_ccc (int decimation, const std::vector<gr_complex> &taps);
+
+ public:
+  ~gcell_fir_filter_ccc ();
+
+  void set_taps (const std::vector<gr_complex> &taps);
+
+  int work (int noutput_items,
+                gr_vector_const_void_star &input_items,
+                gr_vector_void_star &output_items);
+};
+
+#endif

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.lo
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.lo
                         (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_filter_ccc.lo
 2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,12 @@
+# gcell_fir_filter_ccc.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.24 (1.1220.2.456 2007/06/24 
02:25:32)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/gcell_fir_filter_ccc.o'
+
+# Name of the non-PIC object.
+non_pic_object=none
+

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_util.cc
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_util.cc   
                            (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_util.cc   
    2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2004 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gcell_fir_util.h>
+
+#include <gcell_fir_ccc_spu.h>
+
+//
+// There's no problem that can't be solved by the addition of
+// another layer of indirection...
+//
+
+/*
+ * ----------------------------------------------------------------
+ * static functions that serve as constructors...
+ * Is it possible to take the address of a normal constructor?
+ * ----------------------------------------------------------------
+ */
+
+static std::auto_ptr<gr_fir_ccc>
+make_gcell_fir_ccc_spu(const std::vector<gr_complex> &taps)
+{
+  return std::auto_ptr<gr_fir_ccc>(new gcell_fir_ccc_spu(taps));
+}
+
+// --- constructors ---
+
+std::auto_ptr<gr_fir_ccc>
+gcell_fir_util::create_gcell_fir_ccc (const std::vector<gr_complex> &taps)
+{
+  return make_gcell_fir_ccc_spu(taps);
+}
+
+// std::auto_ptr<gcell_fir_fff>
+//gcell_fir_util::create_gcell_fir_fff (const std::vector<float> &taps)
+//{
+//  return gcell_fir_sysconfig_singleton()->create_gcell_fir_fff (taps);
+//}
+
+// --- info gatherers ---
+
+void
+gcell_fir_util::get_gcell_fir_ccc_info (std::vector<gcell_fir_ccc_info> *info)
+{
+  //TODO: gcell_fir_sysconfig_singleton()->get_gcell_fir_ccc_info (info);
+}
+
+//void
+//gcell_fir_util::get_gcell_fir_fff_info (std::vector<gcell_fir_fff_info> 
*info)
+//{
+//  //TODO: gcell_fir_sysconfig_singleton()->get_gcell_fir_fff_info (info);
+//}
+

Added: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_util.h
===================================================================
--- 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_util.h    
                            (rev 0)
+++ 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/gcell_fir_util.h    
    2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2004 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * WARNING: This file is automatically generated by
+ * generate_gcell_fir_util.py.
+ *
+ * Any changes made to this file will be overwritten.
+ */
+
+#ifndef INCLUDED_GCELL_FIR_UTIL_H
+#define INCLUDED_GCELL_FIR_UTIL_H
+
+/*!
+ * \brief routines to create gcell_fir_XXX's
+ *
+ * This class handles selecting the fastest version of the finite
+ * implulse response filter available for your platform.  This
+ * interface should be used by the rest of the system for creating
+ * gcell_fir_XXX's.
+ *
+ * The trailing suffix has the form _IOT where I codes the input type,
+ * O codes the output type, and T codes the tap type.
+ * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 
+ * 'i' (short)
+ */
+
+#include <gr_types.h>
+#include <memory>
+
+class gr_fir_ccc;
+//class gr_fir_fff;
+
+// structures returned by get_gcell_fir_XXX_info methods
+
+struct gcell_fir_ccc_info {
+  const char    *name;             // implementation name, e.g., "generic", 
"SSE", "3DNow!"
+  gr_fir_ccc   *(*create)(const std::vector<gr_complex> &taps);
+};
+
+//struct gcell_fir_fff_info {
+//  const char    *name;             // implementation name, e.g., "generic", 
"SSE", "3DNow!"
+//  gcell_fir_fff      *(*create)(const std::vector<float> &taps);
+//};
+
+struct gcell_fir_util {
+
+  // create a fast version of gcell_fir_XXX.
+
+  static std::auto_ptr<gr_fir_ccc> create_gcell_fir_ccc (const 
std::vector<gr_complex> &taps);
+  //static gcell_fir_fff* create_gcell_fir_fff (const std::vector<float> 
&taps);
+
+  // Get information about all gcell_fir_XXX implementations.
+  // This is useful for benchmarking, testing, etc without having to
+  // know a priori what's linked into this image
+  //
+  // The caller must pass in a valid pointer to a vector.
+  // The vector will be filled with structs describing the
+  // available implementations.
+
+  static void get_gcell_fir_ccc_info (std::vector<gcell_fir_ccc_info> *info);
+  //static void get_gcell_fir_fff_info (std::vector<gcell_fir_fff_info> *info);
+
+};
+
+#endif /* INCLUDED_GCELL_FIR_UTIL_H */

Added: gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/qa_fir.py
===================================================================
--- gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/qa_fir.py       
                        (rev 0)
+++ gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/qa_fir.py       
2008-05-11 06:27:53 UTC (rev 8379)
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+#
+# Copyright 2008 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+from gnuradio import gr, gr_unittest
+import gcell
+import sys
+import random
+
+primes = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,
+          59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,
+          137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,
+          227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311)
+
+
+class test_fir_filter(gr_unittest.TestCase):
+
+    def setUp(self):
+        ph = 
gcell.program_handle_from_filename("../../gcell/src/lib/spu/gcell_all")
+        opts = gcell.jm_options(ph, 1)
+        self.mgr = gcell.job_manager(opts)
+        gcell.set_singleton(self.mgr)
+
+    def tearDown(self):
+       pass
+
+    def assert_fir_ok2(self, expected_result, result_data):
+        expected_result = expected_result[:len(result_data)]
+        self.assertComplexTuplesAlmostEqual2 (expected_result, result_data,
+                                              abs_eps=1e-9, rel_eps=4e-4)
+
+    def assert_fir_float_ok2(self, expected_result, result_data, abs_eps=1e-9, 
rel_eps=4e-4):
+        expected_result = expected_result[:len(result_data)]
+        self.assertFloatTuplesAlmostEqual2 (expected_result, result_data,
+                                            abs_eps, rel_eps)
+
+    def test_001(self):
+       tb = gr.top_block()
+       fir_size=32
+        src_data = tuple([complex(primes[2*i], primes[2*i+1]) for i in 
range(fir_size)])
+
+        expected_result = ((4377+4516j),
+                           (-1706.1268310546875+1638.4256591796875j),
+                           (-915.2083740234375+660.69427490234375j),
+                           (-660.370361328125+381.59600830078125j),
+                           (-499.96044921875+238.41630554199219j),
+                           (-462.26748657226562+152.88948059082031j),
+                           (-377.98440551757812+77.5928955078125j),
+                           (-346.85821533203125+47.152004241943359j),
+                           (-295+20j),
+                           (-286.33609008789062-22.257017135620117j),
+                           (-271.52999877929688-33.081821441650391j),
+                           (-224.6358642578125-67.019538879394531j),
+                           (-244.24473571777344-91.524826049804688j),
+                           (-203.09068298339844-108.54627227783203j),
+                           (-198.45195007324219-115.90768432617188j),
+                           (-182.97744750976562-128.12318420410156j),
+                           (-167-180j),
+                           (-130.33688354492188-173.83778381347656j),
+                           (-141.19784545898438-190.28807067871094j),
+                           (-111.09677124023438-214.48896789550781j),
+                           (-70.039543151855469-242.41630554199219j),
+                           (-68.960540771484375-228.30015563964844j),
+                           (-53.049201965332031-291.47097778320312j),
+                           (-28.695289611816406-317.64553833007812j),
+                           (57-300j),
+                           (45.301143646240234-335.69509887695312j),
+                           (91.936195373535156-373.32437133789062j),
+                           (172.09465026855469-439.275146484375j),
+                           (242.24473571777344-504.47515869140625j),
+                           (387.81732177734375-666.6788330078125j),
+                           (689.48553466796875-918.2142333984375j),
+                           (1646.539306640625-1694.1956787109375j))
+
+       taps = ((1+1j),
+               (1+1j),
+               (1+1j),
+               (1+1j))
+
+        src = gr.vector_source_c(src_data)
+        fir = gcell.fir_vccc(1, taps)
+        dst = gr.vector_sink_c()
+        tb.connect(src, fir, dst)
+        tb.run()
+        result_data = dst.data()
+        #print 'expected:', expected_result
+        #print 'results: ', result_data
+        #self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
+        self.assert_fir_ok2(expected_result, result_data)
+
+if __name__ == '__main__':
+    gr_unittest.main ()
+        


Property changes on: 
gnuradio/branches/developers/ngoergen/gnuradio-gr-gcell/src/qa_fir.py
___________________________________________________________________
Name: svn:executable
   + *





reply via email to

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