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 #include "webrtc/modules/audio_processing/aec3/power_echo_model.h" | 10 #include "webrtc/modules/audio_processing/aec3/power_echo_model.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 void RecentMaximum(const FftBuffer& X_buffer, | 21 void RecentMaximum(const FftBuffer& X_buffer, |
22 std::array<float, kFftLengthBy2Plus1>* R2) { | 22 std::array<float, kFftLengthBy2Plus1>* R2) { |
23 R2->fill(0.f); | 23 R2->fill(0.f); |
24 for (size_t j = 0; j < 20; ++j) { | 24 for (size_t j = 0; j < 20; ++j) { |
25 std::transform(R2->begin(), R2->end(), X_buffer.Spectrum(j).begin(), | 25 std::transform(R2->begin(), R2->end(), X_buffer.Spectrum(j).begin(), |
26 R2->begin(), | 26 R2->begin(), |
27 [](float a, float b) { return std::max(a, b); }); | 27 [](float a, float b) { return std::max(a, b); }); |
28 } | 28 } |
29 } | 29 } |
30 | 30 |
31 constexpr float kHInitial = 10.f; | 31 constexpr float kHInitial = 100.f; |
peah-webrtc
2017/02/27 14:26:03
An echo path can often have a gain of 20 dB so 10
| |
32 constexpr int kUpdateCounterInitial = 300; | 32 constexpr int kUpdateCounterInitial = 300; |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 PowerEchoModel::PowerEchoModel() { | 36 PowerEchoModel::PowerEchoModel() { |
37 H2_.fill(CountedFloat(kHInitial, kUpdateCounterInitial)); | 37 H2_.fill(CountedFloat(kHInitial, kUpdateCounterInitial)); |
38 } | 38 } |
39 | 39 |
40 PowerEchoModel::~PowerEchoModel() = default; | 40 PowerEchoModel::~PowerEchoModel() = default; |
41 | 41 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 std::transform(new_H2.begin(), new_H2.end(), H2_.begin(), H2_.begin(), | 102 std::transform(new_H2.begin(), new_H2.end(), H2_.begin(), H2_.begin(), |
103 H2_updater); | 103 H2_updater); |
104 } | 104 } |
105 | 105 |
106 // S2 = H2*X2_active. | 106 // S2 = H2*X2_active. |
107 std::transform(H2_.begin(), H2_.end(), X2_active.begin(), S2->begin(), | 107 std::transform(H2_.begin(), H2_.end(), X2_active.begin(), S2->begin(), |
108 [](CountedFloat a, float b) { return a.value * b; }); | 108 [](CountedFloat a, float b) { return a.value * b; }); |
109 } | 109 } |
110 | 110 |
111 } // namespace webrtc | 111 } // namespace webrtc |
OLD | NEW |