OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_POWER_ECHO_MODEL_H_ | |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_POWER_ECHO_MODEL_H_ | |
13 | |
14 #include <array> | |
15 | |
16 #include "webrtc/base/constructormagic.h" | |
17 #include "webrtc/base/optional.h" | |
18 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | |
19 #include "webrtc/modules/audio_processing/aec3/aec_state.h" | |
20 #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h" | |
21 #include "webrtc/modules/audio_processing/aec3/render_buffer.h" | |
22 | |
23 namespace webrtc { | |
24 | |
25 // Provides an echo model based on power spectral estimates that estimates the | |
26 // echo spectrum. | |
27 class PowerEchoModel { | |
28 public: | |
29 PowerEchoModel(); | |
30 ~PowerEchoModel(); | |
31 | |
32 // Ajusts the model according to echo path changes. | |
33 void HandleEchoPathChange(const EchoPathVariability& variability); | |
34 | |
35 // Updates the echo model and estimates the echo spectrum. | |
36 void EstimateEcho( | |
37 const RenderBuffer& render_buffer, | |
38 const std::array<float, kFftLengthBy2Plus1>& capture_spectrum, | |
39 const AecState& aec_state, | |
40 std::array<float, kFftLengthBy2Plus1>* echo_spectrum); | |
41 | |
42 // Returns the minimum required farend buffer length. | |
43 size_t MinFarendBufferLength() const { return kRenderBufferSize; } | |
44 | |
45 private: | |
46 // Provides a float value that is coupled with a counter. | |
47 struct CountedFloat { | |
48 CountedFloat() : value(0.f), counter(0) {} | |
49 CountedFloat(float value, int counter) : value(value), counter(counter) {} | |
50 float value; | |
51 int counter; | |
52 }; | |
53 | |
54 const size_t kRenderBufferSize = 100; | |
55 std::array<CountedFloat, kFftLengthBy2Plus1> H2_; | |
56 | |
57 RTC_DISALLOW_COPY_AND_ASSIGN(PowerEchoModel); | |
58 }; | |
59 } // namespace webrtc | |
60 | |
61 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_POWER_ECHO_MODEL_H_ | |
OLD | NEW |