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..f1c448a6be7dc43da6b22c0d76520e370fc16953 100644 |
--- a/webrtc/modules/audio_processing/aec/aec_core.c |
+++ b/webrtc/modules/audio_processing/aec/aec_core.c |
@@ -899,20 +899,22 @@ static int SignalBasedDelayCorrection(AecCore* self) { |
return delay_correction; |
} |
-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, |
- float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], |
- 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]) { |
+static void EchoSubtraction(AecCore* aec, |
+ int num_partitions, |
+ int metrics_mode, |
minyue-webrtc
2016/01/26 15:15:26
I prefer the old line breaking. less lines and cle
peah-webrtc
2016/01/28 13:06:07
This breaking is according to (caused by) clang-fo
minyue-webrtc
2016/01/28 14:10:40
That is generally ok, although I prefer some manua
|
+ int extended_filter_enabled, |
+ float normal_mu, |
+ float normal_error_threshold, |
+ float* xf, |
minyue-webrtc
2016/01/26 15:15:26
would it better to change xf to something more mea
peah-webrtc
2016/01/28 13:06:07
That makes sense! I will change to x_fft, as that
|
+ int* x_fft_buf_block_pos, |
+ float x_fft_buf[2] |
+ [kExtendedNumPartitions * PART_LEN1], |
+ 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]; |
float s_extended[PART_LEN2]; |
@@ -920,6 +922,19 @@ static void EchoSubtraction( |
float e[PART_LEN]; |
float e_fft[2][PART_LEN1]; |
int i; |
+ |
+ // Update the x_fft_buf block position. |
+ (*x_fft_buf_block_pos)--; |
+ if ((*x_fft_buf_block_pos) == -1) { |
+ *x_fft_buf_block_pos = num_partitions - 1; |
+ } |
+ |
+ // Buffer xf. |
+ memcpy(x_fft_buf[0] + (*x_fft_buf_block_pos) * PART_LEN1, xf, |
+ sizeof(float) * PART_LEN1); |
+ memcpy(x_fft_buf[1] + (*x_fft_buf_block_pos) * PART_LEN1, &xf[PART_LEN1], |
+ sizeof(float) * PART_LEN1); |
+ |
memset(s_fft, 0, sizeof(s_fft)); |
// Conditionally reset the echo subtraction filter if the filter has diverged |
@@ -931,11 +946,8 @@ static void EchoSubtraction( |
} |
// Produce echo estimate s_fft. |
- WebRtcAec_FilterFar(num_partitions, |
- x_fft_buf_block_pos, |
- x_fft_buf, |
- h_fft_buf, |
- s_fft); |
+ WebRtcAec_FilterFar(num_partitions, *x_fft_buf_block_pos, x_fft_buf, |
+ h_fft_buf, s_fft); |
// Compute the time-domain echo estimate s. |
ScaledInverseFft(s_fft, s_extended, 2.0f, 0); |
@@ -968,11 +980,8 @@ static void EchoSubtraction( |
normal_error_threshold, |
x_pow, |
e_fft); |
- WebRtcAec_FilterAdaptation(num_partitions, |
- x_fft_buf_block_pos, |
- x_fft_buf, |
- e_fft, |
- h_fft_buf); |
+ WebRtcAec_FilterAdaptation(num_partitions, *x_fft_buf_block_pos, x_fft_buf, |
+ e_fft, h_fft_buf); |
memcpy(echo_subtractor_output, e, sizeof(float) * PART_LEN); |
} |
@@ -1356,34 +1365,12 @@ static void ProcessBlock(AecCore* aec) { |
} |
} |
- // Update the xfBuf block position. |
- aec->xfBufBlockPos--; |
- if (aec->xfBufBlockPos == -1) { |
- aec->xfBufBlockPos = aec->num_partitions - 1; |
- } |
- |
- // Buffer xf |
- memcpy(aec->xfBuf[0] + aec->xfBufBlockPos * PART_LEN1, |
- xf_ptr, |
- sizeof(float) * PART_LEN1); |
- memcpy(aec->xfBuf[1] + aec->xfBufBlockPos * PART_LEN1, |
- &xf_ptr[PART_LEN1], |
- sizeof(float) * PART_LEN1); |
- |
// Perform echo subtraction. |
- EchoSubtraction(aec, |
- aec->num_partitions, |
- aec->xfBufBlockPos, |
- aec->metricsMode, |
- aec->extended_filter_enabled, |
- aec->normal_mu, |
- aec->normal_error_threshold, |
- aec->xfBuf, |
- nearend_ptr, |
- aec->xPow, |
- aec->wfBuf, |
- &aec->linoutlevel, |
- echo_subtractor_output); |
+ EchoSubtraction(aec, aec->num_partitions, aec->metricsMode, |
+ aec->extended_filter_enabled, aec->normal_mu, |
+ aec->normal_error_threshold, &xf[0][0], &aec->xfBufBlockPos, |
minyue-webrtc
2016/01/26 15:15:26
if you like you can change xf here to something mo
peah-webrtc
2016/01/28 13:06:07
Done.
|
+ aec->xfBuf, nearend_ptr, aec->xPow, aec->wfBuf, |
+ &aec->linoutlevel, echo_subtractor_output); |
RTC_AEC_DEBUG_WAV_WRITE(aec->outLinearFile, echo_subtractor_output, PART_LEN); |