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

Unified Diff: webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc

Issue 1207353002: Add new variance update option and unittests for intelligibility (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Renamed tests + minor changes 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/intelligibility/intelligibility_enhancer.cc
diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
index 3029e21619a981917f377afb78075bfd66def952..3e5063bbf82287c10a6c4b8848fa5171d992b474 100644
--- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
+++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc
@@ -42,6 +42,9 @@ const float IntelligibilityEnhancer::kClipFreq = 200.0f;
const float IntelligibilityEnhancer::kConfigRho = 0.02f;
const float IntelligibilityEnhancer::kKbdAlpha = 1.5f;
hlundin-webrtc 2015/06/30 14:00:52 Delete empty line.
ekm 2015/07/01 23:48:25 Done.
+const float IntelligibilityEnhancer::kLambdaBot = -1.0;
hlundin-webrtc 2015/06/30 14:00:52 Are all of these constants only used locally in th
ekm 2015/07/01 23:48:25 Done.
+const float IntelligibilityEnhancer::kLambdaTop = -10e-18f;
+
// To disable gain update smoothing, set gain limit to be VERY high.
// TODO(ekmeyerson): Add option to disable gain smoothing altogether
// to avoid the extra computation.
@@ -239,18 +242,25 @@ void IntelligibilityEnhancer::AnalyzeClearBlock(float power_target) {
FilterVariance(clear_variance_.variance(), filtered_clear_var_.get());
FilterVariance(noise_variance_.variance(), filtered_noise_var_.get());
- // Bisection search for optimal |lambda|
-
- float lambda_bot = -1.0f, lambda_top = -10e-18f, lambda;
- float power_bot, power_top, power;
- SolveForGainsGivenLambda(lambda_top, start_freq_, gains_eq_.get());
+ float power_bot, power_top;
hlundin-webrtc 2015/06/30 14:00:51 Premature declaration of variables. Declare them w
ekm 2015/07/01 23:48:25 Done.
+ SolveForGainsGivenLambda(kLambdaTop, start_freq_, gains_eq_.get());
power_top =
DotProduct(gains_eq_.get(), filtered_clear_var_.get(), bank_size_);
- SolveForGainsGivenLambda(lambda_bot, start_freq_, gains_eq_.get());
+ SolveForGainsGivenLambda(kLambdaBot, start_freq_, gains_eq_.get());
power_bot =
DotProduct(gains_eq_.get(), filtered_clear_var_.get(), bank_size_);
- DCHECK(power_target >= power_bot && power_target <= power_top);
+ if(power_target >= power_bot && power_target <= power_top) {
+ SolveForLambda(power_target, power_bot, power_top);
+ UpdateErbGains();
+ } // Else experiencing variance underflow, so do nothing.
+}
+void IntelligibilityEnhancer::SolveForLambda(float power_target,
+ float power_bot,
+ float power_top) {
+ float lambda_bot = kLambdaBot;
+ float lambda_top = kLambdaTop;
+ float lambda, power;
hlundin-webrtc 2015/06/30 14:00:52 Skip declaration of lambda and power here and decl
ekm 2015/07/01 23:48:25 Done.
float power_ratio = 2.0f; // Ratio of achieved power to target power.
const float kConvergeThresh = 0.001f; // TODO(ekmeyerson): Find best values
const int kMaxIters = 100; // for these, based on experiments.
@@ -267,7 +277,9 @@ void IntelligibilityEnhancer::AnalyzeClearBlock(float power_target) {
power_ratio = fabs(power / power_target);
++iters;
}
+}
+void IntelligibilityEnhancer::UpdateErbGains() {
// (ERB gain) = filterbank' * (freq gain)
float* gains = gain_applier_.target();
for (int i = 0; i < freqs_; ++i) {

Powered by Google App Engine
This is Rietveld 408576698