Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: webrtc/modules/audio_processing/aec3/subtractor.h

Issue 2678423005: Finalization of the first version of EchoCanceller 3 (Closed)
Patch Set: Fixed compilation error Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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(kMainFilterSizePartitions, kShadowFilterSizePartitions);
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 kMainFilterSizePartitions = 12;
aleloi 2017/02/23 15:16:01 Here's how to make it constexpr: * declare/define
64 const size_t kShadowFilterSizePartitions = 12;
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698