Mercurial > hg > libxtract
diff src/window.c @ 150:9283aaf1ffb8
implemented optimised FFT via the Accelerate framework. closes #5
author | Jamie Bullock <jamie@jamiebullock.com> |
---|---|
date | Wed, 09 Jan 2013 23:09:34 +0000 |
parents | baaa9d8b4d10 |
children | 826eb46b2f91 |
line wrap: on
line diff
--- a/src/window.c Wed Jan 09 20:15:50 2013 +0000 +++ b/src/window.c Wed Jan 09 23:09:34 2013 +0000 @@ -56,7 +56,7 @@ const double M = N - 1; for (n = 0; n < N; n++) - window[n] = 0.53836 - (0.46164 * cos(2.0 * PI * (double)n / M)); + window[n] = 0.53836 - (0.46164 * cos(2.0 * M_PI * (double)n / M)); } @@ -67,7 +67,7 @@ const double M = N - 1; for (n = 0; n < N; n++) - window[n] = 0.5 * (1.0 - cos(2.0 * PI * (double)n / M)); + window[n] = 0.5 * (1.0 - cos(2.0 * M_PI * (double)n / M)); } @@ -107,7 +107,7 @@ { term1 = a1 * fabs(n / M - 0.5); - term2 = a2 * cos(2.0 * PI * (double)n / M); + term2 = a2 * cos(2.0 * M_PI * (double)n / M); window[n] = a0 - term1 - term2; } @@ -127,8 +127,8 @@ for (n = 0; n < N; n++) { - term1 = a1 * cos(2.0 * PI * (double)n / M); - term2 = a2 * cos(4.0 * PI * (double)n / M); + term1 = a1 * cos(2.0 * M_PI * (double)n / M); + term2 = a2 * cos(4.0 * M_PI * (double)n / M); window[n] = a0 - term1 + term2; } @@ -193,9 +193,9 @@ for (n = 0; n < N; n++) { - term1 = a1 * cos(2.0 * PI * n / M); - term2 = a2 * cos(4.0 * PI * n / M); - term3 = a3 * cos(6.0 * PI * n / M); + term1 = a1 * cos(2.0 * M_PI * n / M); + term2 = a2 * cos(4.0 * M_PI * n / M); + term3 = a3 * cos(6.0 * M_PI * n / M); window[n] = a0 - term1 + term2 - term3; }