00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __UT_FFT__
00025 #define __UT_FFT__
00026
00027 #include "UT_API.h"
00028 #include <SYS/SYS_Types.h>
00029
00030 class UT_API UT_FFT
00031 {
00032 public:
00033 explicit UT_FFT(exint npnts);
00034 ~UT_FFT();
00035
00036
00037 void toFrequency(float *source,float *destr,float *desti,exint npnts);
00038 void toFrequency(float *sourcer, float *sourcei,float *destr,float *desti,exint npnts);
00039 void toTime(float *sourcer,float *sourcei,float *dest,exint npnts);
00040
00041 void toTime(float *sourcer,float *sourcei,float *destr,float *desti,exint npnts);
00042
00043
00044 static void toFrequency2D(float *sourcer, float *sourcei, float *destr,float *desti,exint size);
00045 static void toTime2D(float *sourcer, float *sourcei, float *destr,float *desti,exint size);
00046
00047 private:
00048
00049 int for_fft(float *yre, float *yim,float *zre,float *zim,exint npts);
00050 int inv_fft(float *yre, float *yim,float *zre,float *zim,exint npts);
00051
00052 void dofft(int agamma);
00053
00054 void fftcopy(float *pr_from, float *pi_from,float *p_to,
00055 exint npts,int is_plus);
00056
00057 void ifftcopy(float *p_from, float *pr_to,float *pi_to,
00058 int agamma,fpreal factr,fpreal facti);
00059 void fftfill(float *p_co,exint part,exint all);
00060
00061 void make_w(int neww);
00062 void butterfly(int fly,int agamma);
00063
00064 static void init_bitsw();
00065 static int slow_bitsw(int k,int n);
00066 static exint bitswitch(exint k, exint n);
00067
00068 float *x_co;
00069 float *w_co;
00070
00071 static unsigned char tbl[256];
00072 int gamma;
00073 exint fft_size;
00074
00075 };
00076
00077 #endif