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

Unified Diff: webrtc/modules/audio_processing/vad/pitch_based_vad.cc

Issue 1212543002: Pull the Voice Activity Detector out from the AGC (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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
Index: webrtc/modules/audio_processing/vad/pitch_based_vad.cc
diff --git a/webrtc/modules/audio_processing/agc/pitch_based_vad.cc b/webrtc/modules/audio_processing/vad/pitch_based_vad.cc
similarity index 87%
rename from webrtc/modules/audio_processing/agc/pitch_based_vad.cc
rename to webrtc/modules/audio_processing/vad/pitch_based_vad.cc
index 0cfa52a0108afb0b255a4c10d519467dda0085c3..91638d007edc0607a97469f196ba77975bd05e89 100644
--- a/webrtc/modules/audio_processing/agc/pitch_based_vad.cc
+++ b/webrtc/modules/audio_processing/vad/pitch_based_vad.cc
@@ -8,16 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/modules/audio_processing/agc/pitch_based_vad.h"
+#include "webrtc/modules/audio_processing/vad/pitch_based_vad.h"
#include <assert.h>
#include <math.h>
#include <string.h>
-#include "webrtc/modules/audio_processing/agc/circular_buffer.h"
-#include "webrtc/modules/audio_processing/agc/common.h"
-#include "webrtc/modules/audio_processing/agc/noise_gmm_tables.h"
-#include "webrtc/modules/audio_processing/agc/voice_gmm_tables.h"
+#include "webrtc/modules/audio_processing/vad/vad_circular_buffer.h"
+#include "webrtc/modules/audio_processing/vad/common.h"
+#include "webrtc/modules/audio_processing/vad/noise_gmm_tables.h"
+#include "webrtc/modules/audio_processing/vad/voice_gmm_tables.h"
#include "webrtc/modules/interface/module_common_types.h"
namespace webrtc {
@@ -44,7 +44,7 @@ static double LimitProbability(double p) {
PitchBasedVad::PitchBasedVad()
: p_prior_(kInitialPriorProbability),
- circular_buffer_(AgcCircularBuffer::Create(kPosteriorHistorySize)) {
+ circular_buffer_(VadCircularBuffer::Create(kPosteriorHistorySize)) {
// Setup noise GMM.
noise_gmm_.dimension = kNoiseGmmDim;
noise_gmm_.num_mixtures = kNoiseGmmNumMixtures;
@@ -60,7 +60,8 @@ PitchBasedVad::PitchBasedVad()
voice_gmm_.covar_inverse = &kVoiceGmmCovarInverse[0][0][0];
}
-PitchBasedVad::~PitchBasedVad() {}
+PitchBasedVad::~PitchBasedVad() {
+}
int PitchBasedVad::VoicingProbability(const AudioFeatures& features,
double* p_combined) {
@@ -90,8 +91,9 @@ int PitchBasedVad::VoicingProbability(const AudioFeatures& features,
pdf_features_given_noise = kEps * pdf_features_given_voice;
}
- p = p_prior_ * pdf_features_given_voice / (pdf_features_given_voice *
- p_prior_ + pdf_features_given_noise * (1 - p_prior_));
+ p = p_prior_ * pdf_features_given_voice /
+ (pdf_features_given_voice * p_prior_ +
+ pdf_features_given_noise * (1 - p_prior_));
p = LimitProbability(p);

Powered by Google App Engine
This is Rietveld 408576698