#include "modules/audio_processing/agc2/limiter.h"
#include <algorithm>
#include <array>
#include <cmath>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "modules/audio_processing/agc2/agc2_common.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/checks.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/numerics/safe_minmax.h"
namespace webrtc {
namespace {
constexpr float kAttackFirstSubframeInterpolationPower = …;
void InterpolateFirstSubframe(float last_factor,
float current_factor,
rtc::ArrayView<float> subframe) { … }
void ComputePerSampleSubframeFactors(
const std::array<float, kSubFramesInFrame + 1>& scaling_factors,
MonoView<float> per_sample_scaling_factors) { … }
void ScaleSamples(MonoView<const float> per_sample_scaling_factors,
DeinterleavedView<float> signal) { … }
}
Limiter::Limiter(ApmDataDumper* apm_data_dumper,
size_t samples_per_channel,
absl::string_view histogram_name)
: … { … }
Limiter::~Limiter() = default;
void Limiter::Process(DeinterleavedView<float> signal) { … }
InterpolatedGainCurve::Stats Limiter::GetGainCurveStats() const { … }
void Limiter::SetSamplesPerChannel(size_t samples_per_channel) { … }
void Limiter::Reset() { … }
float Limiter::LastAudioLevel() const { … }
}