diff options
author | Josh Blum | 2011-10-11 21:35:35 -0700 |
---|---|---|
committer | Josh Blum | 2011-10-11 21:35:35 -0700 |
commit | 1259a01a9479071bd1729a9c9496444f0a72509b (patch) | |
tree | 55350454454a119fb230cdbaadfb27d361f191ec /gcell/lib/wrapper | |
parent | 71c0f14a46f85027b95f2f5f6d3d219cc9e3783e (diff) | |
parent | 06860c309153890a6a42babfbedf230eb24f0042 (diff) | |
download | gnuradio-1259a01a9479071bd1729a9c9496444f0a72509b.tar.gz gnuradio-1259a01a9479071bd1729a9c9496444f0a72509b.tar.bz2 gnuradio-1259a01a9479071bd1729a9c9496444f0a72509b.zip |
Merge branch 'next' of http://gnuradio.org/git/gnuradio into next
Conflicts:
gr-digital/include/digital_constellation.h
Diffstat (limited to 'gcell/lib/wrapper')
-rw-r--r-- | gcell/lib/wrapper/.gitignore | 8 | ||||
-rw-r--r-- | gcell/lib/wrapper/Makefile.am | 75 | ||||
-rw-r--r-- | gcell/lib/wrapper/gcp_fft_1d_r2.cc | 119 | ||||
-rw-r--r-- | gcell/lib/wrapper/qa_gcell_general.cc | 83 | ||||
-rw-r--r-- | gcell/lib/wrapper/qa_gcell_general.h | 40 | ||||
-rw-r--r-- | gcell/lib/wrapper/qa_gcell_wrapper.cc | 41 | ||||
-rw-r--r-- | gcell/lib/wrapper/qa_gcell_wrapper.h | 35 | ||||
-rw-r--r-- | gcell/lib/wrapper/qa_gcp_fft_1d_r2.cc | 208 | ||||
-rw-r--r-- | gcell/lib/wrapper/qa_gcp_fft_1d_r2.h | 48 | ||||
-rw-r--r-- | gcell/lib/wrapper/spu/.gitignore | 8 | ||||
-rw-r--r-- | gcell/lib/wrapper/spu/gcs_fft_1d_r2.c | 94 |
11 files changed, 0 insertions, 759 deletions
diff --git a/gcell/lib/wrapper/.gitignore b/gcell/lib/wrapper/.gitignore deleted file mode 100644 index 3531485fb..000000000 --- a/gcell/lib/wrapper/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/Makefile -/Makefile.in -/.deps -/.libs -/*.la -/*.lo -/*.a -/*.o diff --git a/gcell/lib/wrapper/Makefile.am b/gcell/lib/wrapper/Makefile.am deleted file mode 100644 index 5ec7e5615..000000000 --- a/gcell/lib/wrapper/Makefile.am +++ /dev/null @@ -1,75 +0,0 @@ -# -# Copyright 2008,2009 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. -# - -include $(top_srcdir)/Makefile.common - -# $(WITH_INCLUDES) must _always_ be last -AM_CPPFLAGS = $(DEFINES) $(GCELL_INCLUDES) $(FFTW3F_CPPFLAGS) $(WITH_INCLUDES) - -noinst_LTLIBRARIES = libwrapper.la libwrapper-qa.la - -# -# generate libtool.lo's that contain embedded SPU executables -# -gcell_all.lo: ../spu/gcell_all - $(GCELL_EMBEDSPU_LIBTOOL) $< $@ - -gcell_general_qa.lo: ../spu/gcell_general_qa - $(GCELL_EMBEDSPU_LIBTOOL) $< $@ - - - -# The primary library - -libwrapper_la_SOURCES = \ - gcp_fft_1d_r2.cc - -libwrapper_la_LIBADD = \ - gcell_all.lo - - -# The QA library - -libwrapper_qa_la_SOURCES = \ - qa_gcell_general.cc \ - qa_gcell_wrapper.cc - -# FFTW now depends on gcell, don't create circular dependency :-) -# qa_gcp_fft_1d_r2.cc - -libwrapper_qa_la_LIBADD = \ - gcell_general_qa.lo - -# -lfftw3f - -# Headers - -# Moved to include/gcell -#gcellinclude_HEADERS = \ -# gcp_fft_1d_r2.h - -noinst_HEADERS = \ - qa_gcell_general.h \ - qa_gcell_wrapper.h \ - qa_gcp_fft_1d_r2.h - - -CLEANFILES = gcell_all.lo gcell_general_qa.lo - diff --git a/gcell/lib/wrapper/gcp_fft_1d_r2.cc b/gcell/lib/wrapper/gcp_fft_1d_r2.cc deleted file mode 100644 index 9e7e00f49..000000000 --- a/gcell/lib/wrapper/gcp_fft_1d_r2.cc +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- 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. - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gcell/gcp_fft_1d_r2.h> -#include <stdint.h> -#include <stdexcept> -#include <math.h> - -static void -init_jd(gc_job_desc *jd, - gc_proc_id_t proc_id, - unsigned log2_fft_length, - bool shift, - std::complex<float> *out, - const std::complex<float> *in, - const std::complex<float> *twiddle, - const float *window) -{ - jd->proc_id = proc_id; - jd->input.nargs = 2; - jd->output.nargs = 0; - jd->eaa.nargs = 4; - - jd->input.arg[0].u32 = log2_fft_length; - jd->input.arg[1].u32 = shift; - unsigned int fft_length = 1 << log2_fft_length; - - jd->eaa.arg[0].ea_addr = ptr_to_ea(out); - jd->eaa.arg[0].direction = GCJD_DMA_PUT; - jd->eaa.arg[0].put_size = sizeof(std::complex<float>) * fft_length; - - jd->eaa.arg[1].ea_addr = ptr_to_ea(const_cast<std::complex<float>*>(in)); - jd->eaa.arg[1].direction = GCJD_DMA_GET; - jd->eaa.arg[1].get_size = sizeof(std::complex<float>) * fft_length; - - jd->eaa.arg[2].ea_addr = ptr_to_ea(const_cast<std::complex<float>*>(twiddle)); - jd->eaa.arg[2].direction = GCJD_DMA_GET; - jd->eaa.arg[2].get_size = sizeof(std::complex<float>) * fft_length / 4; - - jd->eaa.arg[3].ea_addr = ptr_to_ea(const_cast<float*>(window)); - jd->eaa.arg[3].direction = GCJD_DMA_GET; - if (window == 0) - jd->eaa.arg[3].get_size = 0; - else - jd->eaa.arg[3].get_size = sizeof(float) * fft_length; -} - - -gc_job_desc_sptr -gcp_fft_1d_r2_submit(gc_job_manager_sptr mgr, - unsigned int log2_fft_length, - bool forward, - bool shift, - std::complex<float> *out, - const std::complex<float> *in, - const std::complex<float> *twiddle, - const float *window) -{ - unsigned int fft_length = 1 << log2_fft_length; - if (fft_length > 4096) - throw std::invalid_argument("fft_length > 4096"); - - if ((intptr_t)out & 0xf) - throw gc_bad_align("out"); - if ((intptr_t)in & 0xf) - throw gc_bad_align("in"); - if ((intptr_t)twiddle & 0xf) - throw gc_bad_align("twiddle"); - if ((intptr_t)window & 0xf) - throw gc_bad_align("window"); - - std::string proc_name; - if (forward) - proc_name = "fwd_fft_1d_r2"; - else - proc_name = "inv_fft_1d_r2"; - - gc_proc_id_t fft_id = mgr->lookup_proc(proc_name); - gc_job_desc_sptr jd = gc_job_manager::alloc_job_desc(mgr); - init_jd(jd.get(), fft_id, log2_fft_length, shift, out, in, twiddle, window); - if (!mgr->submit_job(jd.get())){ - gc_job_status_t s = jd->status; - throw gc_bad_submit(proc_name, s); - } - return jd; -} - -void -gcp_fft_1d_r2_twiddle(unsigned int log2_fft_length, std::complex<float> *twiddle) -{ - unsigned int n = 1 << log2_fft_length; - - twiddle[0].real() = 1.0; - twiddle[0].imag() = 0.0; - for (unsigned i=1; i < n/4; i++){ - twiddle[i].real() = cos(i * 2*M_PI/n); - twiddle[n/4 - i].imag() = -twiddle[i].real(); - } -} diff --git a/gcell/lib/wrapper/qa_gcell_general.cc b/gcell/lib/wrapper/qa_gcell_general.cc deleted file mode 100644 index af9719812..000000000 --- a/gcell/lib/wrapper/qa_gcell_general.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- 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. - */ - -#include "qa_gcell_general.h" -#include <cppunit/TestAssert.h> - -#include <stdio.h> -#include <stdlib.h> // random, posix_memalign -#include <algorithm> -#include <string.h> -#include <gcell/gc_job_manager.h> - - -// handle to embedded SPU executable -extern spe_program_handle_t gcell_general_qa_spx; - -gc_job_desc_sptr -gcp_qa_general_submit(gc_job_manager_sptr mgr, const std::string &proc_name) -{ - gc_proc_id_t proc_id = mgr->lookup_proc(proc_name); - gc_job_desc_sptr jd = gc_job_manager::alloc_job_desc(mgr); - - jd->proc_id = proc_id; - jd->input.nargs = 0; - jd->output.nargs = 1; - jd->eaa.nargs = 0; - - if (!mgr->submit_job(jd.get())){ - gc_job_status_t s = jd->status; - throw gc_bad_submit(proc_name, s); - } - return jd; -} - - -bool -qa_gcell_general::generic_test_body(const std::string &proc_name) -{ - gc_jm_options opts; - opts.program_handle = gc_program_handle_from_address(&gcell_general_qa_spx); - opts.nspes = 1; - gc_job_manager_sptr mgr = gc_make_job_manager(&opts); - - gc_job_desc_sptr jd = gcp_qa_general_submit(mgr, proc_name); - if (!mgr->wait_job(jd.get())){ - fprintf(stderr, "wait_job for %s failed: %s\n", - proc_name.c_str(), - gc_job_status_string(jd->status).c_str()); - CPPUNIT_ASSERT(0); - } - - return jd->output.arg[0].u32; // bool result from SPE code -} - -/* - * ------------------------------------------------------------------------ - * Add more calls to SPE QA code here... - * ------------------------------------------------------------------------ - */ -void -qa_gcell_general::test_memset() -{ - CPPUNIT_ASSERT(generic_test_body("qa_memset")); -} - diff --git a/gcell/lib/wrapper/qa_gcell_general.h b/gcell/lib/wrapper/qa_gcell_general.h deleted file mode 100644 index f1e64e717..000000000 --- a/gcell/lib/wrapper/qa_gcell_general.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- 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. - */ - -#ifndef INCLUDED_QA_GCELL_GENERAL_H -#define INCLUDED_QA_GCELL_GENERAL_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gcell_general : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE(qa_gcell_general); - CPPUNIT_TEST(test_memset); - CPPUNIT_TEST_SUITE_END(); - - private: - void test_memset(); - - bool generic_test_body(const std::string &proc_name); -}; - -#endif /* INCLUDED_QA_GCELL_GENERAL_H */ diff --git a/gcell/lib/wrapper/qa_gcell_wrapper.cc b/gcell/lib/wrapper/qa_gcell_wrapper.cc deleted file mode 100644 index ccfd2fdee..000000000 --- a/gcell/lib/wrapper/qa_gcell_wrapper.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2009 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. - */ - -/* - * This class gathers together all the test cases for the lib/wrapper - * directory into a single test suite. As you create new test cases, - * add them here. - */ - -#include <qa_gcell_wrapper.h> -#include <qa_gcell_general.h> -//#include <qa_gcp_fft_1d_r2.h> - -CppUnit::TestSuite * -qa_gcell_wrapper::suite() -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite("wrapper"); - - s->addTest(qa_gcell_general::suite()); - //s->addTest(qa_gcp_fft_1d_r2::suite()); - - return s; -} diff --git a/gcell/lib/wrapper/qa_gcell_wrapper.h b/gcell/lib/wrapper/qa_gcell_wrapper.h deleted file mode 100644 index cb29db883..000000000 --- a/gcell/lib/wrapper/qa_gcell_wrapper.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- 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. - */ -#ifndef INCLUDED_QA_GCELL_WRAPPER_H -#define INCLUDED_QA_GCELL_WRAPPER_H - -#include <cppunit/TestSuite.h> - -//! collect all the tests for the wrapper directory - -class qa_gcell_wrapper { -public: - //! return suite of tests - static CppUnit::TestSuite *suite(); -}; - - -#endif /* INCLUDED_QA_GCELL_WRAPPER_H */ diff --git a/gcell/lib/wrapper/qa_gcp_fft_1d_r2.cc b/gcell/lib/wrapper/qa_gcp_fft_1d_r2.cc deleted file mode 100644 index 742c624dc..000000000 --- a/gcell/lib/wrapper/qa_gcp_fft_1d_r2.cc +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- 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. - */ - -#include "qa_gcp_fft_1d_r2.h" -#include <cppunit/TestAssert.h> -#include <gcell/gcp_fft_1d_r2.h> -#include <fftw3.h> -#include <stdio.h> -#include <stdlib.h> // random, posix_memalign -#include <algorithm> -#include <string.h> - -typedef boost::shared_ptr<void> void_sptr; - -// handle to embedded SPU executable -extern spe_program_handle_t gcell_all_spx; - -/* - * 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); - } -}; - -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()); -} - -// test forward FFT -void -qa_gcp_fft_1d_r2::t1() -{ - gc_jm_options opts; - opts.program_handle = gc_program_handle_from_address(&gcell_all_spx); - opts.nspes = 1; - gc_job_manager_sptr mgr = gc_make_job_manager(&opts); - -#if 1 - for (int log2_fft_size = 5; log2_fft_size <= 12; log2_fft_size++){ - test(mgr, log2_fft_size, true); - } -#else - test(mgr, 5, true); -#endif -} - -// test inverse FFT -void -qa_gcp_fft_1d_r2::t2() -{ - gc_jm_options opts; - opts.program_handle = gc_program_handle_from_address(&gcell_all_spx); - opts.nspes = 1; - gc_job_manager_sptr mgr = gc_make_job_manager(&opts); - -#if 1 - for (int log2_fft_size = 5; log2_fft_size <= 12; log2_fft_size++){ - test(mgr, log2_fft_size, false); - } -#else - test(mgr, 5, false); -#endif -} - -void -qa_gcp_fft_1d_r2::t3() -{ - // FIXME Test fwd and inv with windowing option -} - -void -qa_gcp_fft_1d_r2::t4() -{ - // FIXME Test fwd and inv with shift option -} - -static inline float -abs_diff(std::complex<float> x, std::complex<float> y) -{ - return std::max(std::abs(x.real()-y.real()), - std::abs(x.imag()-y.imag())); -} - -static float -float_abs_rel_error(float ref, float actual) -{ - float delta = ref - actual; - if (std::abs(ref) < 1e-18) - ref = 1e-18; - return std::abs(delta/ref); -} - -static float -abs_rel_error(std::complex<float> ref, std::complex<float> actual) -{ - return std::max(float_abs_rel_error(ref.real(), actual.real()), - float_abs_rel_error(ref.imag(), actual.imag())); -} - -void -qa_gcp_fft_1d_r2::test(gc_job_manager_sptr mgr, int log2_fft_size, bool forward) -{ - int fft_size = 1 << log2_fft_size; - - // allocate aligned buffers with boost shared_ptr's - void_sptr fftw_in_void = aligned_alloc_sptr(fft_size * sizeof(std::complex<float>), 128); - void_sptr fftw_out_void = aligned_alloc_sptr(fft_size * sizeof(std::complex<float>), 128); - void_sptr cell_in_void = aligned_alloc_sptr(fft_size * sizeof(std::complex<float>), 128); - void_sptr cell_out_void = aligned_alloc_sptr(fft_size * sizeof(std::complex<float>), 128); - void_sptr cell_twiddle_void = aligned_alloc_sptr(fft_size/4 * sizeof(std::complex<float>), 128); - - // cast them to the type we really want - std::complex<float> *fftw_in = (std::complex<float> *) fftw_in_void.get(); - std::complex<float> *fftw_out = (std::complex<float> *) fftw_out_void.get(); - std::complex<float> *cell_in = (std::complex<float> *) cell_in_void.get(); - std::complex<float> *cell_out = (std::complex<float> *) cell_out_void.get(); - std::complex<float> *cell_twiddle = (std::complex<float> *) cell_twiddle_void.get(); - - gcp_fft_1d_r2_twiddle(log2_fft_size, cell_twiddle); - - srandom(1); // we want reproducibility - - // initialize the input buffers - for (int i = 0; i < fft_size; i++){ - std::complex<float> t((float) (random() & 0xfffff), (float) (random() & 0xfffff)); - fftw_in[i] = t; - cell_in[i] = t; - } - - // ------------------------------------------------------------------------ - // compute the reference answer - fftwf_plan plan = fftwf_plan_dft_1d (fft_size, - reinterpret_cast<fftwf_complex *>(fftw_in), - reinterpret_cast<fftwf_complex *>(fftw_out), - forward ? FFTW_FORWARD : FFTW_BACKWARD, - FFTW_ESTIMATE); - if (plan == 0){ - fprintf(stderr, "qa_gcp_fft_1d_r2: error creating FFTW plan\n"); - throw std::runtime_error ("fftwf_plan_dft_r2c_1d failed"); - } - - fftwf_execute(plan); - fftwf_destroy_plan(plan); - - // ------------------------------------------------------------------------ - // compute the answer on the cell - gc_job_desc_sptr jd = gcp_fft_1d_r2_submit(mgr, log2_fft_size, forward, false, - cell_out, cell_in, cell_twiddle, 0); - if (!mgr->wait_job(jd.get())){ - fprintf(stderr, "wait_job failed: %s\n", gc_job_status_string(jd->status).c_str()); - CPPUNIT_ASSERT(0); - } - - // ------------------------------------------------------------------------ - // compute the maximum of the relative error - float max_rel = 0.0; - for (int i = 0; i < fft_size; i++){ - max_rel = std::max(max_rel, abs_rel_error(fftw_out[i], cell_out[i])); - if (0) - printf("(%16.3f, %16.3fj) (%16.3f, %16.3fj) (%16.3f, %16.3fj)\n", - fftw_out[i].real(), fftw_out[i].imag(), - cell_out[i].real(), cell_out[i].imag(), - fftw_out[i].real() - cell_out[i].real(), - fftw_out[i].imag() - cell_out[i].imag()); - } - - fprintf(stdout, "%s fft_size = %4d max_rel_error = %e\n", - forward ? "fwd" : "rev", fft_size, max_rel); - - CPPUNIT_ASSERT(max_rel <= 5e-3); -} diff --git a/gcell/lib/wrapper/qa_gcp_fft_1d_r2.h b/gcell/lib/wrapper/qa_gcp_fft_1d_r2.h deleted file mode 100644 index 339ddd25a..000000000 --- a/gcell/lib/wrapper/qa_gcp_fft_1d_r2.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- 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. - */ -#ifndef INCLUDED_QA_GCP_FFT_1D_R2_H -#define INCLUDED_QA_GCP_FFT_1D_R2_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <gcell/gc_job_manager.h> - -class qa_gcp_fft_1d_r2 : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE(qa_gcp_fft_1d_r2); - CPPUNIT_TEST(t1); - CPPUNIT_TEST(t2); - CPPUNIT_TEST(t3); - CPPUNIT_TEST(t4); - CPPUNIT_TEST_SUITE_END(); - - private: - void t1(); - void t2(); - void t3(); - void t4(); - - void test(gc_job_manager_sptr mgr, int log2_fft_size, bool forward); -}; - - - -#endif /* INCLUDED_QA_GCP_FFT_1D_R2_H */ diff --git a/gcell/lib/wrapper/spu/.gitignore b/gcell/lib/wrapper/spu/.gitignore deleted file mode 100644 index 3531485fb..000000000 --- a/gcell/lib/wrapper/spu/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/Makefile -/Makefile.in -/.deps -/.libs -/*.la -/*.lo -/*.a -/*.o diff --git a/gcell/lib/wrapper/spu/gcs_fft_1d_r2.c b/gcell/lib/wrapper/spu/gcs_fft_1d_r2.c deleted file mode 100644 index 582757ab0..000000000 --- a/gcell/lib/wrapper/spu/gcs_fft_1d_r2.c +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- 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. - */ - -#include <gcell/gc_declare_proc.h> -#include <gcell/spu/libfft.h> -#include <assert.h> - -/* - * v is really vector complex<float> - */ -static void -conjugate_vector(vector float *v, int nelements) -{ - vector float k = {1, -1, 1, -1}; - int i; - for (i = 0; i < nelements; i++) - v[i] *= k; -} - -static void -gcs_fwd_fft_1d_r2(const gc_job_direct_args_t *input, - gc_job_direct_args_t *output __attribute__((unused)), - const gc_job_ea_args_t *eaa) -{ - vector float *out = (vector float *) eaa->arg[0].ls_addr; // complex - vector float *in = (vector float *) eaa->arg[1].ls_addr; // complex - vector float *twiddle = (vector float *) eaa->arg[2].ls_addr; // complex - vector float *window = (vector float *) eaa->arg[3].ls_addr; // float - - int log2_fft_length = input->arg[0].u32; - int shift = input->arg[1].u32; // non-zero if we should apply fftshift - - if (eaa->arg[3].get_size){ // apply window - // FIXME pointwise multiply in *= window - assert(0); - } - - fft_1d_r2(out, in, twiddle, log2_fft_length); - - if (shift){ - // FIXME apply "fftshift" to output data in-place - assert(0); - } -} - -GC_DECLARE_PROC(gcs_fwd_fft_1d_r2, "fwd_fft_1d_r2"); - -static void -gcs_inv_fft_1d_r2(const gc_job_direct_args_t *input, - gc_job_direct_args_t *output __attribute__((unused)), - const gc_job_ea_args_t *eaa) -{ - vector float *out = (vector float *) eaa->arg[0].ls_addr; // complex - vector float *in = (vector float *) eaa->arg[1].ls_addr; // complex - vector float *twiddle = (vector float *) eaa->arg[2].ls_addr; // complex - vector float *window = (vector float *) eaa->arg[3].ls_addr; // float - - int log2_fft_length = input->arg[0].u32; - int shift = input->arg[1].u32; // non-zero if we should apply fftshift - - if (eaa->arg[3].get_size){ // apply window - // FIXME pointwise multiply in *= window - assert(0); - } - - if (shift){ - // FIXME apply "fftshift" to input data in-place - assert(0); - } - - conjugate_vector(in, 1 << (log2_fft_length - 1)); - fft_1d_r2(out, in, twiddle, log2_fft_length); - conjugate_vector(out, 1 << (log2_fft_length - 1)); -} - -GC_DECLARE_PROC(gcs_inv_fft_1d_r2, "inv_fft_1d_r2"); |