[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8175 - in gnuradio/branches/developers/eb/gcell-wip/g
From: |
eb |
Subject: |
[Commit-gnuradio] r8175 - in gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib: . general general/spu procs procs/spu runtime spu |
Date: |
Wed, 9 Apr 2008 20:41:46 -0600 (MDT) |
Author: eb
Date: 2008-04-09 20:41:46 -0600 (Wed, 09 Apr 2008)
New Revision: 8175
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d.h
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.c
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.h
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/libfft.h
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.h
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/spu/gcs_fft_1d_r2.c
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/Makefile.am
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/Makefile.am
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/Makefile.am
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/Makefile.am
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager.h
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager_impl.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_job_manager.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/spu/Makefile.am
Log:
work-in-progress on gcell
Modified: gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/Makefile.am
2008-04-09 21:29:37 UTC (rev 8174)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/Makefile.am
2008-04-10 02:41:46 UTC (rev 8175)
@@ -34,11 +34,13 @@
libgcell_la_LIBADD = \
runtime/libruntime.la \
+ procs/libwrapper.la \
-lspe2 \
$(OMNITHREAD_LA)
libgcell_qa_la_LIBADD = \
runtime/libruntime-qa.la \
+ procs/libwrapper-qa.la \
$(CPPUNIT_LIBS)
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/Makefile.am
2008-04-09 21:29:37 UTC (rev 8174)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/Makefile.am
2008-04-10 02:41:46 UTC (rev 8175)
@@ -20,5 +20,4 @@
include $(top_srcdir)/Makefile.common
-# SUBDIRS = spu .
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d.h
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d.h
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d.h
2008-04-10 02:41:46 UTC (rev 8175)
@@ -0,0 +1,103 @@
+/* -------------------------------------------------------------- */
+/* (C)Copyright 2001,2007, */
+/* International Business Machines Corporation, */
+/* Sony Computer Entertainment, Incorporated, */
+/* Toshiba Corporation, */
+/* */
+/* All Rights Reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the */
+/* following conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright*/
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials */
+/* provided with the distribution. */
+/* */
+/* - Neither the name of IBM Corporation nor the names of its */
+/* contributors may be used to endorse or promote products */
+/* derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
+/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
+/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
+/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */
+/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */
+/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
+/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
+/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* -------------------------------------------------------------- */
+/* PROLOG END TAG zYx */
+#ifndef _FFT_1D_H_
+#define _FFT_1D_H_ 1
+
+#include <spu_intrinsics.h>
+
+/* BIT_SWAP - swaps up to 16 bits of the integer _i according to the
+ * pattern specified by _pat.
+ */
+#define BIT_SWAP(_i, _pat)
spu_extract(spu_gather(spu_shuffle(spu_maskb(_i), _pat, _pat)), 0)
+
+
+#ifndef MAX_FFT_1D_SIZE
+#define MAX_FFT_1D_SIZE 8192
+#endif
+
+#ifndef INV_SQRT_2
+#define INV_SQRT_2 0.7071067811865
+#endif
+
+
+/* The following macro, FFT_1D_BUTTERFLY, performs a 4 way SIMD basic
butterfly
+ * operation. The inputs are in parallel arrays (seperate real and imaginary
+ * vectors).
+ *
+ * p --------------------------> P = p + q*Wi
+ * \ /
+ * \ /
+ * \ /
+ * \/
+ * /\
+ * / \
+ * / \
+ * ____ / \
+ * q --| Wi |-----------------> Q = p - q*Wi
+ * ----
+ */
+
+#define FFT_1D_BUTTERFLY(_P_re, _P_im, _Q_re, _Q_im, _p_re, _p_im, _q_re,
_q_im, _W_re, _W_im) { \
+ vector float _qw_re, _qw_im;
\
+
\
+ _qw_re = spu_msub(_q_re, _W_re, spu_mul(_q_im, _W_im));
\
+ _qw_im = spu_madd(_q_re, _W_im, spu_mul(_q_im, _W_re));
\
+ _P_re = spu_add(_p_re, _qw_re);
\
+ _P_im = spu_add(_p_im, _qw_im);
\
+ _Q_re = spu_sub(_p_re, _qw_re);
\
+ _Q_im = spu_sub(_p_im, _qw_im);
\
+}
+
+
+/* FFT_1D_BUTTERFLY_HI is equivalent to FFT_1D_BUTTERFLY with twiddle factors
(W_im, -W_re)
+ */
+#define FFT_1D_BUTTERFLY_HI(_P_re, _P_im, _Q_re, _Q_im, _p_re, _p_im, _q_re,
_q_im, _W_re, _W_im) { \
+ vector float _qw_re, _qw_im;
\
+
\
+ _qw_re = spu_madd(_q_re, _W_im, spu_mul(_q_im, _W_re));
\
+ _qw_im = spu_msub(_q_im, _W_im, spu_mul(_q_re, _W_re));
\
+ _P_re = spu_add(_p_re, _qw_re);
\
+ _P_im = spu_add(_p_im, _qw_im);
\
+ _Q_re = spu_sub(_p_re, _qw_re);
\
+ _Q_im = spu_sub(_p_im, _qw_im);
\
+}
+
+#endif /* _FFT_1D_H_ */
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.c
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.c
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.c
2008-04-10 02:41:46 UTC (rev 8175)
@@ -0,0 +1,32 @@
+/* -*- 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 <libfft.h>
+#include <fft_1d_r2.h>
+
+/*
+ * invoke the inline version
+ */
+void
+fft_1d_r2(vector float *out, vector float *in, vector float *W, int log2_size)
+{
+ _fft_1d_r2(out, in, W, log2_size);
+}
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.h
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.h
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.h
2008-04-10 02:41:46 UTC (rev 8175)
@@ -0,0 +1,529 @@
+/* -------------------------------------------------------------- */
+/* (C)Copyright 2001,2007, */
+/* International Business Machines Corporation, */
+/* Sony Computer Entertainment, Incorporated, */
+/* Toshiba Corporation, */
+/* */
+/* All Rights Reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the */
+/* following conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright*/
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials */
+/* provided with the distribution. */
+/* */
+/* - Neither the name of IBM Corporation nor the names of its */
+/* contributors may be used to endorse or promote products */
+/* derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
+/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
+/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
+/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */
+/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */
+/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
+/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
+/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* -------------------------------------------------------------- */
+/* PROLOG END TAG zYx */
+#ifndef _FFT_1D_R2_H_
+#define _FFT_1D_R2_H_ 1
+
+#include "fft_1d.h"
+
+/* fft_1d_r2
+ * ---------
+ * Performs a single precision, complex Fast Fourier Transform using
+ * the DFT (Discrete Fourier Transform) with radix-2 decimation in time.
+ * The input <in> is an array of complex numbers of length (1<<log2_size)
+ * entries. The result is returned in the array of complex numbers specified
+ * by <out>. Note: This routine can support an in-place transformation
+ * by specifying <in> and <out> to be the same array.
+ *
+ * This implementation utilizes the Cooley-Tukey algorithm consisting
+ * of <log2_size> stages. The basic operation is the butterfly.
+ *
+ * p --------------------------> P = p + q*Wi
+ * \ /
+ * \ /
+ * \ /
+ * \/
+ * /\
+ * / \
+ * / \
+ * ____ / \
+ * q --| Wi |-----------------> Q = p - q*Wi
+ * ----
+ *
+ * This routine also requires pre-computed twiddle values, W. W is an
+ * array of single precision complex numbers of length 1<<(log2_size-2)
+ * and is computed as follows:
+ *
+ * for (i=0; i<n/4; i++)
+ * W[i].real = cos(i * 2*PI/n);
+ * W[i].imag = -sin(i * 2*PI/n);
+ * }
+ *
+ * This array actually only contains the first half of the twiddle
+ * factors. Due for symmetry, the second half of the twiddle factors
+ * are implied and equal:
+ *
+ * for (i=0; i<n/4; i++)
+ * W[i+n/4].real = W[i].imag = sin(i * 2*PI/n);
+ * W[i+n/4].imag = -W[i].real = -cos(i * 2*PI/n);
+ * }
+ *
+ * Further symmetry allows one to generate the twiddle factor table
+ * using half the number of trig computations as follows:
+ *
+ * W[0].real = 1.0;
+ * W[0].imag = 0.0;
+ * for (i=1; i<n/4; i++)
+ * W[i].real = cos(i * 2*PI/n);
+ * W[n/4 - i].imag = -W[i].real;
+ * }
+ *
+ * The complex numbers are packed into quadwords as follows:
+ *
+ * quadword complex
+ * array element array elements
+ * -----------------------------------------------------
+ * i | real 2*i | imag 2*i | real 2*i+1 | imag 2*i+1 |
+ * -----------------------------------------------------
+ *
+ */
+
+
+static __inline void _fft_1d_r2(vector float *out, vector float *in, vector
float *W, int log2_size)
+{
+ int i, j, k;
+ int stage, offset;
+ int i_rev;
+ int n, n_2, n_4, n_8, n_16, n_3_16;
+ int w_stride, w_2stride, w_3stride, w_4stride;
+ int stride, stride_2, stride_4, stride_3_4;
+ vector float *W0, *W1, *W2, *W3;
+ vector float *re0, *re1, *re2, *re3;
+ vector float *im0, *im1, *im2, *im3;
+ vector float *in0, *in1, *in2, *in3, *in4, *in5, *in6, *in7;
+ vector float *out0, *out1, *out2, *out3;
+ vector float tmp0, tmp1;
+ vector float w0_re, w0_im, w1_re, w1_im;
+ vector float w0, w1, w2, w3;
+ vector float src_lo0, src_lo1, src_lo2, src_lo3;
+ vector float src_hi0, src_hi1, src_hi2, src_hi3;
+ vector float dst_lo0, dst_lo1, dst_lo2, dst_lo3;
+ vector float dst_hi0, dst_hi1, dst_hi2, dst_hi3;
+ vector float out_re_lo0, out_re_lo1, out_re_lo2, out_re_lo3;
+ vector float out_im_lo0, out_im_lo1, out_im_lo2, out_im_lo3;
+ vector float out_re_hi0, out_re_hi1, out_re_hi2, out_re_hi3;
+ vector float out_im_hi0, out_im_hi1, out_im_hi2, out_im_hi3;
+ vector float re_lo0, re_lo1, re_lo2, re_lo3;
+ vector float im_lo0, im_lo1, im_lo2, im_lo3;
+ vector float re_hi0, re_hi1, re_hi2, re_hi3;
+ vector float im_hi0, im_hi1, im_hi2, im_hi3;
+ vector float pq_lo0, pq_lo1, pq_lo2, pq_lo3;
+ vector float pq_hi0, pq_hi1, pq_hi2, pq_hi3;
+ vector float re[MAX_FFT_1D_SIZE/4], im[MAX_FFT_1D_SIZE/4]; /* real &
imaginary working arrays */
+ vector float ppmm = (vector float) { 1.0f, 1.0f, -1.0f, -1.0f};
+ vector float pmmp = (vector float) { 1.0f, -1.0f, -1.0f, 1.0f};
+ vector unsigned char reverse;
+ vector unsigned char shuf_lo = (vector unsigned char) {
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 16,17,18,19, 20,21,22,23};
+ vector unsigned char shuf_hi = (vector unsigned char) {
+ 8, 9,10,11, 12,13,14,15,
+ 24,25,26,27, 28,29,30,31};
+ vector unsigned char shuf_0202 = (vector unsigned char) {
+ 0, 1, 2, 3, 8, 9,10,11,
+ 0, 1, 2, 3, 8, 9,10,11};
+ vector unsigned char shuf_1313 = (vector unsigned char) {
+ 4, 5, 6, 7, 12,13,14,15,
+ 4, 5, 6, 7, 12,13,14,15};
+ vector unsigned char shuf_0303 = (vector unsigned char) {
+ 0, 1, 2, 3, 12,13,14,15,
+ 0, 1, 2, 3, 12,13,14,15};
+ vector unsigned char shuf_1212 = (vector unsigned char) {
+ 4, 5, 6, 7, 8, 9,10,11,
+ 4, 5, 6, 7, 8, 9,10,11};
+ vector unsigned char shuf_0415 = (vector unsigned char) {
+ 0, 1, 2, 3, 16,17,18,19,
+ 4, 5, 6, 7, 20,21,22,23};
+ vector unsigned char shuf_2637 = (vector unsigned char) {
+ 8, 9,10,11, 24,25,26,27,
+ 12,13,14,15,28,29,30,31};
+ vector unsigned char shuf_0246 = (vector unsigned char) {
+ 0, 1, 2, 3, 8, 9,10,11,
+ 16,17,18,19,24,25,26,27};
+ vector unsigned char shuf_1357 = (vector unsigned char) {
+ 4, 5, 6, 7, 12,13,14,15,
+ 20,21,22,23,28,29,30,31};
+
+ n = 1 << log2_size;
+ n_2 = n >> 1;
+ n_4 = n >> 2;
+ n_8 = n >> 3;
+ n_16 = n >> 4;
+
+ n_3_16 = n_8 + n_16;
+
+ /* Compute a byte reverse shuffle pattern to be used to produce
+ * an address bit swap.
+ */
+ reverse = spu_or(spu_slqwbyte(spu_splats((unsigned char)0x80), log2_size),
+ spu_rlmaskqwbyte(((vec_uchar16){15,14,13,12, 11,10,9,8,
+ 7, 6, 5, 4, 3, 2,1,0}),
+ log2_size-16));
+
+ /* Perform the first 3 stages of the FFT. These stages differs from
+ * other stages in that the inputs are unscrambled and the data is
+ * reformated into parallel arrays (ie, seperate real and imaginary
+ * arrays). The term "unscramble" means the bit address reverse the
+ * data array. In addition, the first three stages have simple twiddle
+ * weighting factors.
+ * stage 1: (1, 0)
+ * stage 2: (1, 0) and (0, -1)
+ * stage 3: (1, 0), (0.707, -0.707), (0, -1), (-0.707, -0.707)
+ *
+ * The arrays are processed as two halves, simultaneously. The lo (first
+ * half) and hi (second half). This is done because the scramble
+ * shares source value between each half of the output arrays.
+ */
+ i = 0;
+ i_rev = 0;
+
+ in0 = in;
+ in1 = in + n_8;
+ in2 = in + n_16;
+ in3 = in + n_3_16;
+
+ in4 = in + n_4;
+ in5 = in1 + n_4;
+ in6 = in2 + n_4;
+ in7 = in3 + n_4;
+
+ re0 = re;
+ re1 = re + n_8;
+ im0 = im;
+ im1 = im + n_8;
+
+ w0_re = (vector float) { 1.0f, INV_SQRT_2, 0.0f, -INV_SQRT_2};
+ w0_im = (vector float) { 0.0f, -INV_SQRT_2, -1.0f, -INV_SQRT_2};
+
+ do {
+ src_lo0 = in0[i_rev];
+ src_lo1 = in1[i_rev];
+ src_lo2 = in2[i_rev];
+ src_lo3 = in3[i_rev];
+
+ src_hi0 = in4[i_rev];
+ src_hi1 = in5[i_rev];
+ src_hi2 = in6[i_rev];
+ src_hi3 = in7[i_rev];
+
+ /* Perform scramble.
+ */
+ dst_lo0 = spu_shuffle(src_lo0, src_hi0, shuf_lo);
+ dst_hi0 = spu_shuffle(src_lo0, src_hi0, shuf_hi);
+ dst_lo1 = spu_shuffle(src_lo1, src_hi1, shuf_lo);
+ dst_hi1 = spu_shuffle(src_lo1, src_hi1, shuf_hi);
+ dst_lo2 = spu_shuffle(src_lo2, src_hi2, shuf_lo);
+ dst_hi2 = spu_shuffle(src_lo2, src_hi2, shuf_hi);
+ dst_lo3 = spu_shuffle(src_lo3, src_hi3, shuf_lo);
+ dst_hi3 = spu_shuffle(src_lo3, src_hi3, shuf_hi);
+
+ /* Perform the stage 1 butterfly. The multiplier constant, ppmm,
+ * is used to control the sign of the operands since a single
+ * quadword contains both of P and Q valule of the butterfly.
+ */
+ pq_lo0 = spu_madd(ppmm, dst_lo0, spu_rlqwbyte(dst_lo0, 8));
+ pq_hi0 = spu_madd(ppmm, dst_hi0, spu_rlqwbyte(dst_hi0, 8));
+ pq_lo1 = spu_madd(ppmm, dst_lo1, spu_rlqwbyte(dst_lo1, 8));
+ pq_hi1 = spu_madd(ppmm, dst_hi1, spu_rlqwbyte(dst_hi1, 8));
+ pq_lo2 = spu_madd(ppmm, dst_lo2, spu_rlqwbyte(dst_lo2, 8));
+ pq_hi2 = spu_madd(ppmm, dst_hi2, spu_rlqwbyte(dst_hi2, 8));
+ pq_lo3 = spu_madd(ppmm, dst_lo3, spu_rlqwbyte(dst_lo3, 8));
+ pq_hi3 = spu_madd(ppmm, dst_hi3, spu_rlqwbyte(dst_hi3, 8));
+
+ /* Perfrom the stage 2 butterfly. For this stage, the
+ * inputs pq are still interleaved (p.real, p.imag, q.real,
+ * q.imag), so we must first re-order the data into
+ * parallel arrays as well as perform the reorder
+ * associated with the twiddle W[n/4], which equals
+ * (0, -1).
+ *
+ * ie. (A, B) * (0, -1) => (B, -A)
+ */
+ re_lo0 = spu_madd(ppmm,
+ spu_shuffle(pq_lo1, pq_lo1, shuf_0303),
+ spu_shuffle(pq_lo0, pq_lo0, shuf_0202));
+ im_lo0 = spu_madd(pmmp,
+ spu_shuffle(pq_lo1, pq_lo1, shuf_1212),
+ spu_shuffle(pq_lo0, pq_lo0, shuf_1313));
+
+ re_lo1 = spu_madd(ppmm,
+ spu_shuffle(pq_lo3, pq_lo3, shuf_0303),
+ spu_shuffle(pq_lo2, pq_lo2, shuf_0202));
+ im_lo1 = spu_madd(pmmp,
+ spu_shuffle(pq_lo3, pq_lo3, shuf_1212),
+ spu_shuffle(pq_lo2, pq_lo2, shuf_1313));
+
+
+ re_hi0 = spu_madd(ppmm,
+ spu_shuffle(pq_hi1, pq_hi1, shuf_0303),
+ spu_shuffle(pq_hi0, pq_hi0, shuf_0202));
+ im_hi0 = spu_madd(pmmp,
+ spu_shuffle(pq_hi1, pq_hi1, shuf_1212),
+ spu_shuffle(pq_hi0, pq_hi0, shuf_1313));
+
+ re_hi1 = spu_madd(ppmm,
+ spu_shuffle(pq_hi3, pq_hi3, shuf_0303),
+ spu_shuffle(pq_hi2, pq_hi2, shuf_0202));
+ im_hi1 = spu_madd(pmmp,
+ spu_shuffle(pq_hi3, pq_hi3, shuf_1212),
+ spu_shuffle(pq_hi2, pq_hi2, shuf_1313));
+
+
+ /* Perform stage 3 butterfly.
+ */
+ FFT_1D_BUTTERFLY(re0[0], im0[0], re0[1], im0[1], re_lo0, im_lo0, re_lo1,
im_lo1, w0_re, w0_im);
+ FFT_1D_BUTTERFLY(re1[0], im1[0], re1[1], im1[1], re_hi0, im_hi0, re_hi1,
im_hi1, w0_re, w0_im);
+
+ re0 += 2;
+ re1 += 2;
+ im0 += 2;
+ im1 += 2;
+
+ i += 8;
+ i_rev = BIT_SWAP(i, reverse) / 2;
+ } while (i < n_2);
+
+ /* Process stages 4 to log2_size-2
+ */
+ for (stage=4, stride=4; stage<log2_size-1; stage++, stride += stride) {
+ w_stride = n_2 >> stage;
+ w_2stride = n >> stage;
+ w_3stride = w_stride + w_2stride;
+ w_4stride = w_2stride + w_2stride;
+
+ W0 = W;
+ W1 = W + w_stride;
+ W2 = W + w_2stride;
+ W3 = W + w_3stride;
+
+ stride_2 = stride >> 1;
+ stride_4 = stride >> 2;
+ stride_3_4 = stride_2 + stride_4;
+
+ re0 = re; im0 = im;
+ re1 = re + stride_2; im1 = im + stride_2;
+ re2 = re + stride_4; im2 = im + stride_4;
+ re3 = re + stride_3_4; im3 = im + stride_3_4;
+
+ for (i=0, offset=0; i<stride_4; i++, offset += w_4stride) {
+ /* Compute the twiddle factors
+ */
+ w0 = W0[offset];
+ w1 = W1[offset];
+ w2 = W2[offset];
+ w3 = W3[offset];
+
+ tmp0 = spu_shuffle(w0, w2, shuf_0415);
+ tmp1 = spu_shuffle(w1, w3, shuf_0415);
+
+ w0_re = spu_shuffle(tmp0, tmp1, shuf_0415);
+ w0_im = spu_shuffle(tmp0, tmp1, shuf_2637);
+
+ j = i;
+ k = i + stride;
+ do {
+ re_lo0 = re0[j]; im_lo0 = im0[j];
+ re_lo1 = re1[j]; im_lo1 = im1[j];
+
+ re_hi0 = re2[j]; im_hi0 = im2[j];
+ re_hi1 = re3[j]; im_hi1 = im3[j];
+
+ re_lo2 = re0[k]; im_lo2 = im0[k];
+ re_lo3 = re1[k]; im_lo3 = im1[k];
+
+ re_hi2 = re2[k]; im_hi2 = im2[k];
+ re_hi3 = re3[k]; im_hi3 = im3[k];
+
+ FFT_1D_BUTTERFLY (re0[j], im0[j], re1[j], im1[j], re_lo0, im_lo0,
re_lo1, im_lo1, w0_re, w0_im);
+ FFT_1D_BUTTERFLY_HI(re2[j], im2[j], re3[j], im3[j], re_hi0, im_hi0,
re_hi1, im_hi1, w0_re, w0_im);
+
+ FFT_1D_BUTTERFLY (re0[k], im0[k], re1[k], im1[k], re_lo2, im_lo2,
re_lo3, im_lo3, w0_re, w0_im);
+ FFT_1D_BUTTERFLY_HI(re2[k], im2[k], re3[k], im3[k], re_hi2, im_hi2,
re_hi3, im_hi3, w0_re, w0_im);
+
+ j += 2 * stride;
+ k += 2 * stride;
+ } while (j < n_4);
+ }
+ }
+
+ /* Process stage log2_size-1. This is identical to the stage processing above
+ * except for this stage the inner loop is only executed once so it is
removed
+ * entirely.
+ */
+ w_stride = n_2 >> stage;
+ w_2stride = n >> stage;
+ w_3stride = w_stride + w_2stride;
+ w_4stride = w_2stride + w_2stride;
+
+ stride_2 = stride >> 1;
+ stride_4 = stride >> 2;
+
+ stride_3_4 = stride_2 + stride_4;
+
+ re0 = re; im0 = im;
+ re1 = re + stride_2; im1 = im + stride_2;
+ re2 = re + stride_4; im2 = im + stride_4;
+ re3 = re + stride_3_4; im3 = im + stride_3_4;
+
+ for (i=0, offset=0; i<stride_4; i++, offset += w_4stride) {
+ /* Compute the twiddle factors
+ */
+ w0 = W[offset];
+ w1 = W[offset + w_stride];
+ w2 = W[offset + w_2stride];
+ w3 = W[offset + w_3stride];
+
+ tmp0 = spu_shuffle(w0, w2, shuf_0415);
+ tmp1 = spu_shuffle(w1, w3, shuf_0415);
+
+ w0_re = spu_shuffle(tmp0, tmp1, shuf_0415);
+ w0_im = spu_shuffle(tmp0, tmp1, shuf_2637);
+
+ j = i;
+ k = i + stride;
+
+ re_lo0 = re0[j]; im_lo0 = im0[j];
+ re_lo1 = re1[j]; im_lo1 = im1[j];
+
+ re_hi0 = re2[j]; im_hi0 = im2[j];
+ re_hi1 = re3[j]; im_hi1 = im3[j];
+
+ re_lo2 = re0[k]; im_lo2 = im0[k];
+ re_lo3 = re1[k]; im_lo3 = im1[k];
+
+ re_hi2 = re2[k]; im_hi2 = im2[k];
+ re_hi3 = re3[k]; im_hi3 = im3[k];
+
+ FFT_1D_BUTTERFLY (re0[j], im0[j], re1[j], im1[j], re_lo0, im_lo0,
re_lo1, im_lo1, w0_re, w0_im);
+ FFT_1D_BUTTERFLY_HI(re2[j], im2[j], re3[j], im3[j], re_hi0, im_hi0,
re_hi1, im_hi1, w0_re, w0_im);
+
+ FFT_1D_BUTTERFLY (re0[k], im0[k], re1[k], im1[k], re_lo2, im_lo2,
re_lo3, im_lo3, w0_re, w0_im);
+ FFT_1D_BUTTERFLY_HI(re2[k], im2[k], re3[k], im3[k], re_hi2, im_hi2,
re_hi3, im_hi3, w0_re, w0_im);
+ }
+
+
+ /* Process the final stage (stage log2_size). For this stage,
+ * reformat the data from parallel arrays back into
+ * interleaved arrays,storing the result into <in>.
+ *
+ * This loop has been manually unrolled by 2 to improve
+ * dual issue rates and reduce stalls. This unrolling
+ * forces a minimum FFT size of 32.
+ */
+ re0 = re;
+ re1 = re + n_8;
+ re2 = re + n_16;
+ re3 = re + n_3_16;
+
+ im0 = im;
+ im1 = im + n_8;
+ im2 = im + n_16;
+ im3 = im + n_3_16;
+
+ out0 = out;
+ out1 = out + n_4;
+ out2 = out + n_8;
+ out3 = out1 + n_8;
+
+ i = n_16;
+
+ do {
+ /* Fetch the twiddle factors
+ */
+ w0 = W[0];
+ w1 = W[1];
+ w2 = W[2];
+ w3 = W[3];
+
+ W += 4;
+
+ w0_re = spu_shuffle(w0, w1, shuf_0246);
+ w0_im = spu_shuffle(w0, w1, shuf_1357);
+ w1_re = spu_shuffle(w2, w3, shuf_0246);
+ w1_im = spu_shuffle(w2, w3, shuf_1357);
+
+ /* Fetch the butterfly inputs, reals and imaginaries
+ */
+ re_lo0 = re0[0]; im_lo0 = im0[0];
+ re_lo1 = re1[0]; im_lo1 = im1[0];
+ re_lo2 = re0[1]; im_lo2 = im0[1];
+ re_lo3 = re1[1]; im_lo3 = im1[1];
+
+ re_hi0 = re2[0]; im_hi0 = im2[0];
+ re_hi1 = re3[0]; im_hi1 = im3[0];
+ re_hi2 = re2[1]; im_hi2 = im2[1];
+ re_hi3 = re3[1]; im_hi3 = im3[1];
+
+ re0 += 2; im0 += 2;
+ re1 += 2; im1 += 2;
+ re2 += 2; im2 += 2;
+ re3 += 2; im3 += 2;
+
+ /* Perform the butterflys
+ */
+ FFT_1D_BUTTERFLY (out_re_lo0, out_im_lo0, out_re_lo1, out_im_lo1,
re_lo0, im_lo0, re_lo1, im_lo1, w0_re, w0_im);
+ FFT_1D_BUTTERFLY (out_re_lo2, out_im_lo2, out_re_lo3, out_im_lo3,
re_lo2, im_lo2, re_lo3, im_lo3, w1_re, w1_im);
+
+ FFT_1D_BUTTERFLY_HI(out_re_hi0, out_im_hi0, out_re_hi1, out_im_hi1,
re_hi0, im_hi0, re_hi1, im_hi1, w0_re, w0_im);
+ FFT_1D_BUTTERFLY_HI(out_re_hi2, out_im_hi2, out_re_hi3, out_im_hi3,
re_hi2, im_hi2, re_hi3, im_hi3, w1_re, w1_im);
+
+ /* Interleave the results and store them into the output buffers (ie,
+ * the original input buffers.
+ */
+ out0[0] = spu_shuffle(out_re_lo0, out_im_lo0, shuf_0415);
+ out0[1] = spu_shuffle(out_re_lo0, out_im_lo0, shuf_2637);
+ out0[2] = spu_shuffle(out_re_lo2, out_im_lo2, shuf_0415);
+ out0[3] = spu_shuffle(out_re_lo2, out_im_lo2, shuf_2637);
+
+ out1[0] = spu_shuffle(out_re_lo1, out_im_lo1, shuf_0415);
+ out1[1] = spu_shuffle(out_re_lo1, out_im_lo1, shuf_2637);
+ out1[2] = spu_shuffle(out_re_lo3, out_im_lo3, shuf_0415);
+ out1[3] = spu_shuffle(out_re_lo3, out_im_lo3, shuf_2637);
+
+ out2[0] = spu_shuffle(out_re_hi0, out_im_hi0, shuf_0415);
+ out2[1] = spu_shuffle(out_re_hi0, out_im_hi0, shuf_2637);
+ out2[2] = spu_shuffle(out_re_hi2, out_im_hi2, shuf_0415);
+ out2[3] = spu_shuffle(out_re_hi2, out_im_hi2, shuf_2637);
+
+ out3[0] = spu_shuffle(out_re_hi1, out_im_hi1, shuf_0415);
+ out3[1] = spu_shuffle(out_re_hi1, out_im_hi1, shuf_2637);
+ out3[2] = spu_shuffle(out_re_hi3, out_im_hi3, shuf_0415);
+ out3[3] = spu_shuffle(out_re_hi3, out_im_hi3, shuf_2637);
+
+ out0 += 4;
+ out1 += 4;
+ out2 += 4;
+ out3 += 4;
+
+ i -= 2;
+ } while (i);
+}
+
+#endif /* _FFT_1D_R2_H_ */
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/fft_1d_r2.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/libfft.h
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/libfft.h
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/libfft.h
2008-04-10 02:41:46 UTC (rev 8175)
@@ -0,0 +1,110 @@
+/* -------------------------------------------------------------- */
+/* (C)Copyright 2008 Free Software Foundation, Inc. */
+/* (C)Copyright 2001,2007, */
+/* International Business Machines Corporation, */
+/* Sony Computer Entertainment, Incorporated, */
+/* Toshiba Corporation, */
+/* */
+/* All Rights Reserved. */
+/* */
+/* Redistribution and use in source and binary forms, with or */
+/* without modification, are permitted provided that the */
+/* following conditions are met: */
+/* */
+/* - Redistributions of source code must retain the above copyright*/
+/* notice, this list of conditions and the following disclaimer. */
+/* */
+/* - Redistributions in binary form must reproduce the above */
+/* copyright notice, this list of conditions and the following */
+/* disclaimer in the documentation and/or other materials */
+/* provided with the distribution. */
+/* */
+/* - Neither the name of IBM Corporation nor the names of its */
+/* contributors may be used to endorse or promote products */
+/* derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */
+/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */
+/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
+/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
+/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
+/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
+/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
+/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */
+/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */
+/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
+/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
+/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* -------------------------------------------------------------- */
+/* PROLOG END TAG zYx */
+
+#ifndef INCLUDED_LIBFFT_H
+#define INCLUDED_LIBFFT_H
+
+/* fft_1d_r2
+ * ---------
+ * Performs a single precision, complex Fast Fourier Transform using
+ * the DFT (Discrete Fourier Transform) with radix-2 decimation in time.
+ * The input <in> is an array of complex numbers of length (1<<log2_size)
+ * entries. The result is returned in the array of complex numbers specified
+ * by <out>. Note: This routine can support an in-place transformation
+ * by specifying <in> and <out> to be the same array.
+ *
+ * This implementation utilizes the Cooley-Tukey algorithm consisting
+ * of <log2_size> stages. The basic operation is the butterfly.
+ *
+ * p --------------------------> P = p + q*Wi
+ * \ /
+ * \ /
+ * \ /
+ * \/
+ * /\
+ * / \
+ * / \
+ * ____ / \
+ * q --| Wi |-----------------> Q = p - q*Wi
+ * ----
+ *
+ * This routine also requires pre-computed twiddle values, W. W is an
+ * array of single precision complex numbers of length 1<<(log2_size-2)
+ * and is computed as follows:
+ *
+ * for (i=0; i<n/4; i++)
+ * W[i].real = cos(i * 2*PI/n);
+ * W[i].imag = -sin(i * 2*PI/n);
+ * }
+ *
+ * This array actually only contains the first half of the twiddle
+ * factors. Due for symmetry, the second half of the twiddle factors
+ * are implied and equal:
+ *
+ * for (i=0; i<n/4; i++)
+ * W[i+n/4].real = W[i].imag = sin(i * 2*PI/n);
+ * W[i+n/4].imag = -W[i].real = -cos(i * 2*PI/n);
+ * }
+ *
+ * Further symmetry allows one to generate the twiddle factor table
+ * using half the number of trig computations as follows:
+ *
+ * W[0].real = 1.0;
+ * W[0].imag = 0.0;
+ * for (i=1; i<n/4; i++)
+ * W[i].real = cos(i * 2*PI/n);
+ * W[n/4 - i].imag = -W[i].real;
+ * }
+ *
+ * The complex numbers are packed into quadwords as follows:
+ *
+ * quadword complex
+ * array element array elements
+ * -----------------------------------------------------
+ * i | real 2*i | imag 2*i | real 2*i+1 | imag 2*i+1 |
+ * -----------------------------------------------------
+ *
+ */
+
+void fft_1d_r2(vector float *out, vector float *in, vector float *W, int
log2_size);
+
+#endif /* INCLUDED_LIBFFT_H */
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/general/spu/libfft.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/Makefile.am
2008-04-09 21:29:37 UTC (rev 8174)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/Makefile.am
2008-04-10 02:41:46 UTC (rev 8175)
@@ -20,5 +20,17 @@
include $(top_srcdir)/Makefile.common
-# SUBDIRS = spu .
+AM_CPPFLAGS = $(DEFINES) $(GCELL_INCLUDES) $(WITH_INCLUDES)
+
+noinst_LTLIBRARIES = libwrapper.la libwrapper-qa.la
+
+libwrapper_la_SOURCES = \
+ gcp_fft_1d_r2.cc
+
+libwrapper_qa_la_SOURCES =
+
+gcellinclude_HEADERS = \
+ gcp_fft_1d_r2.h
+
+noinst_HEADERS =
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.cc
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.cc
2008-04-10 02:41:46 UTC (rev 8175)
@@ -0,0 +1,111 @@
+/* -*- 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 <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,
+ std::complex<float> *out,
+ const std::complex<float> *in,
+ const std::complex<float> *W)
+{
+ jd->proc_id = proc_id;
+ jd->input.nargs = 1;
+ jd->output.nargs = 0;
+ jd->eaa.nargs = 3;
+
+ jd->input.arg[0].u32 = log2_fft_length;
+ 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>*>(W));
+ jd->eaa.arg[2].direction = GCJD_DMA_GET;
+ jd->eaa.arg[2].get_size = sizeof(std::complex<float>) * fft_length / 4;
+}
+
+
+gc_job_desc *
+gcp_fft_1d_r2_submit(gc_job_manager_sptr mgr,
+ unsigned int log2_fft_length,
+ std::complex<float> *out,
+ const std::complex<float> *in,
+ const std::complex<float> *W)
+{
+ unsigned int fft_length = 1 << log2_fft_length;
+ if (fft_length > 8192)
+ throw std::invalid_argument("fft_length > 8192");
+
+ if ((intptr_t)out & 0xf)
+ throw gc_bad_align("out");
+ if ((intptr_t)in & 0xf)
+ throw gc_bad_align("in");
+ if ((intptr_t)W & 0xf)
+ throw gc_bad_align("W");
+
+ gc_proc_id_t fft_id = mgr->lookup_proc("fft_1d_r2");
+ gc_job_desc *jd = mgr->alloc_job_desc();
+ init_jd(jd, fft_id, log2_fft_length, out, in, W);
+ if (!mgr->submit_job(jd)){
+ gc_job_status_t s = jd->status;
+ mgr->free_job_desc(jd);
+ throw gc_bad_submit("fft_1d_r2", s);
+ }
+ return jd;
+}
+
+void
+gcp_fft_1d_r2_forward_twiddle(unsigned int log2_fft_length,
std::complex<float> *W)
+{
+ unsigned int n = 1 << log2_fft_length;
+
+ W[0].real() = 1.0;
+ W[0].imag() = 0.0;
+ for (unsigned i=1; i < n/4; i++){
+ W[i].real() = cos(i * 2*M_PI/n);
+ W[n/4 - i].imag() = -W[i].real();
+ }
+}
+
+
+void
+gcp_fft_1d_r2_reverse_twiddle(unsigned int log2_fft_length,
std::complex<float> *W)
+{
+ // reverse factors are the conjugate of the forward factors
+ gcp_fft_1d_r2_forward_twiddle(log2_fft_length, W);
+
+ unsigned int n = 1 << log2_fft_length;
+ for (unsigned i=0; i < n/4; i++)
+ W[i] = conj(W[i]);
+}
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.h
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.h
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.h
2008-04-10 02:41:46 UTC (rev 8175)
@@ -0,0 +1,64 @@
+/* -*- 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_GCP_FFT_1D_R2_H
+#define INCLUDED_GCP_FFT_1D_R2_H
+
+#include <gc_job_manager.h>
+#include <complex>
+
+/*!
+ * \brief Submit a job that computes the forward or reverse FFT.
+ *
+ * \param mgr is the job manager instance
+ * \param log2_fft_length is the log2 of the fft_length (4 <= x <= 13).
+ * \param out is the fft_length output from FFT (must be 16-byte aligned).
+ * \param in is the fft_length input to FFT (must be 16-byte aligned).
+ * \param W is fft_length/4 twiddle factor input to FFT (must be 16-byte
aligned).
+ *
+ * Returns a job descriptor which should be passed to wait_job*.
+ * Throws an exception in the event of a problem.
+ */
+gc_job_desc *
+gcp_fft_1d_r2_submit(gc_job_manager_sptr mgr,
+ unsigned int log2_fft_length,
+ std::complex<float> *out,
+ const std::complex<float> *in,
+ const std::complex<float> *W);
+
+/*!
+ * \brief Compute twiddle factors for forward transform.
+ *
+ * \param log2_fft_length is the log2 of the fft_length.
+ * \param W is fft_length/4 twiddle factor output (must be 16-byte aligned).
+ */
+void
+gcp_fft_1d_r2_forward_twiddle(unsigned int log2_fft_length,
std::complex<float> *W);
+
+/*!
+ * \brief Compute twiddle factors for reverse transform.
+ *
+ * \param log2_fft_length is the log2 of the fft_length.
+ * \param W is fft_length/4 twiddle factor output (must be 16-byte aligned).
+ */
+void
+gcp_fft_1d_r2_reverse_twiddle(unsigned int log2_fft_length,
std::complex<float> *W);
+
+#endif /* INCLUDED_GCP_FFT_1D_R2_H */
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/gcp_fft_1d_r2.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/spu/gcs_fft_1d_r2.c
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/spu/gcs_fft_1d_r2.c
(rev 0)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/spu/gcs_fft_1d_r2.c
2008-04-10 02:41:46 UTC (rev 8175)
@@ -0,0 +1,38 @@
+/* -*- 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 <gc_declare_proc.h>
+#include <libfft.h>
+
+static void
+gcs_fft_1d_r2(const gc_job_direct_args_t *input,
+ gc_job_direct_args_t *output,
+ const gc_job_ea_args_t *eaa)
+{
+ vector float *out = (vector float *) eaa_arg[0].ls_addr;
+ vector float *in = (vector float *) eaa_arg[1].ls_addr;
+ vector float *W = (vector float *) eaa_arg[2].ls_addr;
+ int log2_fft_length = input->arg[0].u32;
+
+ fft_1d_r2(out, in, W, log2_fft_length);
+}
+
+GC_DECLARE_PROC(gcs_fft_1d_r2, "fft_1d_r2");
Property changes on:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/procs/spu/gcs_fft_1d_r2.c
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/Makefile.am
2008-04-09 21:29:37 UTC (rev 8174)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/Makefile.am
2008-04-10 02:41:46 UTC (rev 8175)
@@ -20,8 +20,6 @@
include $(top_srcdir)/Makefile.common
-# SUBDIRS = spu .
-
IBM_PPU_SYNC_INCLUDES = -I$(top_srcdir)/gcell/src/ibm/sync/ppu_source
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager.cc
2008-04-09 21:29:37 UTC (rev 8174)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager.cc
2008-04-10 02:41:46 UTC (rev 8175)
@@ -25,6 +25,7 @@
#include "gc_job_manager.h"
#include "gc_job_manager_impl.h"
#include <boost/weak_ptr.hpp>
+#include <stdio.h>
static boost::weak_ptr<gc_job_manager> s_singleton;
@@ -107,4 +108,53 @@
return spe_program_handle_sptr(handle, nop_spe_program_handle_deleter());
}
+const std::string
+gc_job_status_string(gc_job_status_t status)
+{
+ switch(status){
+ case JS_OK: return "JS_OK";
+ case JS_SHUTTING_DOWN: return "JS_SHUTTING_DOWN";
+ case JS_TOO_MANY_CLIENTS: return "JS_TOO_MANY_CLIENTS";
+ case JS_UNKNOWN_PROC: return "JS_UNKNOWN_PROC";
+ case JS_BAD_DIRECTION: return "JS_BAD_DIRECTION";
+ case JS_BAD_EAH: return "JS_BAD_EAH";
+ case JS_BAD_N_DIRECT: return "JS_BAD_N_DIRECT";
+ case JS_BAD_N_EA: return "JS_BAD_N_EA";
+ case JS_ARGS_TOO_LONG: return "JS_ARGS_TOO_LONG";
+ case JS_BAD_JUJU: return "JS_BAD_JUJU";
+ case JS_BAD_JOB_DESC: return "JS_BAD_JOB_DESC";
+ default:
+ char buf[100];
+ snprintf(buf, sizeof(buf), "unknown gc_job_status_t (%d)\n", status);
+ return buf;
+ }
+}
+/*
+ * exception classes
+ */
+
+gc_exception::gc_exception(const std::string &msg)
+ : runtime_error(msg)
+{
+}
+
+gc_unknown_proc::gc_unknown_proc(const std::string &msg)
+ : gc_exception("gc_unknown_proc: " + msg)
+{
+}
+
+gc_bad_alloc::gc_bad_alloc(const std::string &msg)
+ : gc_exception("gc_bad_alloc: " + msg)
+{
+}
+
+gc_bad_align::gc_bad_align(const std::string &msg)
+ : gc_exception("gc_bad_align: " + msg)
+{
+}
+
+gc_bad_submit::gc_bad_submit(const std::string &name, gc_job_status_t status)
+ : gc_exception("gc_bad_submit(" + name + "): " +
gc_job_status_string(status))
+{
+}
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager.h
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager.h
2008-04-09 21:29:37 UTC (rev 8174)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager.h
2008-04-10 02:41:46 UTC (rev 8175)
@@ -26,6 +26,7 @@
#include <boost/shared_ptr.hpp>
#include <vector>
#include <string>
+#include <stdexcept>
#include <libspe2.h>
#include "gc_job_desc.h"
@@ -63,6 +64,12 @@
spe_program_handle_sptr
gc_program_handle_from_address(spe_program_handle_t *handle);
+/*!
+ * \brief map gc_job_status_t into a string
+ */
+const std::string
+gc_job_status_string(gc_job_status_t status);
+
/*
* \brief Options that configure the job_manager.
* The default values are reasonable.
@@ -90,7 +97,39 @@
GC_WAIT_ALL,
};
+/*
+ * exception classes
+ */
+class gc_exception : public std::runtime_error
+{
+public:
+ gc_exception(const std::string &msg);
+};
+class gc_unknown_proc : public gc_exception
+{
+public:
+ gc_unknown_proc(const std::string &msg);
+};
+
+class gc_bad_alloc : public gc_exception
+{
+public:
+ gc_bad_alloc(const std::string &msg);
+};
+
+class gc_bad_align : public gc_exception
+{
+public:
+ gc_bad_align(const std::string &msg);
+};
+
+class gc_bad_submit : public gc_exception
+{
+public:
+ gc_bad_submit(const std::string &name, gc_job_status_t status);
+};
+
/*
* \brief Create an instance of the job manager
*/
@@ -124,7 +163,7 @@
/*!
* \brief Return a pointer to a properly aligned job descriptor,
- * or zero if none are available.
+ * or throws gc_bad_alloc if there are none available.
*/
virtual gc_job_desc *alloc_job_desc() = 0;
@@ -186,7 +225,7 @@
/*!
* Return gc_proc_id_t associated with spu procedure \p proc_name if one
- * exists, otherwise return GCP_UNKNOWN_PROC.
+ * exists, otherwise throws gc_unknown_proc.
*/
virtual gc_proc_id_t lookup_proc(const std::string &proc_name) = 0;
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager_impl.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager_impl.cc
2008-04-09 21:29:37 UTC (rev 8174)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/gc_job_manager_impl.cc
2008-04-10 02:41:46 UTC (rev 8175)
@@ -418,8 +418,12 @@
gc_job_desc *
gc_job_manager_impl::alloc_job_desc()
{
- // stack is lock free, thus safe to call from any thread
- return gc_jd_stack_pop(d_free_list);
+ // stack is lock free, and safe to call from any thread
+ gc_job_desc *jd = gc_jd_stack_pop(d_free_list);
+ if (jd == 0)
+ throw gc_bad_alloc("alloc_job_desc: none available");
+
+ return jd;
}
void
@@ -1233,7 +1237,7 @@
if (proc_name == d_proc_def[i].name)
return i;
- return GCP_UNKNOWN_PROC;
+ throw gc_unknown_proc(proc_name);
}
std::vector<std::string>
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_job_manager.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_job_manager.cc
2008-04-09 21:29:37 UTC (rev 8174)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/runtime/qa_job_manager.cc
2008-04-10 02:41:46 UTC (rev 8175)
@@ -229,8 +229,8 @@
gc_job_desc *jds[NJOBS];
bool done[NJOBS];
- gc_proc_id_t gcp_no_such = mgr->lookup_proc("--no-such-proc-name--");
- CPPUNIT_ASSERT_EQUAL(GCP_UNKNOWN_PROC, gcp_no_such);
+ gc_proc_id_t gcp_no_such;
+ CPPUNIT_ASSERT_THROW(gcp_no_such =
mgr->lookup_proc("--no-such-proc-name--"), gc_unknown_proc);
gc_proc_id_t gcp_qa_nop = mgr->lookup_proc("qa_nop");
CPPUNIT_ASSERT(gcp_qa_nop != GCP_UNKNOWN_PROC);
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/spu/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/spu/Makefile.am
2008-04-09 21:29:37 UTC (rev 8174)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib/spu/Makefile.am
2008-04-10 02:41:46 UTC (rev 8175)
@@ -57,11 +57,15 @@
general_srcdir = $(srcdir)/../general/spu
-general_spu_sources =
+general_spu_sources = \
+ $(general_srcdir)/fft_1d_r2.c
-general_spu_headers =
+general_spu_headers = \
+ $(general_srcdir)/libfft.h
-general_spu_noinst_headers =
+general_spu_noinst_headers = \
+ $(general_srcdir)/fft_1d.h \
+ $(general_srcdir)/fft_1d_r2.h
# ----------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8175 - in gnuradio/branches/developers/eb/gcell-wip/gcell/src/lib: . general general/spu procs procs/spu runtime spu,
eb <=