Chromium Code Reviews

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

Issue 1454983006: Ducking fix #2: Removed the aec state as an input parameter to the FilterFar function. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@Aec_Code_Cleanup_CL
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
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 3ce57ec285ae7f0db7ff0b92b5fc79871065bc0e..e6a353921cfd429f1282490d1de576e2139ac62c 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.c
+++ b/webrtc/modules/audio_processing/aec/aec_core.c
@@ -151,26 +151,30 @@ static int CmpFloat(const void* a, const void* b) {
return (*da > *db) - (*da < *db);
}
-static void FilterFar(AecCore* aec, float yf[2][PART_LEN1]) {
+static void FilterFar(int num_partitions,
+ int xfBufBlockPos,
+ float xfBuf[2][kExtendedNumPartitions * PART_LEN1],
+ float wfBuf[2][kExtendedNumPartitions * PART_LEN1],
+ float yf[2][PART_LEN1]) {
int i;
- for (i = 0; i < aec->num_partitions; i++) {
+ for (i = 0; i < num_partitions; i++) {
int j;
- int xPos = (i + aec->xfBufBlockPos) * PART_LEN1;
+ int xPos = (i + xfBufBlockPos) * PART_LEN1;
int pos = i * PART_LEN1;
// Check for wrap
- if (i + aec->xfBufBlockPos >= aec->num_partitions) {
- xPos -= aec->num_partitions * (PART_LEN1);
+ if (i + xfBufBlockPos >= num_partitions) {
+ xPos -= num_partitions * (PART_LEN1);
}
for (j = 0; j < PART_LEN1; j++) {
- yf[0][j] += MulRe(aec->xfBuf[0][xPos + j],
- aec->xfBuf[1][xPos + j],
- aec->wfBuf[0][pos + j],
- aec->wfBuf[1][pos + j]);
- yf[1][j] += MulIm(aec->xfBuf[0][xPos + j],
- aec->xfBuf[1][xPos + j],
- aec->wfBuf[0][pos + j],
- aec->wfBuf[1][pos + j]);
+ yf[0][j] += MulRe(xfBuf[0][xPos + j],
+ xfBuf[1][xPos + j],
+ wfBuf[0][pos + j],
+ wfBuf[1][pos + j]);
+ yf[1][j] += MulIm(xfBuf[0][xPos + j],
+ xfBuf[1][xPos + j],
+ wfBuf[0][pos + j],
+ wfBuf[1][pos + j]);
}
}
}
@@ -970,7 +974,11 @@ static void EchoSubtraction(AecCore* aec,
memset(yf, 0, sizeof(yf));
// Produce echo estimate.
- WebRtcAec_FilterFar(aec, yf);
+ WebRtcAec_FilterFar(aec->num_partitions,
+ aec->xfBufBlockPos,
+ aec->xfBuf,
+ aec->wfBuf,
+ yf);
// Inverse fft to obtain echo estimate and error.
FrequencyToTime(yf, fft);

Powered by Google App Engine