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

Side by Side Diff: webrtc/modules/audio_processing/vad/voice_activity_detector.cc

Issue 1224693013: Use Resampler default constructor in VAD (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 10 matching lines...) Expand all
21 const int kNumChannels = 1; 21 const int kNumChannels = 1;
22 22
23 const double kDefaultVoiceValue = 1.0; 23 const double kDefaultVoiceValue = 1.0;
24 const double kNeutralProbability = 0.5; 24 const double kNeutralProbability = 0.5;
25 const double kLowProbability = 0.01; 25 const double kLowProbability = 0.01;
26 26
27 } // namespace 27 } // namespace
28 28
29 VoiceActivityDetector::VoiceActivityDetector() 29 VoiceActivityDetector::VoiceActivityDetector()
30 : last_voice_probability_(kDefaultVoiceValue), 30 : last_voice_probability_(kDefaultVoiceValue),
31 // Initialize to the most common resampling situation.
32 resampler_(kMaxLength, kLength10Ms, kNumChannels),
33 standalone_vad_(StandaloneVad::Create()) { 31 standalone_vad_(StandaloneVad::Create()) {
34 } 32 }
35 33
36 // Because ISAC has a different chunk length, it updates 34 // Because ISAC has a different chunk length, it updates
37 // |chunkwise_voice_probabilities_| and |chunkwise_rms_| when there is new data. 35 // |chunkwise_voice_probabilities_| and |chunkwise_rms_| when there is new data.
38 // Otherwise it clears them. 36 // Otherwise it clears them.
39 void VoiceActivityDetector::ProcessChunk(const int16_t* audio, 37 void VoiceActivityDetector::ProcessChunk(const int16_t* audio,
40 int length, 38 int length,
41 int sample_rate_hz) { 39 int sample_rate_hz) {
42 DCHECK_EQ(length, sample_rate_hz / 100); 40 DCHECK_EQ(length, sample_rate_hz / 100);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 0); 76 0);
79 CHECK_GE(pitch_based_vad_.VoicingProbability( 77 CHECK_GE(pitch_based_vad_.VoicingProbability(
80 features_, &chunkwise_voice_probabilities_[0]), 78 features_, &chunkwise_voice_probabilities_[0]),
81 0); 79 0);
82 } 80 }
83 last_voice_probability_ = chunkwise_voice_probabilities_.back(); 81 last_voice_probability_ = chunkwise_voice_probabilities_.back();
84 } 82 }
85 } 83 }
86 84
87 } // namespace webrtc 85 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698