From 907005f7523f463a4710ffb0c28d342c0df0d6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 2 Mar 2015 23:42:03 +0100 Subject: [PATCH] fix whitespace --- fft-org.c | 36 ++++++++++++++++-------------------- fft-org.h | 2 -- fft.c | 4 ---- fft.h | 2 -- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/fft-org.c b/fft-org.c index fd706e5..544dcb9 100644 --- a/fft-org.c +++ b/fft-org.c @@ -3,16 +3,16 @@ fix_fft() perform FFT or inverse FFT fix_mpy() perform fixed-point multiplication. Sinewave[1024] sinewave normalized to 32767 (= 1.0). - + All data are fixed-point short integers, in which -32768 to +32768 represent -1.0 to +1.0. Integer arithmetic is used for speed, instead of the more natural floating-point. - + For the forward FFT (time -> freq), fixed scaling is performed to prevent arithmetic overflow, and to map a 0dB sine/cosine wave (i.e. amplitude = 32767) to two -6dB freq coefficients; the one in the lower half is reported as 0dB. - + For the inverse FFT (freq -> time), fixed scaling cannot be done, as two 0dB coefficients would sum to a peak amplitude of 64K, overflowing the 32k range of the fixed-point integers. @@ -44,11 +44,11 @@ int fix_fft_org(fixed fr[], fixed fi[], int m, int inverse) { int mr,nn,i,j,l,k,istep, n, scale, shift; - + fixed qr,qi; //even input fixed tr,ti; //odd input fixed wr,wi; //twiddle factor - + //number of input data n = 1< 16383 || m > 16383) { shift = 1; @@ -109,7 +109,7 @@ int fix_fft_org(fixed fr[], fixed fi[], int m, int inverse) distributed to maximize arithmetic accuracy. */ shift = 1; } - + /* it may not be obvious, but the shift will be performed on each data point exactly once, during this pass. */ istep = l << 1; //step width of current butterfly @@ -119,7 +119,7 @@ int fix_fft_org(fixed fr[], fixed fi[], int m, int inverse) /* 0 <= j < N_WAVE/2 */ wr = Sinewave[j+N_WAVE/4]; wi = -Sinewave[j]; - + if(inverse) wi = -wi; if(shift) { @@ -128,20 +128,20 @@ int fix_fft_org(fixed fr[], fixed fi[], int m, int inverse) } for(i=m; i>= 1; qi >>= 1; } - + fr[j] = qr - tr; fi[j] = qi - ti; fr[i] = qr + tr; @@ -300,7 +300,3 @@ fixed Sinewave_org[1024] = { -3211, -3011, -2811, -2610, -2410, -2209, -2009, -1808, -1607, -1406, -1206, -1005, -804, -603, -402, -201, }; - - - - diff --git a/fft-org.h b/fft-org.h index 215f3fb..b93e0da 100644 --- a/fft-org.h +++ b/fft-org.h @@ -1,4 +1,3 @@ - #ifndef FFT_H #define FFT_H @@ -22,5 +21,4 @@ extern fixed Sinewave_org[N_WAVE]; fixed fix_mpy_org(fixed a, fixed b); int fix_fft_org(fixed *fr, fixed *fi, int m, int inverse); - #endif //FFT_H diff --git a/fft.c b/fft.c index 9732d27..a919fce 100644 --- a/fft.c +++ b/fft.c @@ -300,7 +300,3 @@ fixed Sinewave[1024] = { -3211, -3011, -2811, -2610, -2410, -2209, -2009, -1808, -1607, -1406, -1206, -1005, -804, -603, -402, -201, }; - - - - diff --git a/fft.h b/fft.h index 5427451..e36a2f9 100644 --- a/fft.h +++ b/fft.h @@ -1,4 +1,3 @@ - #ifndef FFT_H #define FFT_H @@ -22,5 +21,4 @@ extern fixed Sinewave[N_WAVE]; fixed fix_mpy(fixed a, fixed b); int fix_fft(fixed *fr, fixed *fi, int m, int inverse); - #endif //FFT_H