| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 #include "webrtc/modules/audio_processing/aec3/suppression_gain.h" | 11 #include "webrtc/modules/audio_processing/aec3/suppression_gain.h" |
| 12 | 12 |
| 13 #include "webrtc/typedefs.h" | 13 #include "webrtc/typedefs.h" |
| 14 #if defined(WEBRTC_ARCH_X86_FAMILY) | 14 #if defined(WEBRTC_ARCH_X86_FAMILY) |
| 15 #include <emmintrin.h> | 15 #include <emmintrin.h> |
| 16 #endif | 16 #endif |
| 17 #include <math.h> | 17 #include <math.h> |
| 18 #include <algorithm> | 18 #include <algorithm> |
| 19 #include <functional> | 19 #include <functional> |
| 20 #include <numeric> | 20 #include <numeric> |
| 21 | 21 |
| 22 #include "webrtc/base/checks.h" |
| 22 #include "webrtc/modules/audio_processing/aec3/vector_math.h" | 23 #include "webrtc/modules/audio_processing/aec3/vector_math.h" |
| 23 #include "webrtc/rtc_base/checks.h" | |
| 24 | 24 |
| 25 namespace webrtc { | 25 namespace webrtc { |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // Adjust the gains according to the presence of known external filters. | 28 // Adjust the gains according to the presence of known external filters. |
| 29 void AdjustForExternalFilters(std::array<float, kFftLengthBy2Plus1>* gain) { | 29 void AdjustForExternalFilters(std::array<float, kFftLengthBy2Plus1>* gain) { |
| 30 // Limit the low frequency gains to avoid the impact of the high-pass filter | 30 // Limit the low frequency gains to avoid the impact of the high-pass filter |
| 31 // on the lower-frequency gain influencing the overall achieved gain. | 31 // on the lower-frequency gain influencing the overall achieved gain. |
| 32 (*gain)[0] = (*gain)[1] = std::min((*gain)[1], (*gain)[2]); | 32 (*gain)[0] = (*gain)[1] = std::min((*gain)[1], (*gain)[2]); |
| 33 | 33 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 303 } |
| 304 | 304 |
| 305 constexpr float kThreshold = 50.f * 50.f * 64.f; | 305 constexpr float kThreshold = 50.f * 50.f * 64.f; |
| 306 const bool low_noise_render = | 306 const bool low_noise_render = |
| 307 average_power_ < kThreshold && x2_max < 3 * average_power_; | 307 average_power_ < kThreshold && x2_max < 3 * average_power_; |
| 308 average_power_ = average_power_ * 0.9f + x2_sum * 0.1f; | 308 average_power_ = average_power_ * 0.9f + x2_sum * 0.1f; |
| 309 return low_noise_render; | 309 return low_noise_render; |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace webrtc | 312 } // namespace webrtc |
| OLD | NEW |