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 #include <string> | |
ivoc
2017/02/21 17:26:01
Can be removed.
peah-webrtc
2017/02/21 23:00:40
Done.
| |
16 #include <vector> | |
ivoc
2017/02/21 17:26:01
Can be removed.
peah-webrtc
2017/02/21 23:00:40
Done.
| |
17 | |
18 #include "webrtc/base/constructormagic.h" | |
19 #include "webrtc/base/optional.h" | |
20 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | |
21 #include "webrtc/modules/audio_processing/aec3/aec_state.h" | |
22 #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h" | |
23 #include "webrtc/modules/audio_processing/aec3/fft_buffer.h" | |
24 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" | |
ivoc
2017/02/21 17:26:01
Can be removed.
peah-webrtc
2017/02/21 23:00:40
Done.
| |
25 | |
26 namespace webrtc { | |
27 | |
28 // Provides an echo model based on power spectral estimates that estimates the | |
29 // echo spectrum. | |
30 class PowerEchoModel { | |
31 public: | |
32 PowerEchoModel(); | |
33 ~PowerEchoModel(); | |
34 | |
35 // Ajusts the model according to echo path changes. | |
36 void HandleEchoPathChange(const EchoPathVariability& variability); | |
37 | |
38 // Updates the echo model and estimates the echo spectrum. | |
39 void EstimateEcho( | |
40 const FftBuffer& render_buffer, | |
41 const std::array<float, kFftLengthBy2Plus1>& capture_spectrum, | |
42 const AecState& aec_state, | |
43 std::array<float, kFftLengthBy2Plus1>* echo_spectrum); | |
44 | |
45 // Returns the minimum required farend buffer length. | |
46 size_t MinFarendBufferLength() const { return kRenderBufferSize; } | |
47 | |
48 private: | |
49 // Provides a float value that is coupled with a counter. | |
50 struct CountedFloat { | |
51 CountedFloat() : value(0.f), counter(0) {} | |
52 CountedFloat(float value, int counter) : value(value), counter(counter) {} | |
53 float value; | |
54 int counter; | |
55 }; | |
56 | |
57 const size_t kRenderBufferSize = 100; | |
58 std::array<CountedFloat, kFftLengthBy2Plus1> H2_; | |
59 | |
60 RTC_DISALLOW_COPY_AND_ASSIGN(PowerEchoModel); | |
61 }; | |
62 } // namespace webrtc | |
63 | |
64 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_POWER_ECHO_MODEL_H_ | |
OLD | NEW |