00001 00011 #ifndef __QFFT_HH_ 00012 #define __QFFT_HH_ 00013 00014 #include "QVector.hh" 00015 00016 #include <gsl/gsl_fft_halfcomplex.h> 00017 #include <gsl/gsl_fft_complex.h> 00018 #include <gsl/gsl_errno.h> 00019 #include <string> 00020 #include <gsl/gsl_sf.h> 00021 00022 Q_BEGIN_NAMESPACE 00023 00024 class QFFT { 00025 00026 public: 00028 enum WindowType { 00029 WT_None = 0, 00030 WT_Welch = 1, 00031 WT_Rect = 2, 00032 WT_Hann = 3, 00033 WT_Hamming = 4, 00034 WT_Cosinus = 5, 00035 WT_BlackmanHarris = 6, 00036 WT_Kaiser3 = 7, 00037 }; 00038 00040 static QVector FFTAntiSym(const QVector& input); 00042 static QVector FFTSym(const QVector& input); 00044 static QVector ZeroPad(const QVector& input,size_t n_zeros, bool isSym = false, double zeroVal = 0.); 00046 static WindowType StrToWindowType(const std::string& winName); 00048 static QVector GetWindow(WindowType wt, size_t size, size_t zeros = 0,bool coherent = false); 00050 static QVector CutSides(const QVector& input, size_t ncut, bool isSym); 00051 00056 QFFT( const int size); 00060 QFFT(); 00064 virtual ~QFFT(); 00070 virtual int Transform(const QVector& data, QVector& result) = 0; 00075 virtual void Resize(int s) = 0; 00081 virtual void SetWindowType(WindowType wt, bool coherent = false) = 0; 00087 void SetForward(bool isForward){fForward = isForward;} 00093 void SetNormalized(bool isNormalized){fNormalized = isNormalized;} 00099 int GetWindow(){return fWindowType;} 00100 00101 protected: 00102 00103 void IsPowerOf2(); 00104 int fSize; 00105 bool fForward; 00106 bool fNormalized; 00107 bool fIsPowerOf2; 00108 double* fData; 00109 double* fWindow; 00110 int fWindowSize; 00111 WindowType fWindowType; 00112 00113 }; 00114 00115 Q_END_NAMESPACE 00116 #endif