av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,

                                                    enum IIRFilterMode filt_mode,

                                                    int order, float cutoff_ratio,

                                                    float stopband, float ripple)

{

    int i, j;

    FFIIRFilterCoeffs *c;

    double wa;

    double p[MAXORDER + 1][2];



    if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)

        return NULL;

    if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)

        return NULL;



    c = av_malloc(sizeof(FFIIRFilterCoeffs));

    c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));

    c->cy = av_malloc(sizeof(c->cy[0]) * order);

    c->order = order;



    wa = 2 * tan(M_PI * 0.5 * cutoff_ratio);



    c->cx[0] = 1;

    for(i = 1; i < (order >> 1) + 1; i++)

        c->cx[i] = c->cx[i - 1] * (order - i + 1LL) / i;



    p[0][0] = 1.0;

    p[0][1] = 0.0;

    for(i = 1; i <= order; i++)

        p[i][0] = p[i][1] = 0.0;

    for(i = 0; i < order; i++){

        double zp[2];

        double th = (i + (order >> 1) + 0.5) * M_PI / order;

        double a_re, a_im, c_re, c_im;

        zp[0] = cos(th) * wa;

        zp[1] = sin(th) * wa;

        a_re = zp[0] + 2.0;

        c_re = zp[0] - 2.0;

        a_im =

        c_im = zp[1];

        zp[0] = (a_re * c_re + a_im * c_im) / (c_re * c_re + c_im * c_im);

        zp[1] = (a_im * c_re - a_re * c_im) / (c_re * c_re + c_im * c_im);



        for(j = order; j >= 1; j--)

        {

            a_re = p[j][0];

            a_im = p[j][1];

            p[j][0] = a_re*zp[0] - a_im*zp[1] + p[j-1][0];

            p[j][1] = a_re*zp[1] + a_im*zp[0] + p[j-1][1];

        }

        a_re    = p[0][0]*zp[0] - p[0][1]*zp[1];

        p[0][1] = p[0][0]*zp[1] + p[0][1]*zp[0];

        p[0][0] = a_re;

    }

    c->gain = p[order][0];

    for(i = 0; i < order; i++){

        c->gain += p[i][0];

        c->cy[i] = (-p[i][0] * p[order][0] + -p[i][1] * p[order][1]) /

                   (p[order][0] * p[order][0] + p[order][1] * p[order][1]);

    }

    c->gain /= 1 << order;



    return c;

}

av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,

                                                    enum IIRFilterMode filt_mode,

                                                    int order, float cutoff_ratio,

                                                    float stopband, float ripple)

{

    int i, j;

    FFIIRFilterCoeffs *c;

    double wa;

    double p[MAXORDER + 1][2];



    if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)

        return NULL;

    if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)

        return NULL;



    c = av_malloc(sizeof(FFIIRFilterCoeffs));

    c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));

    c->cy = av_malloc(sizeof(c->cy[0]) * order);

    c->order = order;



    wa = 2 * tan(M_PI * 0.5 * cutoff_ratio);



    c->cx[0] = 1;

    for(i = 1; i < (order >> 1) + 1; i++)

        c->cx[i] = c->cx[i - 1] * (order - i + 1LL) / i;



    p[0][0] = 1.0;

    p[0][1] = 0.0;

    for(i = 1; i <= order; i++)

        p[i][0] = p[i][1] = 0.0;

    for(i = 0; i < order; i++){

        double zp[2];

        double th = (i + (order >> 1) + 0.5) * M_PI / order;

        double a_re, a_im, c_re, c_im;

        zp[0] = cos(th) * wa;

        zp[1] = sin(th) * wa;

        a_re = zp[0] + 2.0;

        c_re = zp[0] - 2.0;

        a_im =

        c_im = zp[1];

        zp[0] = (a_re * c_re + a_im * c_im) / (c_re * c_re + c_im * c_im);

        zp[1] = (a_im * c_re - a_re * c_im) / (c_re * c_re + c_im * c_im);



        for(j = order; j >= 1; j--)

        {

            a_re = p[j][0];

            a_im = p[j][1];

            p[j][0] = a_re*zp[0] - a_im*zp[1] + p[j-1][0];

            p[j][1] = a_re*zp[1] + a_im*zp[0] + p[j-1][1];

        }

        a_re    = p[0][0]*zp[0] - p[0][1]*zp[1];

        p[0][1] = p[0][0]*zp[1] + p[0][1]*zp[0];

        p[0][0] = a_re;

    }

    c->gain = p[order][0];

    for(i = 0; i < order; i++){

        c->gain += p[i][0];

        c->cy[i] = (-p[i][0] * p[order][0] + -p[i][1] * p[order][1]) /

                   (p[order][0] * p[order][0] + p[order][1] * p[order][1]);

    }

    c->gain /= 1 << order;



    return c;

}

