00001
00002
00003
00004
00005
00006
00007 #ifndef __WVFFT_H
00008 #define __WVFFT_H
00009
00010 #include "wvtypedencoder.h"
00011 #include "wvbuf.h"
00012
00013 struct fftw_plan_struct;
00014
00040 class WvRealToComplexFFTEncoder :
00041 public WvTypedEncoder<double, double>
00042 {
00043 public:
00044 enum WindowFunction {
00045 WND_NONE,
00046 WND_BOXCAR
00049 };
00050
00057 WvRealToComplexFFTEncoder(size_t n,
00058 WindowFunction wnd = WND_NONE);
00059 virtual ~WvRealToComplexFFTEncoder();
00060
00061 protected:
00063 virtual bool _typedencode(IBuffer &inbuf, OBuffer &outbuf, bool flush);
00064 virtual bool _reset();
00065
00066 private:
00067 struct fftw_plan_struct *plan;
00068 size_t n;
00069 WindowFunction wnd;
00070 };
00071
00072
00088 class WvComplexToRealFFTEncoder :
00089 public WvTypedEncoder<double, double>
00090 {
00091 struct fftw_plan_struct *plan;
00092 size_t n;
00093 WvInPlaceBufBase<double> tmpbuf;
00094
00095 public:
00101 WvComplexToRealFFTEncoder(size_t n);
00102 virtual ~WvComplexToRealFFTEncoder();
00103
00104 protected:
00106 virtual bool _typedencode(IBuffer &inbuf, OBuffer &outbuf, bool flush);
00107 virtual bool _reset();
00108 };
00109
00110
00133 class WvPowerSpectrumEncoder :
00134 public WvTypedEncoder<double, double>
00135 {
00136 size_t n, half, mid;
00137
00138 public:
00144 WvPowerSpectrumEncoder(size_t n);
00145
00146 protected:
00148 virtual bool _typedencode(IBuffer &inbuf, OBuffer &outbuf, bool flush);
00149 virtual bool _reset();
00150 };
00151
00152 #endif // __WVFFT_H