]> git.piffa.net Git - arduino/blob - books/ArduinoNextSteps-master/ArduinoNextSteps/sketch_13_06_FFT_Spectrum/fix_fft.h
first commit
[arduino] / books / ArduinoNextSteps-master / ArduinoNextSteps / sketch_13_06_FFT_Spectrum / fix_fft.h
1 #ifndef FIXFFT_H\r
2 #define FIXFFT_H\r
3 \r
4 #include <WProgram.h>\r
5 \r
6 \r
7 \r
8 \r
9 /*\r
10   fix_fft() - perform forward/inverse fast Fourier transform.\r
11   fr[n],fi[n] are real and imaginary arrays, both INPUT AND\r
12   RESULT (in-place FFT), with 0 <= n < 2**m; set inverse to\r
13   0 for forward transform (FFT), or 1 for iFFT.\r
14 */\r
15 int fix_fft(char fr[], char fi[], int m, int inverse);\r
16 \r
17 \r
18 \r
19 /*\r
20   fix_fftr() - forward/inverse FFT on array of real numbers.\r
21   Real FFT/iFFT using half-size complex FFT by distributing\r
22   even/odd samples into real/imaginary arrays respectively.\r
23   In order to save data space (i.e. to avoid two arrays, one\r
24   for real, one for imaginary samples), we proceed in the\r
25   following two steps: a) samples are rearranged in the real\r
26   array so that all even samples are in places 0-(N/2-1) and\r
27   all imaginary samples in places (N/2)-(N-1), and b) fix_fft\r
28   is called with fr and fi pointing to index 0 and index N/2\r
29   respectively in the original array. The above guarantees\r
30   that fix_fft "sees" consecutive real samples as alternating\r
31   real and imaginary samples in the complex array.\r
32 */\r
33 int fix_fftr(char f[], int m, int inverse);\r
34 \r
35 \r
36 \r
37 \r
38 #endif \r
39 \r
40 \r
41 \r