#include "modules/audio_processing/aec3/reverb_decay_estimator.h"
#include <stddef.h>
#include <algorithm>
#include <cmath>
#include <numeric>
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/checks.h"
namespace webrtc {
namespace {
constexpr int kEarlyReverbMinSizeBlocks = …;
constexpr int kBlocksPerSection = …;
constexpr float kEarlyReverbFirstPointAtLinearRegressors = …;
float BlockAverage(rtc::ArrayView<const float> v, size_t block_index) { … }
void AnalyzeBlockGain(const std::array<float, kFftLengthBy2>& h2,
float floor_gain,
float* previous_gain,
bool* block_adapting,
bool* decaying_gain) { … }
constexpr float SymmetricArithmetricSum(int N) { … }
float BlockEnergyPeak(rtc::ArrayView<const float> h, int peak_block) { … }
float BlockEnergyAverage(rtc::ArrayView<const float> h, int block_index) { … }
}
ReverbDecayEstimator::ReverbDecayEstimator(const EchoCanceller3Config& config)
: … { … }
ReverbDecayEstimator::~ReverbDecayEstimator() = default;
void ReverbDecayEstimator::Update(rtc::ArrayView<const float> filter,
const absl::optional<float>& filter_quality,
int filter_delay_blocks,
bool usable_linear_filter,
bool stationary_signal) { … }
void ReverbDecayEstimator::ResetDecayEstimation() { … }
void ReverbDecayEstimator::EstimateDecay(rtc::ArrayView<const float> filter,
int peak_block) { … }
void ReverbDecayEstimator::AnalyzeFilter(rtc::ArrayView<const float> filter) { … }
void ReverbDecayEstimator::Dump(ApmDataDumper* data_dumper) const { … }
void ReverbDecayEstimator::LateReverbLinearRegressor::Reset(
int num_data_points) { … }
void ReverbDecayEstimator::LateReverbLinearRegressor::Accumulate(float z) { … }
float ReverbDecayEstimator::LateReverbLinearRegressor::Estimate() { … }
ReverbDecayEstimator::EarlyReverbLengthEstimator::EarlyReverbLengthEstimator(
int max_blocks)
: … { … }
ReverbDecayEstimator::EarlyReverbLengthEstimator::
~EarlyReverbLengthEstimator() = default;
void ReverbDecayEstimator::EarlyReverbLengthEstimator::Reset() { … }
void ReverbDecayEstimator::EarlyReverbLengthEstimator::Accumulate(
float value,
float smoothing) { … }
int ReverbDecayEstimator::EarlyReverbLengthEstimator::Estimate() { … }
void ReverbDecayEstimator::EarlyReverbLengthEstimator::Dump(
ApmDataDumper* data_dumper) const { … }
}