OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
11 /* | 11 /* |
12 * The core AEC algorithm, which is presented with time-aligned signals. | 12 * The core AEC algorithm, which is presented with time-aligned signals. |
13 */ | 13 */ |
14 | 14 |
15 #include "webrtc/modules/audio_processing/aec/aec_core.h" | 15 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
16 | 16 |
17 #include <math.h> | 17 #include <math.h> |
18 | 18 |
19 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" | 19 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" |
20 #include "webrtc/modules/audio_processing/aec/aec_core_internal.h" | 20 #include "webrtc/modules/audio_processing/aec/aec_core_internal.h" |
21 #include "webrtc/modules/audio_processing/aec/aec_rdft.h" | 21 #include "webrtc/modules/audio_processing/aec/aec_rdft.h" |
22 | 22 |
23 static const int flagHbandCn = 1; // flag for adding comfort noise in H band | |
24 extern const float WebRtcAec_weightCurve[65]; | 23 extern const float WebRtcAec_weightCurve[65]; |
25 extern const float WebRtcAec_overDriveCurve[65]; | 24 extern const float WebRtcAec_overDriveCurve[65]; |
26 | 25 |
27 void WebRtcAec_ComfortNoise_mips(AecCore* aec, | 26 void WebRtcAec_ComfortNoise_mips(AecCore* aec, |
28 float efw[2][PART_LEN1], | 27 float efw[2][PART_LEN1], |
29 float comfortNoiseHband[2][PART_LEN1], | 28 float comfortNoiseHband[2][PART_LEN1], |
30 const float* noisePow, | 29 const float* noisePow, |
31 const float* lambda) { | 30 const float* lambda) { |
32 int i, num; | 31 int i, num; |
33 float rand[PART_LEN]; | 32 float rand[PART_LEN]; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 tmp = sqrtf(WEBRTC_SPL_MAX(1 - lambda[PART_LEN] * lambda[PART_LEN], 0)); | 266 tmp = sqrtf(WEBRTC_SPL_MAX(1 - lambda[PART_LEN] * lambda[PART_LEN], 0)); |
268 //tmp = 1 - lambda[i]; | 267 //tmp = 1 - lambda[i]; |
269 efw[0][PART_LEN] += tmp * u[PART_LEN][0]; | 268 efw[0][PART_LEN] += tmp * u[PART_LEN][0]; |
270 efw[1][PART_LEN] += tmp * u[PART_LEN][1]; | 269 efw[1][PART_LEN] += tmp * u[PART_LEN][1]; |
271 | 270 |
272 // For H band comfort noise | 271 // For H band comfort noise |
273 // TODO: don't compute noise and "tmp" twice. Use the previous results. | 272 // TODO: don't compute noise and "tmp" twice. Use the previous results. |
274 noiseAvg = 0.0; | 273 noiseAvg = 0.0; |
275 tmpAvg = 0.0; | 274 tmpAvg = 0.0; |
276 num = 0; | 275 num = 0; |
277 if (aec->num_bands > 1 && flagHbandCn == 1) { | 276 if (aec->num_bands > 1) { |
minyue-webrtc
2015/12/04 09:10:10
I am not sure if this should be removed.
peah-webrtc
2015/12/04 09:54:39
Please see the response for aec_core.c about this.
| |
278 for (i = 0; i < PART_LEN; i++) { | 277 for (i = 0; i < PART_LEN; i++) { |
279 rand[i] = ((float)randW16[i]) / 32768; | 278 rand[i] = ((float)randW16[i]) / 32768; |
280 } | 279 } |
281 | 280 |
282 // average noise scale | 281 // average noise scale |
283 // average over second half of freq spectrum (i.e., 4->8khz) | 282 // average over second half of freq spectrum (i.e., 4->8khz) |
284 // TODO: we shouldn't need num. We know how many elements we're summing. | 283 // TODO: we shouldn't need num. We know how many elements we're summing. |
285 for (i = PART_LEN1 >> 1; i < PART_LEN1; i++) { | 284 for (i = PART_LEN1 >> 1; i < PART_LEN1; i++) { |
286 num++; | 285 num++; |
287 noiseAvg += sqrtf(noisePow[i]); | 286 noiseAvg += sqrtf(noisePow[i]); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 ); | 779 ); |
781 } | 780 } |
782 | 781 |
783 void WebRtcAec_InitAec_mips(void) { | 782 void WebRtcAec_InitAec_mips(void) { |
784 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; | 783 WebRtcAec_FilterFar = WebRtcAec_FilterFar_mips; |
785 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; | 784 WebRtcAec_FilterAdaptation = WebRtcAec_FilterAdaptation_mips; |
786 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; | 785 WebRtcAec_ScaleErrorSignal = WebRtcAec_ScaleErrorSignal_mips; |
787 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips; | 786 WebRtcAec_ComfortNoise = WebRtcAec_ComfortNoise_mips; |
788 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips; | 787 WebRtcAec_OverdriveAndSuppress = WebRtcAec_OverdriveAndSuppress_mips; |
789 } | 788 } |
OLD | NEW |