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

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

Issue 1718793002: Fix the gain calculation in IntelligibilityEnhancer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@vad
Patch Set: Make windows happy Created 4 years, 10 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/modules/audio_processing/intelligibility/intelligibility_enhancer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc
diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc
index b59ae36d8b2de94b9c0cafc33a253fd23c202cf8..ebfb67a90d26a40177c98c425a80cdf9bf5a6221 100644
--- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc
+++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc
@@ -186,16 +186,11 @@ static_assert(arraysize(kTestCenterFreqs) == arraysize(kTestFilterBank),
// Target output for gain solving test. Generated with matlab.
const size_t kTestStartFreq = 12; // Lowest integral frequency for ERBs.
-const float kTestZeroVar[] = {
- 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.f, 0.f, 0.f,
- 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f,
- 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0};
-static_assert(arraysize(kTestCenterFreqs) == arraysize(kTestZeroVar),
- "Power test data badly initialized.");
+const float kTestZeroVar = 1.f;
const float kTestNonZeroVarLambdaTop[] = {
- 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.f, 0.f, 0.f,
+ 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.f, 0.f,
0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f,
- 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0};
+ 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
static_assert(arraysize(kTestCenterFreqs) ==
arraysize(kTestNonZeroVarLambdaTop),
"Power test data badly initialized.");
@@ -280,7 +275,7 @@ TEST_F(IntelligibilityEnhancerTest, TestSolveForGains) {
}
enh_->SolveForGainsGivenLambda(lambda, enh_->start_freq_, &sols[0]);
for (size_t i = 0; i < enh_->bank_size_; i++) {
- EXPECT_NEAR(kTestZeroVar[i], sols[i], kMaxTestError);
+ EXPECT_NEAR(kTestZeroVar, sols[i], kMaxTestError);
}
for (size_t i = 0; i < enh_->bank_size_; i++) {
enh_->filtered_clear_pow_[i] = static_cast<float>(i + 1);
@@ -293,7 +288,7 @@ TEST_F(IntelligibilityEnhancerTest, TestSolveForGains) {
lambda = -1.f;
enh_->SolveForGainsGivenLambda(lambda, enh_->start_freq_, &sols[0]);
for (size_t i = 0; i < enh_->bank_size_; i++) {
- EXPECT_NEAR(kTestZeroVar[i], sols[i], kMaxTestError);
+ EXPECT_NEAR(kTestNonZeroVarLambdaTop[i], sols[i], kMaxTestError);
}
}
« no previous file with comments | « webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698