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

Unified Diff: webrtc/tools/agc/activity_metric.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/test/fake_audio_device.cc ('k') | webrtc/tools/agc/agc_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/tools/agc/activity_metric.cc
diff --git a/webrtc/tools/agc/activity_metric.cc b/webrtc/tools/agc/activity_metric.cc
index fb50daf2baff1120dfcbcb362f5fcbcf8f96b2d4..18e7c6dad80956b61b5795428c7ddedf0199488d 100644
--- a/webrtc/tools/agc/activity_metric.cc
+++ b/webrtc/tools/agc/activity_metric.cc
@@ -61,10 +61,10 @@ static void DitherSilence(AudioFrame* frame) {
const double sum_squared_silence = kRmsSilence * kRmsSilence *
frame->samples_per_channel_;
double sum_squared = 0;
- for (int n = 0; n < frame->samples_per_channel_; n++)
+ for (size_t n = 0; n < frame->samples_per_channel_; n++)
sum_squared += frame->data_[n] * frame->data_[n];
if (sum_squared <= sum_squared_silence) {
- for (int n = 0; n < frame->samples_per_channel_; n++)
+ for (size_t n = 0; n < frame->samples_per_channel_; n++)
frame->data_[n] = (rand() & 0xF) - 8;
}
}
@@ -79,7 +79,7 @@ class AgcStat {
vad_(new PitchBasedVad()),
standalone_vad_(StandaloneVad::Create()),
audio_content_fid_(NULL) {
- for (int n = 0; n < kMaxNumFrames; n++)
+ for (size_t n = 0; n < kMaxNumFrames; n++)
video_vad_[n] = 0.5;
}
@@ -116,7 +116,7 @@ class AgcStat {
// TODO(turajs) combining and limiting are used in the source files as
// well they can be moved to utility.
// Combine Video and stand-alone VAD.
- for (int n = 0; n < features.num_frames; n++) {
+ for (size_t n = 0; n < features.num_frames; n++) {
double p_active = p[n] * video_vad_[n];
double p_passive = (1 - p[n]) * (1 - video_vad_[n]);
p[n] = p_active / (p_active + p_passive);
@@ -125,7 +125,7 @@ class AgcStat {
}
if (vad_->VoicingProbability(features, p) < 0)
return -1;
- for (int n = 0; n < features.num_frames; n++) {
+ for (size_t n = 0; n < features.num_frames; n++) {
audio_content_->Update(features.rms[n], p[n]);
double ac = audio_content_->AudioContent();
if (audio_content_fid_ != NULL) {
@@ -139,7 +139,7 @@ class AgcStat {
}
video_index_ = 0;
}
- return features.num_frames;
+ return static_cast<int>(features.num_frames);
}
void Reset() {
@@ -246,7 +246,7 @@ void void_main(int argc, char* argv[]) {
bool onset = false;
uint8_t previous_true_vad = 0;
int num_not_adapted = 0;
- int true_vad_index = 0;
+ size_t true_vad_index = 0;
bool in_false_positive_region = false;
int total_false_positive_duration = 0;
bool video_adapted = false;
@@ -292,7 +292,7 @@ void void_main(int argc, char* argv[]) {
ASSERT_GE(ret_val, 0);
if (ret_val > 0) {
- ASSERT_EQ(true_vad_index, ret_val);
+ ASSERT_EQ(true_vad_index, static_cast<size_t>(ret_val));
for (int n = 0; n < ret_val; n++) {
if (true_vad[n] == 1) {
total_active++;
« no previous file with comments | « webrtc/test/fake_audio_device.cc ('k') | webrtc/tools/agc/agc_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698