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

Side by Side Diff: webrtc/modules/audio_processing/aec3/aec_state.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_AEC_STATE_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_
13
14 #include <algorithm>
15 #include <vector>
16
17 #include "webrtc/base/array_view.h"
18 #include "webrtc/base/constructormagic.h"
19 #include "webrtc/base/optional.h"
ivoc 2017/02/10 13:52:33 I don't think Optional is used in this header.
peah-webrtc 2017/02/20 07:37:15 You are right. But I have now changed it, so it is
ivoc 2017/02/21 17:26:00 Acknowledged.
peah-webrtc 2017/02/21 23:00:39 Acknowledged.
20 #include "webrtc/modules/audio_processing/aec3/aec3_constants.h"
21 #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h"
22 #include "webrtc/modules/audio_processing/aec3/delay_handler.h"
23 #include "webrtc/modules/audio_processing/aec3/erle_estimator.h"
24 #include "webrtc/modules/audio_processing/aec3/erl_estimator.h"
25 #include "webrtc/modules/audio_processing/aec3/fft_buffer.h"
26 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
ivoc 2017/02/10 13:52:33 Is this needed?
peah-webrtc 2017/02/20 07:37:15 Done.
27
28 namespace webrtc {
29
30 // Handles the state and the conditions for the echo removal functionality.
31 class AecState {
32 public:
33 AecState();
34 ~AecState();
35
36 // Returns whether the linear filter estimate is usable.
37 bool UsableLinearEstimate() const { return usable_linear_estimate_; }
38
39 // Returns whether there has been echo leakage detected.
40 bool EchoLeakageDetected() const { return echo_leakage_detected_; }
41
42 // Returns whether it is possible at all to use the model based echo removal
43 // functionalities.
44 bool ModelBasedAecFeasible() const { return model_based_aec_feasible_; }
45
46 // Returns whether the render signal is currently active.
47 bool ActiveRender() const { return active_render_counter_ > 0; }
48
49 // Returns the ERLE.
50 const std::array<float, kFftLengthBy2Plus1>& Erle() const {
51 return erle_estimator_.Erle();
52 }
53
54 // Returns the ERL.
55 const std::array<float, kFftLengthBy2Plus1>& Erl() const {
56 return erl_estimator_.Erl();
57 }
58
59 // Returns the bands where the linear filter is reliable.
60 const std::array<bool, kFftLengthBy2Plus1>& BandsWithReliableFilter() const {
61 return bands_with_reliable_filter_;
62 }
63
64 // Updates the aec state.
65 void Update(const FftBuffer& X_buffer,
66 const std::array<float, kFftLengthBy2Plus1>& E2_main,
67 const std::array<float, kFftLengthBy2Plus1>& E2_shadow,
68 const std::array<float, kFftLengthBy2Plus1>& Y2,
69 rtc::ArrayView<const float> x,
70 const DelayHandler& delay_handler,
71 const EchoPathVariability& echo_path_variability,
72 bool echo_leakage_detected);
73
74 private:
75 ErlEstimator erl_estimator_;
76 ErleEstimator erle_estimator_;
77 std::array<bool, kFftLengthBy2Plus1> bands_with_reliable_filter_;
78 int echo_path_change_counter_;
79 int active_render_counter_;
80 bool usable_linear_estimate_ = false;
81 bool echo_leakage_detected_ = false;
82 bool model_based_aec_feasible_ = false;
83
84 RTC_DISALLOW_COPY_AND_ASSIGN(AecState);
85 };
86
87 } // namespace webrtc
88
89 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698