[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8155 - in gnuradio/branches/developers/ngoergen: . gn
From: |
ngoergen |
Subject: |
[Commit-gnuradio] r8155 - in gnuradio/branches/developers/ngoergen: . gnuradio-core-src-lib-filter |
Date: |
Wed, 2 Apr 2008 10:49:15 -0600 (MDT) |
Author: ngoergen
Date: 2008-04-02 10:49:15 -0600 (Wed, 02 Apr 2008)
New Revision: 8155
Added:
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/ccomplex_dotprod_spu.cc
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/ccomplex_dotprod_spu.h
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_gcell.cc
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_gcell.h
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_ppc.cc
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_ppc.h
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_sysconfig_ppc.cc
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_sysconfig_ppc.h
Log:
branches/developers/ngoergen: made a branch of gnuradio-core/.../filter to add
gcell-based fir filters for PPC
Copied: gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter
(from rev 8142, gnuradio/trunk/gnuradio-core/src/lib/filter)
Added:
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/ccomplex_dotprod_spu.cc
===================================================================
---
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/ccomplex_dotprod_spu.cc
(rev 0)
+++
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/ccomplex_dotprod_spu.cc
2008-04-02 16:49:15 UTC (rev 8155)
@@ -0,0 +1,96 @@
+/* -*- 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gc_job_manager.h"
+#include <iostream>
+#include <inttypes.h>
+#include <complex>
+typedef std::complex<float> complex;
+
+extern spe_program_handle_t fir_ccc_spu;
+
+static gc_proc_id_t sp_fir_spu = GCP_UNKNOWN_PROC;
+
+static void ccomplex_dotprod_spu_init_jd(gc_job_desc* jd, float* in_vec,
+ float* sum_vec, int n_taps, float* out_vec, int n_samples)
+{
+
+ jd->proc_id = sp_fir_spu;
+ jd->input.nargs = 0;
+ jd->output.nargs = 0;
+ jd->eaa.nargs = 5;
+
+ jd->eaa.arg[0].ea_addr = ptr_to_ea(in_vec);
+ jd->eaa.arg[0].direction = GCJD_DMA_GET;
+ jd->eaa.arg[0].get_size = sizeof(complex) * n_samples;
+
+ jd->eaa.arg[1].ea_addr = ptr_to_ea(sum_vec);
+ jd->eaa.arg[1].direction = GCJD_DMA_GET;
+ jd->eaa.arg[1].get_size = sizeof(complex) * n_samples;
+
+ jd->eaa.arg[2].ea_addr = ptr_to_ea(&n_taps);
+ jd->eaa.arg[2].direction = GCJD_DMA_GET;
+ jd->eaa.arg[2].get_size = sizeof(uint32_t);
+
+ jd->eaa.arg[3].ea_addr = ptr_to_ea(&n_samples);
+ jd->eaa.arg[3].direction = GCJD_DMA_GET;
+ jd->eaa.arg[3].get_size = sizeof(uint32_t);
+
+ jd->eaa.arg[4].ea_addr = ptr_to_ea(out_vec);
+ jd->eaa.arg[4].direction = GCJD_DMA_PUT;
+ jd->eaa.arg[4].put_size = sizeof(complex) * n_samples;
+
+}
+
+static void ccomplex_dotprod_spu(const float *in_vec, const float *taps_vec,
+ unsigned n_taps, float *out_vec,
+ unsigned long n_samples, unsigned decimate)
+{
+
+ gc_jm_options opts;
+ opts.nspes = 1;
+ opts.gang_schedule = false;
+ opts.program_handle = &fir_ccc_spu;
+
+ gc_job_manager * mgr = gc_make_job_manager(&opts);
+
+ if ((sp_fir_spu = mgr->lookup_proc("fir_ccc_spu")) == GCP_UNKNOWN_PROC) {
+ fprintf(stderr, "lookup_proc: failed to find \"fir_ccc_spu\"\n");
+ return;
+ }
+
+ gc_job_desc* jd;
+ jd = mgr->alloc_job_desc();
+ ccomplex_dotprod_spu_init_jd(jd, in_vec, taps_vec, n_taps, out_vec,
n_samples);
+
+ if (!mgr->submit_job(jd)) {
+ printf("submit_job failed, status = %d\n", jd->status);
+ }
+
+ std::cout << jd->status << '\n';
+
+ if (!mgr->wait_job(jd)) {
+ printf("wait_job failed, status = %d\n", jd->status);
+ }
+
+ mgr->free_job_desc(jd);
+}
Added:
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/ccomplex_dotprod_spu.h
===================================================================
---
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/ccomplex_dotprod_spu.h
(rev 0)
+++
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/ccomplex_dotprod_spu.h
2008-04-02 16:49:15 UTC (rev 8155)
@@ -0,0 +1,40 @@
+/* -*- 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 _CCOMPLEX_DOTPROD_SPU_H_
+#define _CCOMPLEX_DOTPROD_SPU_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void
+ccomplex_dotprod_spu (const float *input,
+ const float *taps, unsigned ntaps, float *result,
+ unsigned long n,
+ unsigned decimate);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CCOMPLEX_DOTPROD_SPU_H_ */
Added:
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_gcell.cc
===================================================================
---
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_gcell.cc
(rev 0)
+++
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_gcell.cc
2008-04-02 16:49:15 UTC (rev 8155)
@@ -0,0 +1,166 @@
+/* -*- 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 <gr_fir_ccc_gcell.h>
+
+#include <assert.h>
+#include <malloc16.h>
+#include <iostream>
+#include <stdexcept>
+
+using std::cerr;
+using std::endl;
+
+gr_fir_ccc_gcell::gr_fir_ccc_gcell ()
+ : gr_fir_ccc_generic ()
+{
+ // cerr << "@@@ gr_fir_ccc_gcell\n";
+
+ d_ccomplex_dotprod = 0;
+
+ d_aligned_taps = 0;
+}
+
+gr_fir_ccc_gcell::gr_fir_ccc_gcell (const std::vector<gr_complex> &new_taps)
+ : gr_fir_ccc_generic (new_taps)
+{
+ // cerr << "@@@ gr_fir_ccc_gcell\n";
+
+ d_ccomplex_dotprod = 0;
+
+ d_aligned_taps = 0;
+ set_taps (new_taps);
+}
+
+gr_fir_ccc_gcell::~gr_fir_ccc_gcell ()
+{
+ free16Align (d_aligned_taps);
+}
+
+void
+gr_fir_ccc_gcell::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 len = new_taps.size ();
+
+ free16Align (d_aligned_taps); // free old value
+
+ // this works because the bit representation of a IEEE floating point
+ // +zero is all zeros. If you're using a different representation,
+ // you'll need to explictly set the result to the appropriate 0.0 value.
+
+ d_aligned_taps = (float *) calloc16Align (1 + (len + i - 1) / 2,
+ 2 * 4 * sizeof (float));
+ if (d_aligned_taps == 0){
+ // throw something...
+ cerr << "@@@ gr_fir_ccc_gcell d_aligned_taps == 0\n";
+ }
+
+ for (unsigned j = 0; j < len; j++) {
+ d_aligned_taps[2*(j+i)] = new_taps[j].real();
+ d_aligned_taps[2*(j+i)+1] = new_taps[j].imag();
+ }
+}
+
+gr_complex
+gr_fir_ccc_gcell::filter (const gr_complex input[])
+{
+ if (ntaps () == 0)
+ return 0.0;
+
+ if (((intptr_t) input & 0xf) != 0)
+ cerr << "@@@ gr_fir_ccc_gcell inputs not 16-byte alinged\n";
+ // throw std::invalid_argument("gr_complex must be 16-byte aligned");
+
+ // Round input data address down to 16 byte boundary
+ // NB: depending on the alignment of input[], memory
+ // before input[] will be accessed. The contents don't matter since
+ // they'll be multiplied by zero coefficients. I can't conceive of any
+ // situation where this could cause a segfault since memory protection
+ // in the x86 machines is done on much larger boundaries.
+
+ //const gr_complex *ar = (gr_complex *)((unsigned long) input & ~15);
+
+ // Choose one of 4 sets of pre-shifted coefficients. al is both the
+ // index into d_aligned_taps[] and the number of 0 words padded onto
+ // that coefficients array for alignment purposes.
+
+// unsigned al = input - ar;
+
+ // call assembler routine to do the work, passing number of 2x4-float blocks.
+
+ // assert (((unsigned long) ar & 15) == 0);
+ // assert (((unsigned long) d_aligned_taps[al] & 15) == 0);
+
+ // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al]
+ // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl;
+
+ float result[4];
+
+ //d_ccomplex_dotprod ((float*)input, d_aligned_taps, (ntaps() + al - 1) / 2
+ 1, result);
+ d_ccomplex_dotprod ((float*)input, d_aligned_taps, ntaps(), output, 1, 1);
+
+ // cerr << "result = " << result[0] << " " << result[1] << endl;
+
+ return gr_complex(result[0], result[1]);
+}
+
+
+void
+gr_fir_ccc_gcell::filterN (gr_complex output[],
+ const gr_complex input[],
+ unsigned long n)
+{
+ if (ntaps () == 0)
+ return 0.0;
+
+ if (((intptr_t) input & 0xf) != 0)
+ cerr << "@@@ gr_fir_ccc_gcell inputs not 16-byte alinged\n";
+ // throw std::invalid_argument("gr_complex must be 16-byte aligned");
+
+ //d_ccomplex_dotprod ((float*)input, d_aligned_taps, (ntaps() + al - 1) / 2
+ 1, result);
+ d_ccomplex_dotprod ((float*) input, d_aligned_taps, ntaps(), (float*)
output, n, 1);
+
+// for (unsigned i = 0; i < n; i++)
+// output[i] = filter (&input[i]);
+}
+
+void
+gr_fir_ccc_gcell::filterNdec (gr_complex output[],
+ const gr_complex input[],
+ unsigned long n,
+ unsigned decimate)
+{
+ assert (false); // TODO: currently not implemented, fastly.
+// unsigned j = 0;
+// for (unsigned i = 0; i < n; i++){
+// output[i] = filter (&input[j]);
+// j += decimate;
+// }
+
+
+}
Added:
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_gcell.h
===================================================================
---
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_gcell.h
(rev 0)
+++
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_gcell.h
2008-04-02 16:49:15 UTC (rev 8155)
@@ -0,0 +1,67 @@
+/* -*- 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_GR_FIR_CCC_GCELL_H
+#define INCLUDED_GR_FIR_CCC_GCELL_H
+
+#include <gr_fir_ccc_generic.h>
+
+/*!
+ * \brief common base class for GCELL versions of gr_fir_ccc
+ * \ingroup filter
+ *
+ * This base class handles alignment issues common to the SPU
+ * subclass.
+ */
+
+class gr_fir_ccc_gcell : public gr_fir_ccc_generic
+{
+protected:
+ typedef void (*ccomplex_dotprod_t)(const float *input,
+ const float *taps,
+ unsigned ntaps,
+ float *result,
+ unsigned long n,
+ unsigned decimate);
+
+ float *d_aligned_taps;
+
+ ccomplex_dotprod_t d_ccomplex_dotprod; // fast dot product primitive
+
+public:
+
+ // CREATORS
+ gr_fir_ccc_gcell ();
+ gr_fir_ccc_gcell (const std::vector<gr_complex> &taps);
+ ~gr_fir_ccc_gcell ();
+
+ // 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);
+};
+
+#endif
Added:
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_ppc.cc
===================================================================
---
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_ppc.cc
(rev 0)
+++
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_ppc.cc
2008-04-02 16:49:15 UTC (rev 8155)
@@ -0,0 +1,43 @@
+/* -*- 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 <gr_fir_ccc_ppc.h>
+#include <ccomplex_dotprod_spu.h>
+
+/*
+ * --- SPU version ---
+ */
+
+gr_fir_ccc_spu::gr_fir_ccc_spu ()
+ : gr_fir_ccc_gcell ()
+{
+ d_ccomplex_dotprod = ccomplex_dotprod_spu;
+}
+
+gr_fir_ccc_spu::gr_fir_ccc_spu (const std::vector<gr_complex> &new_taps)
+ : gr_fir_ccc_gcell (new_taps)
+{
+ d_ccomplex_dotprod = ccomplex_dotprod_spu;
+}
Added:
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_ppc.h
===================================================================
---
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_ppc.h
(rev 0)
+++
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_ccc_ppc.h
2008-04-02 16:49:15 UTC (rev 8155)
@@ -0,0 +1,38 @@
+/* -*- 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_GR_FIR_CCC_PPC_H
+#define INCLUDED_GR_FIR_CCC_PPC_H
+
+#include <gr_fir_ccc_gcell.h>
+
+/*!
+ * \brief SPU version of gr_fir_ccc
+ */
+class gr_fir_ccc_spu : public gr_fir_ccc_gcell
+{
+public:
+ gr_fir_ccc_spu ();
+ gr_fir_ccc_spu (const std::vector<gr_complex> &taps);
+};
+
+#endif
Added:
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_sysconfig_ppc.cc
===================================================================
---
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_sysconfig_ppc.cc
(rev 0)
+++
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_sysconfig_ppc.cc
2008-04-02 16:49:15 UTC (rev 8155)
@@ -0,0 +1,243 @@
+/* -*- 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 <gr_fir_sysconfig_ppc.h>
+#include <gr_cpu.h>
+
+#include <gr_fir_ccf.h>
+#include <gr_fir_ccf_generic.h>
+// #include <gr_fir_ccf_x86.h>
+#include <gr_fir_fcc.h>
+#include <gr_fir_fcc_generic.h>
+// #include <gr_fir_fcc_x86.h>
+#include <gr_fir_fff.h>
+#include <gr_fir_fff_generic.h>
+#include <gr_fir_fff_ppc.h>
+#include <gr_fir_fsf.h>
+#include <gr_fir_fsf_generic.h>
+// #include <gr_fir_fsf_x86.h>
+#include <gr_fir_ccc.h>
+#include <gr_fir_ccc_generic.h>
+#include <gr_fir_ccc_ppc.h>
+#include <gr_fir_scc.h>
+#include <gr_fir_scc_generic.h>
+// #include <gr_fir_scc_x86.h>
+// #include <gr_fir_sss.h>
+// #include <gr_fir_sss_generic.h>
+// #include <gr_fir_sss_mmx.h>
+// #include <gr_fir_sss_sse2.h>
+
+#include <iostream>
+using std::cerr;
+
+/*
+ * ----------------------------------------------------------------
+ * static functions that serve as constructors...
+ * Is it possible to take the address of a normal constructor?
+ * ----------------------------------------------------------------
+ */
+
+static gr_fir_ccc *
+make_gr_fir_ccc_gcell (const std::vector<gr_complex> &taps)
+{
+ return new gr_fir_ccc_gcell (taps);
+}
+
+static gr_fir_fff *
+make_gr_fir_fff_gcell (const std::vector<float> &taps)
+{
+ return new gr_fir_fff_gcell (taps);
+}
+
+/*
+ * ----------------------------------------------------------------
+ * Return instances of the fastest PPC versions of these classes.
+ *
+ * check CPUID, if is a CELL, return gcell version,
+ * else return generic version.
+ *
+ * FIXME: benchmark, store result, use stored result to
+ * select the fastest version.
+ * ----------------------------------------------------------------
+ */
+
+gr_fir_ccf *
+gr_fir_sysconfig_ppc::create_gr_fir_ccf (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+ if (first){
+ cerr << ">>> gr_fir_ccf: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps);
+}
+
+gr_fir_fcc *
+gr_fir_sysconfig_ppc::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+ if (first){
+ cerr << ">>> gr_fir_fcc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps);
+}
+
+gr_fir_ccc *
+gr_fir_sysconfig_ppc::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+ if (true /*TODO: check if this is a CELL */){
+ if (first) {
+ cerr << ">>> gr_fir_ccc: using gcell\n";
+ first = false;
+ }
+ return make_gr_fir_ccc_gcell (taps);
+ }
+
+ if (first){
+ cerr << ">>> gr_fir_ccc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps);
+}
+
+gr_fir_fff *
+gr_fir_sysconfig_ppc::create_gr_fir_fff (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+ if (true /*TODO: check if this is a CELL */){
+ if (first){
+ cerr << ">>> gr_fir_fff: using gcell\n";
+ first = false;
+ }
+ return make_gr_fir_fff_gcell (taps);
+ }
+
+ if (first){
+ cerr << ">>> gr_fir_fff: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fff (taps);
+}
+
+gr_fir_fsf *
+gr_fir_sysconfig_ppc::create_gr_fir_fsf (const std::vector<float> &taps)
+{
+ static bool first = true;
+
+ if (first){
+ cerr << ">>> gr_fir_fsf: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps);
+}
+
+gr_fir_scc *
+gr_fir_sysconfig_ppc::create_gr_fir_scc (const std::vector<gr_complex> &taps)
+{
+ static bool first = true;
+
+ if (first){
+ cerr << ">>> gr_fir_scc: handing off to parent class\n";
+ first = false;
+ }
+ return gr_fir_sysconfig_generic::create_gr_fir_scc (taps);
+}
+
+/*
+ * ----------------------------------------------------------------
+ * Return info about available implementations
+ * ----------------------------------------------------------------
+ */
+
+void
+gr_fir_sysconfig_ppc::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info)
+{
+ gr_fir_ccf_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info);
+}
+
+void
+gr_fir_sysconfig_ppc::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info)
+{
+ gr_fir_fcc_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info);
+}
+
+void
+gr_fir_sysconfig_ppc::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info)
+{
+ gr_fir_ccc_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info);
+
+ if (true /*TODO: check if this is a CELL */){
+ t.name = "gcell";
+ t.create = make_gr_fir_ccc_gell;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_ppc::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info)
+{
+ gr_fir_fff_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fff_info (info);
+
+ if (true /*TODO: check if this is a CELL */){
+ t.name = "gcell";
+ t.create = make_gr_fir_fff_gcell;
+ (*info).push_back (t);
+ }
+}
+
+void
+gr_fir_sysconfig_ppc::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info)
+{
+ gr_fir_fsf_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info);
+}
+
+void
+gr_fir_sysconfig_ppc::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info)
+{
+ gr_fir_scc_info t;
+
+ // invoke parent..
+ gr_fir_sysconfig_generic::get_gr_fir_scc_info (info);
+}
Added:
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_sysconfig_ppc.h
===================================================================
---
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_sysconfig_ppc.h
(rev 0)
+++
gnuradio/branches/developers/ngoergen/gnuradio-core-src-lib-filter/gr_fir_sysconfig_ppc.h
2008-04-02 16:49:15 UTC (rev 8155)
@@ -0,0 +1,46 @@
+/* -*- 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_GR_FIR_SYSCONFIG_PPC_H
+#define INCLUDED_GR_FIR_SYSCONFIG_PPC_H
+
+#include <gr_fir_sysconfig_generic.h>
+
+class gr_fir_sysconfig_ppc : public gr_fir_sysconfig_generic {
+public:
+ virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps);
+ virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps);
+ virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps);
+ virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps);
+ virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps);
+ virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps);
+//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps);
+
+ virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info);
+ virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info);
+ virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info);
+ virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info);
+ virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info);
+ virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info);
+//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info);
+};
+
+#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8155 - in gnuradio/branches/developers/ngoergen: . gnuradio-core-src-lib-filter,
ngoergen <=