summaryrefslogtreecommitdiff
path: root/gr-fft
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2013-11-18 19:31:01 -0500
committerTom Rondeau <tom@trondeau.com>2013-11-18 20:20:11 -0500
commit9c154aa9eaf3715ac8d06e56ad725e5be3ff6002 (patch)
treecd95257781c05ba62a118ca552fa07275b92faa1 /gr-fft
parent061bb4e56df7fcb093bb1fb0a48e3396f5b0d19e (diff)
fft: optimization; bug fixes for kaiser window and added windows to win_type.
filter: fixed width_factor to include new window types and add protection around array.
Diffstat (limited to 'gr-fft')
-rw-r--r--gr-fft/lib/window.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/gr-fft/lib/window.cc b/gr-fft/lib/window.cc
index 5a28b3239d..1610b46f5d 100644
--- a/gr-fft/lib/window.cc
+++ b/gr-fft/lib/window.cc
@@ -81,7 +81,7 @@ namespace gr {
float M = static_cast<float>(ntaps - 1);
for(int n = 0; n < ntaps; n++)
- taps[n] = c0 - c1*cos((2*M_PI*n)/M) + c2*cos((4*M_PI*n)/M);
+ taps[n] = c0 - c1*cosf((2.0f*M_PI*n)/M) + c2*cosf((4.0f*M_PI*n)/M);
return taps;
}
@@ -92,7 +92,8 @@ namespace gr {
float M = static_cast<float>(ntaps - 1);
for(int n = 0; n < ntaps; n++)
- taps[n] = c0 - c1*cos((2*M_PI*n)/M) + c2*cos((4*M_PI*n)/M) - c3*cos((6*M_PI*n)/M);
+ taps[n] = c0 - c1*cosf((2.0f*M_PI*n)/M) + c2*cosf((4.0f*M_PI*n)/M) \
+ - c3*cosf((6.0f*M_PI*n)/M);
return taps;
}
@@ -103,7 +104,8 @@ namespace gr {
float M = static_cast<float>(ntaps - 1);
for(int n = 0; n < ntaps; n++)
- taps[n] = c0 - c1*cos((2*M_PI*n)/M) + c2*cos((4*M_PI*n)/M) - c3*cos((6*M_PI*n)/M) + c4*cos((8*M_PI*n)/M);
+ taps[n] = c0 - c1*cosf((2.0f*M_PI*n)/M) + c2*cosf((4.0f*M_PI*n)/M) \
+ - c3*cosf((6.0f*M_PI*n)/M) + c4*cosf((8.0f*M_PI*n)/M);
return taps;
}
@@ -224,7 +226,7 @@ namespace gr {
double inm1 = 1.0/((double)(ntaps-1));
double temp;
- for(int i = 0; i <= ntaps; i++) {
+ for(int i = 0; i < ntaps; i++) {
temp = 2*i*inm1 - 1;
taps[i] = Izero(beta*sqrt(1.0-temp*temp)) * IBeta;
}