tomwalters@0: tomwalters@0: #define PI 3.14159265 tomwalters@0: #define TWOPI 6.2831853 tomwalters@0: tomwalters@0: #define MAXSHORT 32767. tomwalters@0: #define MINSHORT ( -32767. ) tomwalters@0: tomwalters@0: #define log2(x) (log((double)x)/log(2.0)) tomwalters@0: tomwalters@0: typedef struct { tomwalters@0: float real; tomwalters@0: float imag; tomwalters@0: } complex; tomwalters@0: tomwalters@0: #define sq(x) ((x)*(x)) tomwalters@0: #define Re(C) (C)->real /* cartesian form */ tomwalters@0: #define Im(C) (C)->imag tomwalters@0: tomwalters@0: tomwalters@0: /* tomwalters@0: V is m floats interpreted as m/2 complex numbers: (real,imag). tomwalters@0: mag: overwrite first m/2 floats with mod of m/2 complex numbers. tomwalters@0: phase: overwrite first m/2 floats with arg of m/2 complex numbers. tomwalters@0: fft: overwrite m floats with m/2 complex numbers (Fourier spectrum). tomwalters@0: */ tomwalters@0: tomwalters@0: #define mag(V,m) Mod( (complex *)V, m>>1 ) tomwalters@0: #define phase(V,m) Arg( (complex *)V, m>>1 ) tomwalters@0: #define fft(V,m,i) realft( (float *)(V)-1, m>>1, i ) tomwalters@0: tomwalters@0: tomwalters@0: float mod(); tomwalters@0: float arg(); tomwalters@0: tomwalters@0: tomwalters@0: int ispower(); tomwalters@0: int getpower(); tomwalters@0: tomwalters@0: float ftos() ; tomwalters@0: tomwalters@0: float *raised_cosine() ; tomwalters@0: float *hamming() ; tomwalters@0: float *gauss_window() ; tomwalters@0: tomwalters@0: short *getframe() ;