00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2003 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00020 * Boston, MA 02111-1307, USA. 00021 */ 00022 #ifndef _GR_FFT_H_ 00023 #define _GR_FFT_H_ 00024 00025 /* 00026 * Wrappers for FFTW single precision 1d dft 00027 */ 00028 00029 #include <gr_complex.h> 00030 00035 class gr_fft_complex { 00036 int d_fft_size; 00037 gr_complex *d_inbuf; 00038 gr_complex *d_outbuf; 00039 void *d_plan; 00040 00041 public: 00042 gr_fft_complex (int fft_size, bool forward = true); 00043 virtual ~gr_fft_complex (); 00044 00045 /* 00046 * these return pointers to buffers owned by gr_fft_complex into which 00047 * input and output take place. It's done this way in order to 00048 * ensure optimal alignment for SIMD instructions. 00049 */ 00050 gr_complex *get_inbuf () const { return d_inbuf; } 00051 gr_complex *get_outbuf () const { return d_outbuf; } 00052 00053 int inbuf_length () const { return d_fft_size; } 00054 int outbuf_length () const { return d_fft_size; } 00055 00059 void execute (); 00060 }; 00061 00065 class gr_fft_real { 00066 int d_fft_size; 00067 float *d_inbuf; 00068 gr_complex *d_outbuf; 00069 void *d_plan; 00070 00071 public: 00072 gr_fft_real (int fft_size); 00073 virtual ~gr_fft_real (); 00074 00075 /* 00076 * these return pointers to buffers owned by gr_fft_real into which 00077 * input and output take place. It's done this way in order to 00078 * ensure optimal alignment for SIMD instructions. 00079 */ 00080 float *get_inbuf () const { return d_inbuf; } 00081 gr_complex *get_outbuf () const { return d_outbuf; } 00082 00083 int inbuf_length () const { return d_fft_size; } 00084 int outbuf_length () const { return d_fft_size / 2 + 1; } 00085 00089 void execute (); 00090 }; 00091 00092 #endif