Mercurial > hg > aim92
diff tools/sigproc.h @ 0:5242703e91d3 tip
Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author | tomwalters |
---|---|
date | Fri, 20 May 2011 15:19:45 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/sigproc.h Fri May 20 15:19:45 2011 +0100 @@ -0,0 +1,45 @@ + +#define PI 3.14159265 +#define TWOPI 6.2831853 + +#define MAXSHORT 32767. +#define MINSHORT ( -32767. ) + +#define log2(x) (log((double)x)/log(2.0)) + +typedef struct { + float real; + float imag; +} complex; + +#define sq(x) ((x)*(x)) +#define Re(C) (C)->real /* cartesian form */ +#define Im(C) (C)->imag + + +/* + V is m floats interpreted as m/2 complex numbers: (real,imag). + mag: overwrite first m/2 floats with mod of m/2 complex numbers. + phase: overwrite first m/2 floats with arg of m/2 complex numbers. + fft: overwrite m floats with m/2 complex numbers (Fourier spectrum). +*/ + +#define mag(V,m) Mod( (complex *)V, m>>1 ) +#define phase(V,m) Arg( (complex *)V, m>>1 ) +#define fft(V,m,i) realft( (float *)(V)-1, m>>1, i ) + + +float mod(); +float arg(); + + +int ispower(); +int getpower(); + +float ftos() ; + +float *raised_cosine() ; +float *hamming() ; +float *gauss_window() ; + +short *getframe() ;