av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,     c = av_malloc(sizeof(FFIIRFilterCoeffs));     c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));     c->cy = av_malloc(sizeof(c->cy[0]) * order);
av_cold struct FFIIRFilterCoeffs* FUNC_0(enum IIRFilterType filt_type,

                                                    enum IIRFilterMode filt_mode,

                                                    int order, float cutoff_ratio,

                                                    float stopband, float ripple)

{

    int VAR_0, VAR_1;

    FFIIRFilterCoeffs *VAR_2;

    double VAR_3;

    double VAR_4[MAXORDER + 1][2];



    if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)

        return NULL;

    if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)

        return NULL;



    VAR_2 = av_malloc(sizeof(FFIIRFilterCoeffs));

    VAR_2->cx = av_malloc(sizeof(VAR_2->cx[0]) * ((order >> 1) + 1));

    VAR_2->cy = av_malloc(sizeof(VAR_2->cy[0]) * order);

    VAR_2->order = order;



    VAR_3 = 2 * tan(M_PI * 0.5 * cutoff_ratio);



    VAR_2->cx[0] = 1;

    for(VAR_0 = 1; VAR_0 < (order >> 1) + 1; VAR_0++)

        VAR_2->cx[VAR_0] = VAR_2->cx[VAR_0 - 1] * (order - VAR_0 + 1LL) / VAR_0;



    VAR_4[0][0] = 1.0;

    VAR_4[0][1] = 0.0;

    for(VAR_0 = 1; VAR_0 <= order; VAR_0++)

        VAR_4[VAR_0][0] = VAR_4[VAR_0][1] = 0.0;

    for(VAR_0 = 0; VAR_0 < order; VAR_0++){

        double VAR_5[2];

        double VAR_6 = (VAR_0 + (order >> 1) + 0.5) * M_PI / order;

        double VAR_7, VAR_8, VAR_9, VAR_10;

        VAR_5[0] = cos(VAR_6) * VAR_3;

        VAR_5[1] = sin(VAR_6) * VAR_3;

        VAR_7 = VAR_5[0] + 2.0;

        VAR_9 = VAR_5[0] - 2.0;

        VAR_8 =

        VAR_10 = VAR_5[1];

        VAR_5[0] = (VAR_7 * VAR_9 + VAR_8 * VAR_10) / (VAR_9 * VAR_9 + VAR_10 * VAR_10);

        VAR_5[1] = (VAR_8 * VAR_9 - VAR_7 * VAR_10) / (VAR_9 * VAR_9 + VAR_10 * VAR_10);



        for(VAR_1 = order; VAR_1 >= 1; VAR_1--)

        {

            VAR_7 = VAR_4[VAR_1][0];

            VAR_8 = VAR_4[VAR_1][1];

            VAR_4[VAR_1][0] = VAR_7*VAR_5[0] - VAR_8*VAR_5[1] + VAR_4[VAR_1-1][0];

            VAR_4[VAR_1][1] = VAR_7*VAR_5[1] + VAR_8*VAR_5[0] + VAR_4[VAR_1-1][1];

        }

        VAR_7    = VAR_4[0][0]*VAR_5[0] - VAR_4[0][1]*VAR_5[1];

        VAR_4[0][1] = VAR_4[0][0]*VAR_5[1] + VAR_4[0][1]*VAR_5[0];

        VAR_4[0][0] = VAR_7;

    }

    VAR_2->gain = VAR_4[order][0];

    for(VAR_0 = 0; VAR_0 < order; VAR_0++){

        VAR_2->gain += VAR_4[VAR_0][0];

        VAR_2->cy[VAR_0] = (-VAR_4[VAR_0][0] * VAR_4[order][0] + -VAR_4[VAR_0][1] * VAR_4[order][1]) /

                   (VAR_4[order][0] * VAR_4[order][0] + VAR_4[order][1] * VAR_4[order][1]);

    }

    VAR_2->gain /= 1 << order;



    return VAR_2;

}

