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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_SUPPRESSION_GAIN_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_SUPPRESSION_GAIN_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_SUPPRESSION_GAIN_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_SUPPRESSION_GAIN_H_ |
13 | 13 |
14 #include <array> | 14 #include <array> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
18 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | 18 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 namespace aec3 { | |
22 #if defined(WEBRTC_ARCH_X86_FAMILY) | |
23 | |
24 void ComputeGains_SSE2( | |
25 const std::array<float, kFftLengthBy2Plus1>& nearend_power, | |
26 const std::array<float, kFftLengthBy2Plus1>& residual_echo_power, | |
27 const std::array<float, kFftLengthBy2Plus1>& comfort_noise_power, | |
28 float strong_nearend_margin, | |
29 std::array<float, kFftLengthBy2 - 1>* previous_gain_squared, | |
30 std::array<float, kFftLengthBy2 - 1>* previous_masker, | |
31 std::array<float, kFftLengthBy2Plus1>* gain); | |
32 | |
33 #endif | |
34 | |
35 void ComputeGains( | |
36 const std::array<float, kFftLengthBy2Plus1>& nearend_power, | |
37 const std::array<float, kFftLengthBy2Plus1>& residual_echo_power, | |
38 const std::array<float, kFftLengthBy2Plus1>& comfort_noise_power, | |
39 float strong_nearend_margin, | |
40 std::array<float, kFftLengthBy2 - 1>* previous_gain_squared, | |
41 std::array<float, kFftLengthBy2 - 1>* previous_masker, | |
42 std::array<float, kFftLengthBy2Plus1>* gain); | |
43 | |
44 } // namespace aec3 | |
45 | 21 |
46 class SuppressionGain { | 22 class SuppressionGain { |
47 public: | 23 public: |
48 explicit SuppressionGain(Aec3Optimization optimization); | 24 explicit SuppressionGain(Aec3Optimization optimization); |
49 void GetGain(const std::array<float, kFftLengthBy2Plus1>& nearend_power, | 25 void GetGain(const std::array<float, kFftLengthBy2Plus1>& nearend_power, |
50 const std::array<float, kFftLengthBy2Plus1>& residual_echo_power, | 26 const std::array<float, kFftLengthBy2Plus1>& residual_echo_power, |
51 const std::array<float, kFftLengthBy2Plus1>& comfort_noise_power, | 27 const std::array<float, kFftLengthBy2Plus1>& comfort_noise_power, |
52 bool saturated_echo, | 28 bool saturated_echo, |
53 const std::vector<std::vector<float>>& render, | 29 const std::vector<std::vector<float>>& render, |
54 size_t num_capture_bands, | 30 size_t num_capture_bands, |
55 bool force_zero_gain, | 31 bool force_zero_gain, |
56 float* high_bands_gain, | 32 float* high_bands_gain, |
57 std::array<float, kFftLengthBy2Plus1>* low_band_gain); | 33 std::array<float, kFftLengthBy2Plus1>* low_band_gain); |
58 | 34 |
59 private: | 35 private: |
60 const Aec3Optimization optimization_; | 36 const Aec3Optimization optimization_; |
61 std::array<float, kFftLengthBy2 - 1> previous_gain_squared_; | 37 std::array<float, kFftLengthBy2 - 1> previous_gain_squared_; |
62 std::array<float, kFftLengthBy2 - 1> previous_masker_; | 38 std::array<float, kFftLengthBy2 - 1> previous_masker_; |
63 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SuppressionGain); | 39 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SuppressionGain); |
64 }; | 40 }; |
65 | 41 |
66 } // namespace webrtc | 42 } // namespace webrtc |
67 | 43 |
68 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_SUPPRESSION_GAIN_H_ | 44 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_SUPPRESSION_GAIN_H_ |
OLD | NEW |