#include "modules/audio_processing/agc2/limiter_db_gain_curve.h"
#include <cmath>
#include "common_audio/include/audio_util.h"
#include "modules/audio_processing/agc2/agc2_common.h"
#include "rtc_base/checks.h"
namespace webrtc {
namespace {
double ComputeKneeStart(double max_input_level_db,
double knee_smoothness_db,
double compression_ratio) { … }
std::array<double, 3> ComputeKneeRegionPolynomial(double knee_start_dbfs,
double knee_smoothness_db,
double compression_ratio) { … }
double ComputeLimiterD1(double max_input_level_db, double compression_ratio) { … }
constexpr double ComputeLimiterD2(double compression_ratio) { … }
double ComputeLimiterI2(double max_input_level_db,
double compression_ratio,
double gain_curve_limiter_i1) { … }
}
LimiterDbGainCurve::LimiterDbGainCurve()
: … { … }
constexpr double LimiterDbGainCurve::max_input_level_db_;
constexpr double LimiterDbGainCurve::knee_smoothness_db_;
constexpr double LimiterDbGainCurve::compression_ratio_;
double LimiterDbGainCurve::GetOutputLevelDbfs(double input_level_dbfs) const { … }
double LimiterDbGainCurve::GetGainLinear(double input_level_linear) const { … }
double LimiterDbGainCurve::GetGainFirstDerivativeLinear(double x) const { … }
double LimiterDbGainCurve::GetGainIntegralLinear(double x0, double x1) const { … }
double LimiterDbGainCurve::GetKneeRegionOutputLevelDbfs(
double input_level_dbfs) const { … }
double LimiterDbGainCurve::GetCompressorRegionOutputLevelDbfs(
double input_level_dbfs) const { … }
}