#include "modules/audio_processing/aec3/stationarity_estimator.h"
#include <algorithm>
#include <array>
#include "api/array_view.h"
#include "modules/audio_processing/aec3/aec3_common.h"
#include "modules/audio_processing/aec3/spectrum_buffer.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
namespace webrtc {
namespace {
constexpr float kMinNoisePower = …;
constexpr int kHangoverBlocks = …;
constexpr int kNBlocksAverageInitPhase = …;
constexpr int kNBlocksInitialPhase = …;
}
StationarityEstimator::StationarityEstimator()
: … { … }
StationarityEstimator::~StationarityEstimator() = default;
void StationarityEstimator::Reset() { … }
void StationarityEstimator::UpdateNoiseEstimator(
rtc::ArrayView<const std::array<float, kFftLengthBy2Plus1>> spectrum) { … }
void StationarityEstimator::UpdateStationarityFlags(
const SpectrumBuffer& spectrum_buffer,
rtc::ArrayView<const float> render_reverb_contribution_spectrum,
int idx_current,
int num_lookahead) { … }
bool StationarityEstimator::IsBlockStationary() const { … }
bool StationarityEstimator::EstimateBandStationarity(
const SpectrumBuffer& spectrum_buffer,
rtc::ArrayView<const float> average_reverb,
const std::array<int, kWindowLength>& indexes,
size_t band) const { … }
bool StationarityEstimator::AreAllBandsStationary() { … }
void StationarityEstimator::UpdateHangover() { … }
void StationarityEstimator::SmoothStationaryPerFreq() { … }
std::atomic<int> StationarityEstimator::instance_count_(0);
StationarityEstimator::NoiseSpectrum::NoiseSpectrum() { … }
StationarityEstimator::NoiseSpectrum::~NoiseSpectrum() = default;
void StationarityEstimator::NoiseSpectrum::Reset() { … }
void StationarityEstimator::NoiseSpectrum::Update(
rtc::ArrayView<const std::array<float, kFftLengthBy2Plus1>> spectrum) { … }
float StationarityEstimator::NoiseSpectrum::GetAlpha() const { … }
float StationarityEstimator::NoiseSpectrum::UpdateBandBySmoothing(
float power_band,
float power_band_noise,
float alpha) const { … }
}