3 * Copyright 2003,2008 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
26 * Wrappers for FFTW single precision 1d dft
29 #include <gr_complex.h>
30 #include <boost/thread.hpp>
33 * \brief Export reference to planner mutex for those apps that
34 * want to use FFTW w/o using the gri_fftw* classes.
36 class gri_fft_planner {
38 typedef boost::mutex::scoped_lock scoped_lock;
40 * Return reference to planner mutex
42 static boost::mutex &mutex();
46 * \brief FFT: complex in, complex out
49 class gri_fft_complex {
56 gri_fft_complex (int fft_size, bool forward = true);
57 virtual ~gri_fft_complex ();
60 * These return pointers to buffers owned by gri_fft_complex into which
61 * input and output take place. It's done this way in order to
62 * ensure optimal alignment for SIMD instructions.
64 gr_complex *get_inbuf () const { return d_inbuf; }
65 gr_complex *get_outbuf () const { return d_outbuf; }
67 int inbuf_length () const { return d_fft_size; }
68 int outbuf_length () const { return d_fft_size; }
71 * compute FFT. The input comes from inbuf, the output is placed in outbuf.
77 * \brief FFT: real in, complex out
80 class gri_fft_real_fwd {
87 gri_fft_real_fwd (int fft_size);
88 virtual ~gri_fft_real_fwd ();
91 * These return pointers to buffers owned by gri_fft_real_fwd into
92 * which input and output take place. It's done this way in order
93 * to ensure optimal alignment for SIMD instructions.
95 float *get_inbuf () const { return d_inbuf; }
96 gr_complex *get_outbuf () const { return d_outbuf; }
98 int inbuf_length () const { return d_fft_size; }
99 int outbuf_length () const { return d_fft_size / 2 + 1; }
102 * compute FFT. The input comes from inbuf, the output is placed in outbuf.
108 * \brief FFT: complex in, float out
111 class gri_fft_real_rev {
118 gri_fft_real_rev (int fft_size);
119 virtual ~gri_fft_real_rev ();
122 * These return pointers to buffers owned by gri_fft_real_rev into
123 * which input and output take place. It's done this way in order
124 * to ensure optimal alignment for SIMD instructions.
126 gr_complex *get_inbuf () const { return d_inbuf; }
127 float *get_outbuf () const { return d_outbuf; }
129 int inbuf_length () const { return d_fft_size / 2 + 1; }
130 int outbuf_length () const { return d_fft_size; }
133 * compute FFT. The input comes from inbuf, the output is placed in outbuf.