예제 #1
0
static double output_gain(double lin_slope, double ratio, double thres,
                          double knee, double knee_start, double knee_stop,
                          double compressed_knee_stop, int detection)
{
    double slope = log(lin_slope);
    double gain = 0.0;
    double delta = 0.0;

    if (detection)
        slope *= 0.5;

    if (IS_FAKE_INFINITY(ratio)) {
        gain = thres;
        delta = 0.0;
    } else {
        gain = (slope - thres) / ratio + thres;
        delta = 1.0 / ratio;
    }

    if (knee > 1.0 && slope < knee_stop)
        gain = hermite_interpolation(slope, knee_start, knee_stop,
                                     knee_start, compressed_knee_stop,
                                     1.0, delta);

    return exp(gain - slope);
}
예제 #2
0
파일: af_agate.c 프로젝트: WXB506/FFmpeg
static double output_gain(double lin_slope, double ratio, double thres,
                          double knee, double knee_start, double knee_stop,
                          double lin_knee_stop, double range)
{
    if (lin_slope < lin_knee_stop) {
        double slope = log(lin_slope);
        double tratio = ratio;
        double gain = 0.;
        double delta = 0.;

        if (IS_FAKE_INFINITY(ratio))
            tratio = 1000.;
        gain = (slope - thres) * tratio + thres;
        delta = tratio;

        if (knee > 1. && slope > knee_start) {
            gain = hermite_interpolation(slope, knee_start, knee_stop, ((knee_start - thres) * tratio  + thres), knee_stop, delta, 1.);
        }
        return FFMAX(range, exp(gain - slope));
    }

    return 1.;
}