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

Unified Diff: webrtc/modules/audio_processing/aec3/aec_state.h

Issue 2974583004: Transparency improvements in the echo canceller 3 (Closed)
Patch Set: Corrected wrong echo estimate vector in unittest Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/aec3/aec_state.h
diff --git a/webrtc/modules/audio_processing/aec3/aec_state.h b/webrtc/modules/audio_processing/aec3/aec_state.h
index 1b00bf55ff4f3f0a15e5e4cc58f81c9f3a560c4a..5192a929c66d26903b14388aeb556001eb62d57c 100644
--- a/webrtc/modules/audio_processing/aec3/aec_state.h
+++ b/webrtc/modules/audio_processing/aec3/aec_state.h
@@ -31,7 +31,7 @@ class ApmDataDumper;
// Handles the state and the conditions for the echo removal functionality.
class AecState {
public:
- explicit AecState(float echo_decay);
+ explicit AecState(float reverb_decay);
~AecState();
// Returns whether the linear filter estimate is usable.
@@ -78,23 +78,50 @@ class AecState {
void HandleEchoPathChange(const EchoPathVariability& echo_path_variability);
// Returns the decay factor for the echo reverberation.
- // TODO(peah): Make this adaptive.
- float ReverbDecayFactor() const { return echo_decay_factor_; }
+ float ReverbDecay() const { return reverb_decay_; }
// Returns whether the echo suppression gain should be forced to zero.
bool ForcedZeroGain() const { return force_zero_gain_; }
+ // Returns whether the echo in the capture signal is audible.
+ bool InaudibleEcho() const { return echo_audibility_.InaudibleEcho(); }
+
+ // Updates the aec state with the AEC output signal.
+ void UpdateWithOutput(rtc::ArrayView<const float> e) {
+ echo_audibility_.UpdateWithOutput(e);
+ }
+
// Updates the aec state.
void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
adaptive_filter_frequency_response,
+ const std::array<float, kAdaptiveFilterTimeDomainLength>&
+ adaptive_filter_impulse_response,
const rtc::Optional<size_t>& external_delay_samples,
const RenderBuffer& render_buffer,
const std::array<float, kFftLengthBy2Plus1>& E2_main,
const std::array<float, kFftLengthBy2Plus1>& Y2,
rtc::ArrayView<const float> x,
+ const std::array<float, kBlockSize>& s_main,
bool echo_leakage_detected);
private:
+ class EchoAudibility {
+ public:
+ void Update(rtc::ArrayView<const float> x,
+ const std::array<float, kBlockSize>& s);
+ void UpdateWithOutput(rtc::ArrayView<const float> e);
+ bool InaudibleEcho() const { return inaudible_echo_; }
+
+ private:
+ float max_nearend_ = 0.f;
+ size_t max_nearend_counter_ = 0;
+ size_t low_farend_counter_ = 0;
+ bool inaudible_echo_ = false;
+ };
+
+ void UpdateReverb(const std::array<float, kAdaptiveFilterTimeDomainLength>&
+ impulse_response);
+
static int instance_count_;
std::unique_ptr<ApmDataDumper> data_dumper_;
ErlEstimator erl_estimator_;
@@ -113,7 +140,12 @@ class AecState {
rtc::Optional<size_t> filter_delay_;
rtc::Optional<size_t> external_delay_;
size_t blocks_since_last_saturation_ = 1000;
- const float echo_decay_factor_;
+ float reverb_decay_;
+ float reverb_decay_to_test_ = 0.9f;
+ float reverb_decay_candidate_ = 0.f;
+ float reverb_decay_candidate_residual_ = -1.f;
+ EchoAudibility echo_audibility_;
+
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AecState);
};
« no previous file with comments | « webrtc/modules/audio_processing/aec3/aec3_common.h ('k') | webrtc/modules/audio_processing/aec3/aec_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698