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

Unified Diff: webrtc/modules/audio_processing/vad/gmm.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/gmm.cc
diff --git a/webrtc/modules/audio_processing/agc/gmm.cc b/webrtc/modules/audio_processing/vad/gmm.cc
similarity index 81%
rename from webrtc/modules/audio_processing/agc/gmm.cc
rename to webrtc/modules/audio_processing/vad/gmm.cc
index 9ad8ef95aee23baac501f1d8e9ca3e5e77fd6dd4..96519759133197209f20727433daf122dce6cb31 100644
--- a/webrtc/modules/audio_processing/agc/gmm.cc
+++ b/webrtc/modules/audio_processing/vad/gmm.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/modules/audio_processing/agc/gmm.h"
+#include "webrtc/modules/audio_processing/vad/gmm.h"
#include <math.h>
#include <stdlib.h>
@@ -19,13 +19,16 @@ namespace webrtc {
static const int kMaxDimension = 10;
-static void RemoveMean(const double* in, const double* mean_vec,
- int dimension, double* out) {
+static void RemoveMean(const double* in,
+ const double* mean_vec,
+ int dimension,
+ double* out) {
for (int n = 0; n < dimension; ++n)
out[n] = in[n] - mean_vec[n];
}
-static double ComputeExponent(const double* in, const double* covar_inv,
+static double ComputeExponent(const double* in,
+ const double* covar_inv,
int dimension) {
double q = 0;
for (int i = 0; i < dimension; ++i) {
@@ -50,7 +53,7 @@ double EvaluateGmm(const double* x, const GmmParameters& gmm_parameters) {
for (int n = 0; n < gmm_parameters.num_mixtures; n++) {
RemoveMean(x, mean_vec, gmm_parameters.dimension, v);
double q = ComputeExponent(v, covar_inv, gmm_parameters.dimension) +
- gmm_parameters.weight[n];
+ gmm_parameters.weight[n];
f += exp(q);
mean_vec += gmm_parameters.dimension;
covar_inv += gmm_parameters.dimension * gmm_parameters.dimension;

Powered by Google App Engine
This is Rietveld 408576698