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

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

Issue 2678423005: Finalization of the first version of EchoCanceller 3 (Closed)
Patch Set: 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 <stdio.h>
15 #include <algorithm>
16 #include <memory>
17 #include <vector>
18
aleloi 2017/02/13 16:44:51 stdio, memory not needed, <array> missing.
peah-webrtc 2017/02/20 07:37:19 Done.
19 #include "webrtc/base/constructormagic.h"
20 #include "webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h"
21 #include "webrtc/modules/audio_processing/aec3/aec3_constants.h"
22 #include "webrtc/modules/audio_processing/aec3/aec3_fft.h"
23 #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h"
24 #include "webrtc/modules/audio_processing/aec3/fft_buffer.h"
25 #include "webrtc/modules/audio_processing/aec3/main_filter_update_gain.h"
26 #include "webrtc/modules/audio_processing/aec3/shadow_filter_update_gain.h"
27 #include "webrtc/modules/audio_processing/aec3/subtractor_output.h"
28 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
29 #include "webrtc/modules/audio_processing/utility/ooura_fft.h"
30
31 namespace webrtc {
32
33 // Proves linear echo cancellation functionality
34 class Subtractor {
35 public:
36 explicit Subtractor(ApmDataDumper* data_dumper);
37 ~Subtractor();
38
39 // Performs the echo subtraction.
40 void Process(const FftBuffer& render_buffer,
41 const rtc::ArrayView<const float> capture,
42 const RenderSignalAnalyzer& render_signal_analyzer,
43 bool saturation,
44 SubtractorOutput* output);
45
46 // Returns a vector with the number of blocks included in the render buffer
47 // sums.
48 std::vector<size_t> NumBlocksInRenderSums() const;
aleloi 2017/02/13 16:44:51 This could probably be a constexpr function if the
peah-webrtc 2017/02/20 07:37:19 That makes sense. This should be changed, but I pr
aleloi 2017/02/23 15:16:00 sgtm
49
50 // Returns the minimum required farend buffer length.
51 size_t MinFarendBufferLength() const {
52 return std::max(kMainFilterLength, kShadowFilterLength);
aleloi 2017/02/13 16:44:51 Can be a constexpr function if the constants are c
peah-webrtc 2017/02/20 07:37:19 Not fully sure how I can make the constants conste
hlundin-webrtc 2017/02/22 21:17:28 You will have to make them static constexpr. Then
aleloi 2017/02/23 15:16:00 Acknowledged.
53 }
54
55 void HandleEchoPathChange(const EchoPathVariability& echo_path_variability);
56
57 // Returns the block-wise frequency response of the main adaptive filter.
58 const std::vector<std::array<float, kFftLengthBy2Plus1>>&
59 FilterFrequencyResponse() const {
60 return main_filter_.FilterFrequencyResponse();
61 }
62
63 private:
64 const size_t kMainFilterLength = 12;
65 const size_t kShadowFilterLength = 12;
aleloi 2017/02/13 16:44:51 constexpr.
peah-webrtc 2017/02/20 07:37:19 See above.
66
67 const Aec3Fft fft_;
68 ApmDataDumper* data_dumper_;
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