Changed the name of the variable overdriveSm and removed the
state as an input to OverdriveAndSuppress in the AEC.
This CL is step towards simplifying the AEC code, making it more
modifiable and modular.
The changes should be bitexact.
BUG=webrtc:5201, webrtc:5298
Review-Url: https://codereview.webrtc.org/1939723002
Cr-Commit-Position: refs/heads/master@{#12616}
diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
index 2a6adde..5da8b13 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -307,7 +307,7 @@
}
}
-static void OverdriveAndSuppress(AecCore* aec,
+static void OverdriveAndSuppress(float overdrive_scaling,
float hNl[PART_LEN1],
const float hNlFb,
float efw[2][PART_LEN1]) {
@@ -318,7 +318,7 @@
hNl[i] = WebRtcAec_weightCurve[i] * hNlFb +
(1 - WebRtcAec_weightCurve[i]) * hNl[i];
}
- hNl[i] = powf(hNl[i], aec->overDriveSm * WebRtcAec_overDriveCurve[i]);
+ hNl[i] = powf(hNl[i], overdrive_scaling * WebRtcAec_overDriveCurve[i]);
// Suppress error signal
efw[0][i] *= hNl[i];
@@ -1145,13 +1145,15 @@
}
// Smooth the overdrive.
- if (aec->overDrive < aec->overDriveSm) {
- aec->overDriveSm = 0.99f * aec->overDriveSm + 0.01f * aec->overDrive;
+ if (aec->overDrive < aec->overdrive_scaling) {
+ aec->overdrive_scaling =
+ 0.99f * aec->overdrive_scaling + 0.01f * aec->overDrive;
} else {
- aec->overDriveSm = 0.9f * aec->overDriveSm + 0.1f * aec->overDrive;
+ aec->overdrive_scaling =
+ 0.9f * aec->overdrive_scaling + 0.1f * aec->overDrive;
}
- WebRtcAec_OverdriveAndSuppress(aec, hNl, hNlFb, efw);
+ WebRtcAec_OverdriveAndSuppress(aec->overdrive_scaling, hNl, hNlFb, efw);
// Add comfort noise.
WebRtcAec_ComfortNoise(aec, efw, comfortNoiseHband, aec->noisePow, hNl);
@@ -1687,7 +1689,7 @@
aec->hNlNewMin = 0;
aec->hNlMinCtr = 0;
aec->overDrive = 2;
- aec->overDriveSm = 2;
+ aec->overdrive_scaling = 2;
aec->delayIdx = 0;
aec->stNearState = 0;
aec->echoState = 0;
diff --git a/webrtc/modules/audio_processing/aec/aec_core_internal.h b/webrtc/modules/audio_processing/aec/aec_core_internal.h
index 11e5bb0..78dd187 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_internal.h
+++ b/webrtc/modules/audio_processing/aec/aec_core_internal.h
@@ -113,7 +113,8 @@
float hNlFbMin, hNlFbLocalMin;
float hNlXdAvgMin;
int hNlNewMin, hNlMinCtr;
- float overDrive, overDriveSm;
+ float overDrive;
+ float overdrive_scaling;
int nlp_mode;
float outBuf[PART_LEN];
int delayIdx;
@@ -209,7 +210,7 @@
float e_fft[2][PART_LEN1],
float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1]);
extern WebRtcAecFilterAdaptation WebRtcAec_FilterAdaptation;
-typedef void (*WebRtcAecOverdriveAndSuppress)(AecCore* aec,
+typedef void (*WebRtcAecOverdriveAndSuppress)(float overdrive_scaling,
float hNl[PART_LEN1],
const float hNlFb,
float efw[2][PART_LEN1]);
diff --git a/webrtc/modules/audio_processing/aec/aec_core_mips.cc b/webrtc/modules/audio_processing/aec/aec_core_mips.cc
index e12f2ef..c5c9b0b 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_mips.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core_mips.cc
@@ -642,7 +642,7 @@
}
}
-void WebRtcAec_OverdriveAndSuppress_mips(AecCore* aec,
+void WebRtcAec_OverdriveAndSuppress_mips(float overdrive_scaling,
float hNl[PART_LEN1],
const float hNlFb,
float efw[2][PART_LEN1]) {
@@ -685,7 +685,7 @@
: [hNlFb] "f" (hNlFb), [one] "f" (one), [p_hNl] "r" (p_hNl)
: "memory");
- hNl[i] = powf(hNl[i], aec->overDriveSm * WebRtcAec_overDriveCurve[i]);
+ hNl[i] = powf(hNl[i], overdrive_scaling * WebRtcAec_overDriveCurve[i]);
__asm __volatile(
"lwc1 %[temp1], 0(%[p_hNl]) \n\t"
diff --git a/webrtc/modules/audio_processing/aec/aec_core_neon.cc b/webrtc/modules/audio_processing/aec/aec_core_neon.cc
index 12b9359..80c5201 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_neon.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core_neon.cc
@@ -374,7 +374,7 @@
return a_exp_b;
}
-static void OverdriveAndSuppressNEON(AecCore* aec,
+static void OverdriveAndSuppressNEON(float overdrive_scaling,
float hNl[PART_LEN1],
const float hNlFb,
float efw[2][PART_LEN1]) {
@@ -382,7 +382,7 @@
const float32x4_t vec_hNlFb = vmovq_n_f32(hNlFb);
const float32x4_t vec_one = vdupq_n_f32(1.0f);
const float32x4_t vec_minus_one = vdupq_n_f32(-1.0f);
- const float32x4_t vec_overDriveSm = vmovq_n_f32(aec->overDriveSm);
+ const float32x4_t vec_overdrive_scaling = vmovq_n_f32(overdrive_scaling);
// vectorized code (four at once)
for (i = 0; i + 3 < PART_LEN1; i += 4) {
@@ -408,7 +408,7 @@
const float32x4_t vec_overDriveCurve =
vld1q_f32(&WebRtcAec_overDriveCurve[i]);
const float32x4_t vec_overDriveSm_overDriveCurve =
- vmulq_f32(vec_overDriveSm, vec_overDriveCurve);
+ vmulq_f32(vec_overdrive_scaling, vec_overDriveCurve);
vec_hNl = vpowq_f32(vec_hNl, vec_overDriveSm_overDriveCurve);
vst1q_f32(&hNl[i], vec_hNl);
}
@@ -436,7 +436,7 @@
(1 - WebRtcAec_weightCurve[i]) * hNl[i];
}
- hNl[i] = powf(hNl[i], aec->overDriveSm * WebRtcAec_overDriveCurve[i]);
+ hNl[i] = powf(hNl[i], overdrive_scaling * WebRtcAec_overDriveCurve[i]);
// Suppress error signal
efw[0][i] *= hNl[i];
diff --git a/webrtc/modules/audio_processing/aec/aec_core_sse2.cc b/webrtc/modules/audio_processing/aec/aec_core_sse2.cc
index 8fa0166..9a64616 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_sse2.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core_sse2.cc
@@ -375,7 +375,7 @@
return a_exp_b;
}
-static void OverdriveAndSuppressSSE2(AecCore* aec,
+static void OverdriveAndSuppressSSE2(float overdrive_scaling,
float hNl[PART_LEN1],
const float hNlFb,
float efw[2][PART_LEN1]) {
@@ -383,7 +383,7 @@
const __m128 vec_hNlFb = _mm_set1_ps(hNlFb);
const __m128 vec_one = _mm_set1_ps(1.0f);
const __m128 vec_minus_one = _mm_set1_ps(-1.0f);
- const __m128 vec_overDriveSm = _mm_set1_ps(aec->overDriveSm);
+ const __m128 vec_overdrive_scaling = _mm_set1_ps(overdrive_scaling);
// vectorized code (four at once)
for (i = 0; i + 3 < PART_LEN1; i += 4) {
// Weight subbands
@@ -403,7 +403,7 @@
const __m128 vec_overDriveCurve =
_mm_loadu_ps(&WebRtcAec_overDriveCurve[i]);
const __m128 vec_overDriveSm_overDriveCurve =
- _mm_mul_ps(vec_overDriveSm, vec_overDriveCurve);
+ _mm_mul_ps(vec_overdrive_scaling, vec_overDriveCurve);
vec_hNl = mm_pow_ps(vec_hNl, vec_overDriveSm_overDriveCurve);
_mm_storeu_ps(&hNl[i], vec_hNl);
}
@@ -429,7 +429,7 @@
hNl[i] = WebRtcAec_weightCurve[i] * hNlFb +
(1 - WebRtcAec_weightCurve[i]) * hNl[i];
}
- hNl[i] = powf(hNl[i], aec->overDriveSm * WebRtcAec_overDriveCurve[i]);
+ hNl[i] = powf(hNl[i], overdrive_scaling * WebRtcAec_overDriveCurve[i]);
// Suppress error signal
efw[0][i] *= hNl[i];