Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: webrtc/common_audio/window_generator.cc

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/common_audio/window_generator.h ('k') | webrtc/common_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_audio/window_generator.cc
diff --git a/webrtc/common_audio/window_generator.cc b/webrtc/common_audio/window_generator.cc
index 1d61368c196d581d59c22f86f7e2e88a7b069dd3..ae6cbc9d849d49dfcf2c1965f6785be2ec1a7c8d 100644
--- a/webrtc/common_audio/window_generator.cc
+++ b/webrtc/common_audio/window_generator.cc
@@ -46,20 +46,20 @@ void WindowGenerator::Hanning(int length, float* window) {
}
}
-void WindowGenerator::KaiserBesselDerived(float alpha, int length,
+void WindowGenerator::KaiserBesselDerived(float alpha, size_t length,
float* window) {
- CHECK_GT(length, 1);
+ CHECK_GT(length, 1U);
CHECK(window != nullptr);
- const int half = (length + 1) / 2;
+ const size_t half = (length + 1) / 2;
float sum = 0.0f;
- for (int i = 0; i <= half; ++i) {
+ for (size_t i = 0; i <= half; ++i) {
complex<float> r = (4.0f * i) / length - 1.0f;
sum += I0(static_cast<float>(M_PI) * alpha * sqrt(1.0f - r * r)).real();
window[i] = sum;
}
- for (int i = length - 1; i >= half; --i) {
+ for (size_t i = length - 1; i >= half; --i) {
window[length - i - 1] = sqrtf(window[length - i - 1] / sum);
window[i] = window[length - i - 1];
}
« no previous file with comments | « webrtc/common_audio/window_generator.h ('k') | webrtc/common_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698