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

Unified Diff: webrtc/modules/audio_processing/aec/aec_core.cc

Issue 1739993003: Adding fraction of filter divergence in AEC metrics. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebasing Created 4 years, 9 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 | « no previous file | webrtc/modules/audio_processing/aec/aec_core_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/aec/aec_core.cc
diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
index e23a79312b05beb9c7904c103c605a5d454b3e69..289482abdc43d8ec70f2057b58454f0ade86b07c 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -50,6 +50,12 @@ static const size_t kSubCountLen = 4;
static const size_t kCountLen = 50;
static const int kDelayMetricsAggregationWindow = 1250; // 5 seconds at 16 kHz.
+// Diverge metric is based on audio level, which gets updated which every
+// |kCountLen + 1| * 10 milliseconds. Diverge metric takes the statistics of
+// |kDivergeMetricAggregationWindow| samples. Current value corresponds to 0.5
+// seconds at 16 kHz.
+static const int kDivergeMetricAggregationWindow = 25;
+
// Quantities to control H band scaling for SWB input
static const float cnScaleHband = 0.4f; // scale for comfort noise in H band.
// Initial bin for averaging nlp gain in low band
@@ -151,15 +157,17 @@ __inline static float MulIm(float aRe, float aIm, float bRe, float bIm) {
}
PowerLevel::PowerLevel()
-// TODO(minyue): Due to a legacy bug, |framelevel| and |averagelevel| use a
-// window, of which the length is 1 unit longer than indicated. Remove "+1"
-// when the code is refactored.
-: framelevel(kSubCountLen + 1),
- averagelevel(kCountLen + 1) {
+ // TODO(minyue): Due to a legacy bug, |framelevel| and |averagelevel| use a
+ // window, of which the length is 1 unit longer than indicated. Remove "+1"
+ // when the code is refactored.
+ : framelevel(kSubCountLen + 1),
+ averagelevel(kCountLen + 1) {
}
// TODO(minyue): Moving some initialization from WebRtcAec_CreateAec() to ctor.
-AecCore::AecCore() = default;
+AecCore::AecCore()
+ : fraction_filter_divergent(kDivergeMetricAggregationWindow) {
+}
static int CmpFloat(const void* a, const void* b) {
const float* da = (const float*)a;
@@ -562,6 +570,8 @@ static void InitMetrics(AecCore* self) {
InitStats(&self->erle);
InitStats(&self->aNlp);
InitStats(&self->rerl);
+
+ self->fraction_filter_diverge.Reset();
minyue-webrtc 2016/04/03 21:42:06 this should be "divergent". It is fixed in the nex
}
static float CalculatePower(const float* in, size_t num_samples) {
@@ -605,6 +615,17 @@ static void UpdateMetrics(AecCore* aec) {
aec->stateCounter++;
}
+ if (aec->linoutlevel.framelevel.EndOfBlock()) {
+ const float level_increase = aec->linoutlevel.framelevel.GetLatestMean() -
+ aec->nearlevel.framelevel.GetLatestMean();
+ // Level increase should be, in principle, negative, when the filter
+ // does not diverge. Here we allow some margin (0.001 * near end level) and
+ // numerical error (1.0).
+ aec->fraction_filter_divergent.AddValue(level_increase >
+ std::max(0.001 * aec->nearlevel.framelevel.GetLatestMean(), 1.0) ?
+ 1.0 : 0.0);
+ }
+
if (aec->farlevel.averagelevel.EndOfBlock()) {
if (aec->farlevel.minlevel < noisyPower) {
actThreshold = actThresholdClean;
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/aec/aec_core_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698