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_SUBTRACTOR_H_ | |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_SUBTRACTOR_H_ | |
13 | |
14 #include <array> | |
15 #include <algorithm> | |
16 #include <vector> | |
17 | |
18 #include "webrtc/base/constructormagic.h" | |
19 #include "webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h" | |
20 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | |
21 #include "webrtc/modules/audio_processing/aec3/aec3_fft.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/aec3/main_filter_update_gain.h" | |
25 #include "webrtc/modules/audio_processing/aec3/shadow_filter_update_gain.h" | |
26 #include "webrtc/modules/audio_processing/aec3/subtractor_output.h" | |
27 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" | |
28 #include "webrtc/modules/audio_processing/utility/ooura_fft.h" | |
29 | |
30 namespace webrtc { | |
31 | |
32 // Proves linear echo cancellation functionality | |
33 class Subtractor { | |
34 public: | |
35 Subtractor(ApmDataDumper* data_dumper, Aec3Optimization optimization); | |
36 ~Subtractor(); | |
37 | |
38 // Performs the echo subtraction. | |
39 void Process(const FftBuffer& render_buffer, | |
40 const rtc::ArrayView<const float> capture, | |
41 const RenderSignalAnalyzer& render_signal_analyzer, | |
42 bool saturation, | |
43 SubtractorOutput* output); | |
44 | |
45 // Returns a vector with the number of blocks included in the render buffer | |
46 // sums. | |
47 std::vector<size_t> NumBlocksInRenderSums() const; | |
48 | |
49 // Returns the minimum required farend buffer length. | |
50 size_t MinFarendBufferLength() const { | |
51 return std::max(kMainFilterLength, kShadowFilterLength); | |
52 } | |
53 | |
54 void HandleEchoPathChange(const EchoPathVariability& echo_path_variability); | |
55 | |
56 // Returns the block-wise frequency response of the main adaptive filter. | |
57 const std::vector<std::array<float, kFftLengthBy2Plus1>>& | |
58 FilterFrequencyResponse() const { | |
59 return main_filter_.FilterFrequencyResponse(); | |
60 } | |
61 | |
62 private: | |
63 const size_t kMainFilterLength = 12; | |
aleloi
2017/02/22 16:20:31
Please change to constexpr.
aleloi
2017/02/22 16:20:31
The constant is called 'filter length' here, but '
hlundin-webrtc
2017/02/22 21:17:29
static constexpr
peah-webrtc
2017/02/22 23:51:39
I cannot get that to work as I get linker errors.
peah-webrtc
2017/02/22 23:51:39
I cannot get that to work as I get linker errors.
peah-webrtc
2017/02/22 23:51:40
Good point!
Done.
hlundin-webrtc
2017/02/23 07:42:09
Keep it as it is now, but I wonder if the reason i
peah-webrtc
2017/02/23 11:18:32
Acknowledged.
| |
64 const size_t kShadowFilterLength = 12; | |
aleloi
2017/02/22 16:20:31
Same here
peah-webrtc
2017/02/22 23:51:40
Done.
| |
65 | |
66 const Aec3Fft fft_; | |
67 ApmDataDumper* data_dumper_; | |
68 const Aec3Optimization optimization_; | |
69 AdaptiveFirFilter main_filter_; | |
70 AdaptiveFirFilter shadow_filter_; | |
71 MainFilterUpdateGain G_main_; | |
72 ShadowFilterUpdateGain G_shadow_; | |
73 | |
74 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Subtractor); | |
75 }; | |
76 | |
77 } // namespace webrtc | |
78 | |
79 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_SUBTRACTOR_H_ | |
OLD | NEW |