#include "modules/audio_processing/aec3/residual_echo_estimator.h"
#include <stddef.h>
#include <algorithm>
#include <vector>
#include "api/array_view.h"
#include "modules/audio_processing/aec3/reverb_model.h"
#include "rtc_base/checks.h"
#include "system_wrappers/include/field_trial.h"
namespace webrtc {
namespace {
constexpr float kDefaultTransparentModeGain = …;
float GetTransparentModeGain() { … }
float GetEarlyReflectionsDefaultModeGain(
const EchoCanceller3Config::EpStrength& config) { … }
float GetLateReflectionsDefaultModeGain(
const EchoCanceller3Config::EpStrength& config) { … }
bool UseErleOnsetCompensationInDominantNearend(
const EchoCanceller3Config::EpStrength& config) { … }
void GetRenderIndexesToAnalyze(
const SpectrumBuffer& spectrum_buffer,
const EchoCanceller3Config::EchoModel& echo_model,
int filter_delay_blocks,
int* idx_start,
int* idx_stop) { … }
void LinearEstimate(
rtc::ArrayView<const std::array<float, kFftLengthBy2Plus1>> S2_linear,
rtc::ArrayView<const std::array<float, kFftLengthBy2Plus1>> erle,
rtc::ArrayView<std::array<float, kFftLengthBy2Plus1>> R2) { … }
void NonLinearEstimate(
float echo_path_gain,
const std::array<float, kFftLengthBy2Plus1>& X2,
rtc::ArrayView<std::array<float, kFftLengthBy2Plus1>> R2) { … }
void ApplyNoiseGate(const EchoCanceller3Config::EchoModel& config,
rtc::ArrayView<float, kFftLengthBy2Plus1> X2) { … }
void EchoGeneratingPower(size_t num_render_channels,
const SpectrumBuffer& spectrum_buffer,
const EchoCanceller3Config::EchoModel& echo_model,
int filter_delay_blocks,
rtc::ArrayView<float, kFftLengthBy2Plus1> X2) { … }
}
ResidualEchoEstimator::ResidualEchoEstimator(const EchoCanceller3Config& config,
size_t num_render_channels)
: … { … }
ResidualEchoEstimator::~ResidualEchoEstimator() = default;
void ResidualEchoEstimator::Estimate(
const AecState& aec_state,
const RenderBuffer& render_buffer,
rtc::ArrayView<const std::array<float, kFftLengthBy2Plus1>> S2_linear,
rtc::ArrayView<const std::array<float, kFftLengthBy2Plus1>> Y2,
bool dominant_nearend,
rtc::ArrayView<std::array<float, kFftLengthBy2Plus1>> R2,
rtc::ArrayView<std::array<float, kFftLengthBy2Plus1>> R2_unbounded) { … }
void ResidualEchoEstimator::Reset() { … }
void ResidualEchoEstimator::UpdateRenderNoisePower(
const RenderBuffer& render_buffer) { … }
void ResidualEchoEstimator::UpdateReverb(ReverbType reverb_type,
const AecState& aec_state,
const RenderBuffer& render_buffer,
bool dominant_nearend) { … }
void ResidualEchoEstimator::AddReverb(
rtc::ArrayView<std::array<float, kFftLengthBy2Plus1>> R2) const { … }
float ResidualEchoEstimator::GetEchoPathGain(
const AecState& aec_state,
bool gain_for_early_reflections) const { … }
}