OLD | NEW |
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 const float WebRtcAec_kNormalSmoothingCoefficients[2][2] = {{0.9f, 0.1f}, | 125 const float WebRtcAec_kNormalSmoothingCoefficients[2][2] = {{0.9f, 0.1f}, |
126 {0.93f, 0.07f}}; | 126 {0.93f, 0.07f}}; |
127 | 127 |
128 // Number of partitions forming the NLP's "preferred" bands. | 128 // Number of partitions forming the NLP's "preferred" bands. |
129 enum { kPrefBandSize = 24 }; | 129 enum { kPrefBandSize = 24 }; |
130 | 130 |
131 WebRtcAecFilterFar WebRtcAec_FilterFar; | 131 WebRtcAecFilterFar WebRtcAec_FilterFar; |
132 WebRtcAecScaleErrorSignal WebRtcAec_ScaleErrorSignal; | 132 WebRtcAecScaleErrorSignal WebRtcAec_ScaleErrorSignal; |
133 WebRtcAecFilterAdaptation WebRtcAec_FilterAdaptation; | 133 WebRtcAecFilterAdaptation WebRtcAec_FilterAdaptation; |
134 WebRtcAecOverdriveAndSuppress WebRtcAec_OverdriveAndSuppress; | 134 WebRtcAecOverdriveAndSuppress WebRtcAec_OverdriveAndSuppress; |
135 WebRtcAecComfortNoise WebRtcAec_ComfortNoise; | |
136 WebRtcAecSubBandCoherence WebRtcAec_SubbandCoherence; | 135 WebRtcAecSubBandCoherence WebRtcAec_SubbandCoherence; |
137 WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex; | 136 WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex; |
138 WebRtcAecPartitionDelay WebRtcAec_PartitionDelay; | 137 WebRtcAecPartitionDelay WebRtcAec_PartitionDelay; |
139 WebRtcAecWindowData WebRtcAec_WindowData; | 138 WebRtcAecWindowData WebRtcAec_WindowData; |
140 | 139 |
141 __inline static float MulRe(float aRe, float aIm, float bRe, float bIm) { | 140 __inline static float MulRe(float aRe, float aIm, float bRe, float bIm) { |
142 return aRe * bRe - aIm * bIm; | 141 return aRe * bRe - aIm * bIm; |
143 } | 142 } |
144 | 143 |
145 __inline static float MulIm(float aRe, float aIm, float bRe, float bIm) { | 144 __inline static float MulIm(float aRe, float aIm, float bRe, float bIm) { |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 aec->overdrive_scaling = | 1161 aec->overdrive_scaling = |
1163 0.99f * aec->overdrive_scaling + 0.01f * aec->overDrive; | 1162 0.99f * aec->overdrive_scaling + 0.01f * aec->overDrive; |
1164 } else { | 1163 } else { |
1165 aec->overdrive_scaling = | 1164 aec->overdrive_scaling = |
1166 0.9f * aec->overdrive_scaling + 0.1f * aec->overDrive; | 1165 0.9f * aec->overdrive_scaling + 0.1f * aec->overDrive; |
1167 } | 1166 } |
1168 | 1167 |
1169 WebRtcAec_OverdriveAndSuppress(aec->overdrive_scaling, hNl, hNlFb, efw); | 1168 WebRtcAec_OverdriveAndSuppress(aec->overdrive_scaling, hNl, hNlFb, efw); |
1170 | 1169 |
1171 // Add comfort noise. | 1170 // Add comfort noise. |
1172 WebRtcAec_ComfortNoise(aec, efw, comfortNoiseHband, aec->noisePow, hNl); | 1171 ComfortNoise(aec, efw, comfortNoiseHband, aec->noisePow, hNl); |
1173 | 1172 |
1174 // Inverse error fft. | 1173 // Inverse error fft. |
1175 ScaledInverseFft(efw, fft, 2.0f, 1); | 1174 ScaledInverseFft(efw, fft, 2.0f, 1); |
1176 | 1175 |
1177 // Overlap and add to obtain output. | 1176 // Overlap and add to obtain output. |
1178 for (i = 0; i < PART_LEN; i++) { | 1177 for (i = 0; i < PART_LEN; i++) { |
1179 output[i] = (fft[i] * WebRtcAec_sqrtHanning[i] + | 1178 output[i] = (fft[i] * WebRtcAec_sqrtHanning[i] + |
1180 aec->outBuf[i] * WebRtcAec_sqrtHanning[PART_LEN - i]); | 1179 aec->outBuf[i] * WebRtcAec_sqrtHanning[PART_LEN - i]); |
1181 | 1180 |
1182 // Saturate output to keep it in the allowed range. | 1181 // Saturate output to keep it in the allowed range. |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 #endif | 1479 #endif |
1481 aec->extended_filter_enabled = 0; | 1480 aec->extended_filter_enabled = 0; |
1482 aec->aec3_enabled = 0; | 1481 aec->aec3_enabled = 0; |
1483 aec->refined_adaptive_filter_enabled = false; | 1482 aec->refined_adaptive_filter_enabled = false; |
1484 | 1483 |
1485 // Assembly optimization | 1484 // Assembly optimization |
1486 WebRtcAec_FilterFar = FilterFar; | 1485 WebRtcAec_FilterFar = FilterFar; |
1487 WebRtcAec_ScaleErrorSignal = ScaleErrorSignal; | 1486 WebRtcAec_ScaleErrorSignal = ScaleErrorSignal; |
1488 WebRtcAec_FilterAdaptation = FilterAdaptation; | 1487 WebRtcAec_FilterAdaptation = FilterAdaptation; |
1489 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppress; | 1488 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppress; |
1490 WebRtcAec_ComfortNoise = ComfortNoise; | |
1491 WebRtcAec_SubbandCoherence = SubbandCoherence; | 1489 WebRtcAec_SubbandCoherence = SubbandCoherence; |
1492 WebRtcAec_StoreAsComplex = StoreAsComplex; | 1490 WebRtcAec_StoreAsComplex = StoreAsComplex; |
1493 WebRtcAec_PartitionDelay = PartitionDelay; | 1491 WebRtcAec_PartitionDelay = PartitionDelay; |
1494 WebRtcAec_WindowData = WindowData; | 1492 WebRtcAec_WindowData = WindowData; |
1495 | 1493 |
1496 #if defined(WEBRTC_ARCH_X86_FAMILY) | 1494 #if defined(WEBRTC_ARCH_X86_FAMILY) |
1497 if (WebRtc_GetCPUInfo(kSSE2)) { | 1495 if (WebRtc_GetCPUInfo(kSSE2)) { |
1498 WebRtcAec_InitAec_SSE2(); | 1496 WebRtcAec_InitAec_SSE2(); |
1499 } | 1497 } |
1500 #endif | 1498 #endif |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 | 1958 |
1961 int WebRtcAec_system_delay(AecCore* self) { | 1959 int WebRtcAec_system_delay(AecCore* self) { |
1962 return self->system_delay; | 1960 return self->system_delay; |
1963 } | 1961 } |
1964 | 1962 |
1965 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { | 1963 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { |
1966 assert(delay >= 0); | 1964 assert(delay >= 0); |
1967 self->system_delay = delay; | 1965 self->system_delay = delay; |
1968 } | 1966 } |
1969 } // namespace webrtc | 1967 } // namespace webrtc |
OLD | NEW |