av_cold struct FFIIRFilterCoeffs* FUNC_0(enum IIRFilterType filt_type,
enum IIRFilterMode filt_mode,
int order, float cutoff_ratio,
float stopband, float ripple)
{ int VAR_0, VAR_1; FFIIRFilterCoeffs *VAR_2; double VAR_3; double VAR_4[MAXORDER + 1][2]; if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
return NULL; if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)
return NULL; VAR_2 = av_malloc(sizeof(FFIIRFilterCoeffs)); VAR_2->cx = av_malloc(sizeof(VAR_2->cx[0]) * ((order >> 1) + 1)); VAR_2->cy = av_malloc(sizeof(VAR_2->cy[0]) * order); VAR_2->order = order; VAR_3 = 2 * tan(M_PI * 0.5 * cutoff_ratio); VAR_2->cx[0] = 1; for(VAR_0 = 1; VAR_0 < (order >> 1) + 1; VAR_0++) VAR_2->cx[VAR_0] = VAR_2->cx[VAR_0 - 1] * (order - VAR_0 + 1LL) / VAR_0; VAR_4[0][0] = 1.0; VAR_4[0][1] = 0.0; for(VAR_0 = 1; VAR_0 <= order; VAR_0++) VAR_4[VAR_0][0] = VAR_4[VAR_0][1] = 0.0; for(VAR_0 = 0; VAR_0 < order; VAR_0++){ double VAR_5[2]; double VAR_6 = (VAR_0 + (order >> 1) + 0.5) * M_PI / order; double VAR_7, VAR_8, VAR_9, VAR_10; VAR_5[0] = cos(VAR_6) * VAR_3; VAR_5[1] = sin(VAR_6) * VAR_3; VAR_7 = VAR_5[0] + 2.0; VAR_9 = VAR_5[0] - 2.0; VAR_8 =
VAR_10 = VAR_5[1]; VAR_5[0] = (VAR_7 * VAR_9 + VAR_8 * VAR_10) / (VAR_9 * VAR_9 + VAR_10 * VAR_10); VAR_5[1] = (VAR_8 * VAR_9 - VAR_7 * VAR_10) / (VAR_9 * VAR_9 + VAR_10 * VAR_10); for(VAR_1 = order; VAR_1 >= 1; VAR_1--) { VAR_7 = VAR_4[VAR_1][0]; VAR_8 = VAR_4[VAR_1][1]; VAR_4[VAR_1][0] = VAR_7*VAR_5[0] - VAR_8*VAR_5[1] + VAR_4[VAR_1-1][0]; VAR_4[VAR_1][1] = VAR_7*VAR_5[1] + VAR_8*VAR_5[0] + VAR_4[VAR_1-1][1]; } VAR_7    = VAR_4[0][0]*VAR_5[0] - VAR_4[0][1]*VAR_5[1]; VAR_4[0][1] = VAR_4[0][0]*VAR_5[1] + VAR_4[0][1]*VAR_5[0]; VAR_4[0][0] = VAR_7; } VAR_2->gain = VAR_4[order][0]; for(VAR_0 = 0; VAR_0 < order; VAR_0++){ VAR_2->gain += VAR_4[VAR_0][0]; VAR_2->cy[VAR_0] = (-VAR_4[VAR_0][0] * VAR_4[order][0] + -VAR_4[VAR_0][1] * VAR_4[order][1]) /
(VAR_4[order][0] * VAR_4[order][0] + VAR_4[order][1] * VAR_4[order][1]); } VAR_2->gain /= 1 << order; return VAR_2; }