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 _GRI_FFT_H_ 00023 #define _GRI_FFT_H_ 00024 00025 /* 00026 * Wrappers for FFTW single precision 1d dft 00027 */ 00028 00029 #include <gr_complex.h> 00030 00035 class gri_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 gri_fft_complex (int fft_size, bool forward = true); 00043 virtual ~gri_fft_complex (); 00044 00045 /* 00046 * These return pointers to buffers owned by gri_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 gri_fft_real_fwd { 00066 int d_fft_size; 00067 float *d_inbuf; 00068 gr_complex *d_outbuf; 00069 void *d_plan; 00070 00071 public: 00072 gri_fft_real_fwd (int fft_size); 00073 virtual ~gri_fft_real_fwd (); 00074 00075 /* 00076 * These return pointers to buffers owned by gri_fft_real_fwd into 00077 * which input and output take place. It's done this way in order 00078 * to 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 00095 class gri_fft_real_rev { 00096 int d_fft_size; 00097 gr_complex *d_inbuf; 00098 float *d_outbuf; 00099 void *d_plan; 00100 00101 public: 00102 gri_fft_real_rev (int fft_size); 00103 virtual ~gri_fft_real_rev (); 00104 00105 /* 00106 * These return pointers to buffers owned by gri_fft_real_rev into 00107 * which input and output take place. It's done this way in order 00108 * to ensure optimal alignment for SIMD instructions. 00109 */ 00110 gr_complex *get_inbuf () const { return d_inbuf; } 00111 float *get_outbuf () const { return d_outbuf; } 00112 00113 int inbuf_length () const { return d_fft_size / 2 + 1; } 00114 int outbuf_length () const { return d_fft_size; } 00115 00119 void execute (); 00120 }; 00121 00122 #endif