Index: webrtc/modules/audio_processing/aec/aec_core.c |
diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c |
index 26e13bc2c2dac54529e129c62ab964e3befd282d..112758c4cde7deaf543a0f00e0b827650d038f2e 100644 |
--- a/webrtc/modules/audio_processing/aec/aec_core.c |
+++ b/webrtc/modules/audio_processing/aec/aec_core.c |
@@ -667,12 +667,11 @@ static void UpdateMetrics(AecCore* aec) { |
// A_NLP |
dtmp = 10 * (float)log10(aec->nearlevel.averagelevel / |
- (2 * aec->linoutlevel.averagelevel) + |
- 1e-10f); |
+ aec->linoutlevel.averagelevel + 1e-10f); |
// subtract noise power |
- suppressedEcho = 2 * (aec->linoutlevel.averagelevel - |
- safety * aec->linoutlevel.minlevel); |
+ suppressedEcho = aec->linoutlevel.averagelevel - |
+ safety * aec->linoutlevel.minlevel; |
dtmp2 = 10 * (float)log10(echo / suppressedEcho + 1e-10f); |
@@ -903,7 +902,6 @@ static void EchoSubtraction( |
AecCore* aec, |
int num_partitions, |
int x_fft_buf_block_pos, |
- int metrics_mode, |
int extended_filter_enabled, |
float normal_mu, |
float normal_error_threshold, |
@@ -911,7 +909,6 @@ static void EchoSubtraction( |
float* const y, |
float x_pow[PART_LEN1], |
float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1], |
- PowerLevel* linout_level, |
float echo_subtractor_output[PART_LEN]) { |
float s_fft[2][PART_LEN1]; |
float e_extended[PART_LEN2]; |
@@ -955,13 +952,6 @@ static void EchoSubtraction( |
&e_fft[0][0], |
sizeof(e_fft[0][0]) * PART_LEN1 * 2); |
- if (metrics_mode == 1) { |
- // Note that the first PART_LEN samples in fft (before transformation) are |
- // zero. Hence, the scaling by two in UpdateLevel() should not be |
- // performed. That scaling is taken care of in UpdateMetrics() instead. |
- UpdateLevel(linout_level, CalculatePower(e, PART_LEN) / 2.0f); |
- } |
- |
// Scale error signal inversely with far power. |
WebRtcAec_ScaleErrorSignal(extended_filter_enabled, |
normal_mu, |
@@ -976,7 +966,6 @@ static void EchoSubtraction( |
memcpy(echo_subtractor_output, e, sizeof(float) * PART_LEN); |
} |
- |
static void EchoSuppression(AecCore* aec, |
float farend[PART_LEN2], |
float* echo_subtractor_output, |
@@ -1010,11 +999,6 @@ static void EchoSuppression(AecCore* aec, |
float* xfw_ptr = NULL; |
- // Update eBuf with echo subtractor output. |
- memcpy(aec->eBuf + PART_LEN, |
- echo_subtractor_output, |
- sizeof(float) * PART_LEN); |
- |
// Analysis filter banks for the echo suppressor. |
// Windowed near-end ffts. |
WindowData(fft, aec->dBuf); |
@@ -1374,7 +1358,6 @@ static void ProcessBlock(AecCore* aec) { |
EchoSubtraction(aec, |
aec->num_partitions, |
aec->xfBufBlockPos, |
- aec->metricsMode, |
aec->extended_filter_enabled, |
aec->normal_mu, |
aec->normal_error_threshold, |
@@ -1382,11 +1365,19 @@ static void ProcessBlock(AecCore* aec) { |
nearend_ptr, |
aec->xPow, |
aec->wfBuf, |
- &aec->linoutlevel, |
echo_subtractor_output); |
RTC_AEC_DEBUG_WAV_WRITE(aec->outLinearFile, echo_subtractor_output, PART_LEN); |
+ // Update eBuf with echo subtractor output. |
peah-webrtc
2016/01/25 12:23:02
This may be affected by changes in the future. As
minyue-webrtc
2016/01/25 14:26:55
Good point. It is true that when the linear filter
|
+ memcpy(aec->eBuf + PART_LEN, |
+ echo_subtractor_output, |
+ sizeof(float) * PART_LEN); |
+ |
+ if (aec->metricsMode == 1) { |
+ UpdateLevel(&aec->linoutlevel, CalculatePower(aec->eBuf, PART_LEN2)); |
+ } |
+ |
// Perform echo suppression. |
EchoSuppression(aec, farend_ptr, echo_subtractor_output, output, outputH_ptr); |