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

Side by Side Diff: webrtc/modules/audio_processing/aec/aec_core.cc

Issue 1939723002: Removed the state as an input to OverdriveAndSuppress in the AEC. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase with latest master Created 4 years, 7 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 h_fft_buf[0][pos] += fft[0]; 300 h_fft_buf[0][pos] += fft[0];
301 h_fft_buf[0][pos + PART_LEN] += fft[1]; 301 h_fft_buf[0][pos + PART_LEN] += fft[1];
302 302
303 for (j = 1; j < PART_LEN; j++) { 303 for (j = 1; j < PART_LEN; j++) {
304 h_fft_buf[0][pos + j] += fft[2 * j]; 304 h_fft_buf[0][pos + j] += fft[2 * j];
305 h_fft_buf[1][pos + j] += fft[2 * j + 1]; 305 h_fft_buf[1][pos + j] += fft[2 * j + 1];
306 } 306 }
307 } 307 }
308 } 308 }
309 309
310 static void OverdriveAndSuppress(AecCore* aec, 310 static void OverdriveAndSuppress(float overdrive_scaling,
311 float hNl[PART_LEN1], 311 float hNl[PART_LEN1],
312 const float hNlFb, 312 const float hNlFb,
313 float efw[2][PART_LEN1]) { 313 float efw[2][PART_LEN1]) {
314 int i; 314 int i;
315 for (i = 0; i < PART_LEN1; i++) { 315 for (i = 0; i < PART_LEN1; i++) {
316 // Weight subbands 316 // Weight subbands
317 if (hNl[i] > hNlFb) { 317 if (hNl[i] > hNlFb) {
318 hNl[i] = WebRtcAec_weightCurve[i] * hNlFb + 318 hNl[i] = WebRtcAec_weightCurve[i] * hNlFb +
319 (1 - WebRtcAec_weightCurve[i]) * hNl[i]; 319 (1 - WebRtcAec_weightCurve[i]) * hNl[i];
320 } 320 }
321 hNl[i] = powf(hNl[i], aec->overDriveSm * WebRtcAec_overDriveCurve[i]); 321 hNl[i] = powf(hNl[i], overdrive_scaling * WebRtcAec_overDriveCurve[i]);
322 322
323 // Suppress error signal 323 // Suppress error signal
324 efw[0][i] *= hNl[i]; 324 efw[0][i] *= hNl[i];
325 efw[1][i] *= hNl[i]; 325 efw[1][i] *= hNl[i];
326 326
327 // Ooura fft returns incorrect sign on imaginary component. It matters here 327 // Ooura fft returns incorrect sign on imaginary component. It matters here
328 // because we are making an additive change with comfort noise. 328 // because we are making an additive change with comfort noise.
329 efw[1][i] *= -1; 329 efw[1][i] *= -1;
330 } 330 }
331 } 331 }
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 if (aec->hNlMinCtr == 2) { 1138 if (aec->hNlMinCtr == 2) {
1139 aec->hNlNewMin = 0; 1139 aec->hNlNewMin = 0;
1140 aec->hNlMinCtr = 0; 1140 aec->hNlMinCtr = 0;
1141 aec->overDrive = 1141 aec->overDrive =
1142 WEBRTC_SPL_MAX(kTargetSupp[aec->nlp_mode] / 1142 WEBRTC_SPL_MAX(kTargetSupp[aec->nlp_mode] /
1143 static_cast<float>(log(aec->hNlFbMin + 1e-10f) + 1e-10f), 1143 static_cast<float>(log(aec->hNlFbMin + 1e-10f) + 1e-10f),
1144 min_overdrive[aec->nlp_mode]); 1144 min_overdrive[aec->nlp_mode]);
1145 } 1145 }
1146 1146
1147 // Smooth the overdrive. 1147 // Smooth the overdrive.
1148 if (aec->overDrive < aec->overDriveSm) { 1148 if (aec->overDrive < aec->overdrive_scaling) {
1149 aec->overDriveSm = 0.99f * aec->overDriveSm + 0.01f * aec->overDrive; 1149 aec->overdrive_scaling =
1150 0.99f * aec->overdrive_scaling + 0.01f * aec->overDrive;
1150 } else { 1151 } else {
1151 aec->overDriveSm = 0.9f * aec->overDriveSm + 0.1f * aec->overDrive; 1152 aec->overdrive_scaling =
1153 0.9f * aec->overdrive_scaling + 0.1f * aec->overDrive;
1152 } 1154 }
1153 1155
1154 WebRtcAec_OverdriveAndSuppress(aec, hNl, hNlFb, efw); 1156 WebRtcAec_OverdriveAndSuppress(aec->overdrive_scaling, hNl, hNlFb, efw);
1155 1157
1156 // Add comfort noise. 1158 // Add comfort noise.
1157 WebRtcAec_ComfortNoise(aec, efw, comfortNoiseHband, aec->noisePow, hNl); 1159 WebRtcAec_ComfortNoise(aec, efw, comfortNoiseHband, aec->noisePow, hNl);
1158 1160
1159 // Inverse error fft. 1161 // Inverse error fft.
1160 ScaledInverseFft(efw, fft, 2.0f, 1); 1162 ScaledInverseFft(efw, fft, 2.0f, 1);
1161 1163
1162 // Overlap and add to obtain output. 1164 // Overlap and add to obtain output.
1163 for (i = 0; i < PART_LEN; i++) { 1165 for (i = 0; i < PART_LEN; i++) {
1164 output[i] = (fft[i] * WebRtcAec_sqrtHanning[i] + 1166 output[i] = (fft[i] * WebRtcAec_sqrtHanning[i] +
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 1682
1681 memset(aec->hNs, 0, sizeof(aec->hNs)); 1683 memset(aec->hNs, 0, sizeof(aec->hNs));
1682 memset(aec->outBuf, 0, sizeof(float) * PART_LEN); 1684 memset(aec->outBuf, 0, sizeof(float) * PART_LEN);
1683 1685
1684 aec->hNlFbMin = 1; 1686 aec->hNlFbMin = 1;
1685 aec->hNlFbLocalMin = 1; 1687 aec->hNlFbLocalMin = 1;
1686 aec->hNlXdAvgMin = 1; 1688 aec->hNlXdAvgMin = 1;
1687 aec->hNlNewMin = 0; 1689 aec->hNlNewMin = 0;
1688 aec->hNlMinCtr = 0; 1690 aec->hNlMinCtr = 0;
1689 aec->overDrive = 2; 1691 aec->overDrive = 2;
1690 aec->overDriveSm = 2; 1692 aec->overdrive_scaling = 2;
1691 aec->delayIdx = 0; 1693 aec->delayIdx = 0;
1692 aec->stNearState = 0; 1694 aec->stNearState = 0;
1693 aec->echoState = 0; 1695 aec->echoState = 0;
1694 aec->divergeState = 0; 1696 aec->divergeState = 0;
1695 1697
1696 aec->seed = 777; 1698 aec->seed = 777;
1697 aec->delayEstCtr = 0; 1699 aec->delayEstCtr = 0;
1698 1700
1699 aec->extreme_filter_divergence = 0; 1701 aec->extreme_filter_divergence = 0;
1700 1702
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 1947
1946 int WebRtcAec_system_delay(AecCore* self) { 1948 int WebRtcAec_system_delay(AecCore* self) {
1947 return self->system_delay; 1949 return self->system_delay;
1948 } 1950 }
1949 1951
1950 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { 1952 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) {
1951 assert(delay >= 0); 1953 assert(delay >= 0);
1952 self->system_delay = delay; 1954 self->system_delay = delay;
1953 } 1955 }
1954 } // namespace webrtc 1956 } // namespace webrtc
OLDNEW
« 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