static void extrapolate_isf(float isf[LP_ORDER_16k])

{

    float diff_isf[LP_ORDER - 2], diff_mean;

    float *diff_hi = diff_isf - LP_ORDER + 1; // diff array for extrapolated indexes

    float corr_lag[3];

    float est, scale;

    int i, i_max_corr;



    isf[LP_ORDER_16k - 1] = isf[LP_ORDER - 1];



    /* Calculate the difference vector */

    for (i = 0; i < LP_ORDER - 2; i++)

        diff_isf[i] = isf[i + 1] - isf[i];



    diff_mean = 0.0;

    for (i = 2; i < LP_ORDER - 2; i++)

        diff_mean += diff_isf[i] * (1.0f / (LP_ORDER - 4));



    /* Find which is the maximum autocorrelation */

    i_max_corr = 0;

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

        corr_lag[i] = auto_correlation(diff_isf, diff_mean, i + 2);



        if (corr_lag[i] > corr_lag[i_max_corr])

            i_max_corr = i;

    }

    i_max_corr++;



    for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)

        isf[i] = isf[i - 1] + isf[i - 1 - i_max_corr]

                            - isf[i - 2 - i_max_corr];



    /* Calculate an estimate for ISF(18) and scale ISF based on the error */

    est   = 7965 + (isf[2] - isf[3] - isf[4]) / 6.0;

    scale = 0.5 * (FFMIN(est, 7600) - isf[LP_ORDER - 2]) /

            (isf[LP_ORDER_16k - 2] - isf[LP_ORDER - 2]);



    for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)

        diff_hi[i] = scale * (isf[i] - isf[i - 1]);



    /* Stability insurance */

    for (i = LP_ORDER; i < LP_ORDER_16k - 1; i++)

        if (diff_hi[i] + diff_hi[i - 1] < 5.0) {

            if (diff_hi[i] > diff_hi[i - 1]) {

                diff_hi[i - 1] = 5.0 - diff_hi[i];

            } else

                diff_hi[i] = 5.0 - diff_hi[i - 1];

        }



    for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)

        isf[i] = isf[i - 1] + diff_hi[i] * (1.0f / (1 << 15));



    /* Scale the ISF vector for 16000 Hz */

    for (i = 0; i < LP_ORDER_16k - 1; i++)

        isf[i] *= 0.8;

}

static void extrapolate_isf(float isf[LP_ORDER_16k])

{

    float diff_isf[LP_ORDER - 2], diff_mean;

    float *diff_hi = diff_isf - LP_ORDER + 1; 

    float corr_lag[3];

    float est, scale;

    int i, i_max_corr;



    isf[LP_ORDER_16k - 1] = isf[LP_ORDER - 1];



    

    for (i = 0; i < LP_ORDER - 2; i++)

        diff_isf[i] = isf[i + 1] - isf[i];



    diff_mean = 0.0;

    for (i = 2; i < LP_ORDER - 2; i++)

        diff_mean += diff_isf[i] * (1.0f / (LP_ORDER - 4));



    

    i_max_corr = 0;

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

        corr_lag[i] = auto_correlation(diff_isf, diff_mean, i + 2);



        if (corr_lag[i] > corr_lag[i_max_corr])

            i_max_corr = i;

    }

    i_max_corr++;



    for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)

        isf[i] = isf[i - 1] + isf[i - 1 - i_max_corr]

                            - isf[i - 2 - i_max_corr];



    

    est   = 7965 + (isf[2] - isf[3] - isf[4]) / 6.0;

    scale = 0.5 * (FFMIN(est, 7600) - isf[LP_ORDER - 2]) /

            (isf[LP_ORDER_16k - 2] - isf[LP_ORDER - 2]);



    for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)

        diff_hi[i] = scale * (isf[i] - isf[i - 1]);



    

    for (i = LP_ORDER; i < LP_ORDER_16k - 1; i++)

        if (diff_hi[i] + diff_hi[i - 1] < 5.0) {

            if (diff_hi[i] > diff_hi[i - 1]) {

                diff_hi[i - 1] = 5.0 - diff_hi[i];

            } else

                diff_hi[i] = 5.0 - diff_hi[i - 1];

        }



    for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)

        isf[i] = isf[i - 1] + diff_hi[i] * (1.0f / (1 << 15));



    

    for (i = 0; i < LP_ORDER_16k - 1; i++)

        isf[i] *= 0.8;

}

    int i, i_max_corr;     for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)         diff_hi[i] = scale * (isf[i] - isf[i - 1]);     for (i = LP_ORDER; i < LP_ORDER_16k - 1; i++)         if (diff_hi[i] + diff_hi[i - 1] < 5.0) {             if (diff_hi[i] > diff_hi[i - 1]) {                 diff_hi[i - 1] = 5.0 - diff_hi[i];                 diff_hi[i] = 5.0 - diff_hi[i - 1];     for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)         isf[i] = isf[i - 1] + diff_hi[i] * (1.0f / (1 << 15));
static void FUNC_0(float VAR_0[LP_ORDER_16k])

{

    float VAR_1[LP_ORDER - 2], diff_mean;

    float *VAR_2 = VAR_1 - LP_ORDER + 1; 

    float VAR_3[3];

    float VAR_4, VAR_5;

    int VAR_6, VAR_7;



    VAR_0[LP_ORDER_16k - 1] = VAR_0[LP_ORDER - 1];



    

    for (VAR_6 = 0; VAR_6 < LP_ORDER - 2; VAR_6++)

        VAR_1[VAR_6] = VAR_0[VAR_6 + 1] - VAR_0[VAR_6];



    diff_mean = 0.0;

    for (VAR_6 = 2; VAR_6 < LP_ORDER - 2; VAR_6++)

        diff_mean += VAR_1[VAR_6] * (1.0f / (LP_ORDER - 4));



    

    VAR_7 = 0;

    for (VAR_6 = 0; VAR_6 < 3; VAR_6++) {

        VAR_3[VAR_6] = auto_correlation(VAR_1, diff_mean, VAR_6 + 2);



        if (VAR_3[VAR_6] > VAR_3[VAR_7])

            VAR_7 = VAR_6;

    }

    VAR_7++;



    for (VAR_6 = LP_ORDER - 1; VAR_6 < LP_ORDER_16k - 1; VAR_6++)

        VAR_0[VAR_6] = VAR_0[VAR_6 - 1] + VAR_0[VAR_6 - 1 - VAR_7]

                            - VAR_0[VAR_6 - 2 - VAR_7];



    

    VAR_4   = 7965 + (VAR_0[2] - VAR_0[3] - VAR_0[4]) / 6.0;

    VAR_5 = 0.5 * (FFMIN(VAR_4, 7600) - VAR_0[LP_ORDER - 2]) /

            (VAR_0[LP_ORDER_16k - 2] - VAR_0[LP_ORDER - 2]);



    for (VAR_6 = LP_ORDER - 1; VAR_6 < LP_ORDER_16k - 1; VAR_6++)

        VAR_2[VAR_6] = VAR_5 * (VAR_0[VAR_6] - VAR_0[VAR_6 - 1]);



    

    for (VAR_6 = LP_ORDER; VAR_6 < LP_ORDER_16k - 1; VAR_6++)

        if (VAR_2[VAR_6] + VAR_2[VAR_6 - 1] < 5.0) {

            if (VAR_2[VAR_6] > VAR_2[VAR_6 - 1]) {

                VAR_2[VAR_6 - 1] = 5.0 - VAR_2[VAR_6];

            } else

                VAR_2[VAR_6] = 5.0 - VAR_2[VAR_6 - 1];

        }



    for (VAR_6 = LP_ORDER - 1; VAR_6 < LP_ORDER_16k - 1; VAR_6++)

        VAR_0[VAR_6] = VAR_0[VAR_6 - 1] + VAR_2[VAR_6] * (1.0f / (1 << 15));



    

    for (VAR_6 = 0; VAR_6 < LP_ORDER_16k - 1; VAR_6++)

        VAR_0[VAR_6] *= 0.8;

}

static void FUNC_0(float VAR_0[LP_ORDER_16k])
{ float VAR_1[LP_ORDER - 2], diff_mean; float *VAR_2 = VAR_1 - LP_ORDER + 1; float VAR_3[3]; float VAR_4, VAR_5; int VAR_6, VAR_7; VAR_0[LP_ORDER_16k - 1] = VAR_0[LP_ORDER - 1]; for (VAR_6 = 0; VAR_6 < LP_ORDER - 2; VAR_6++) VAR_1[VAR_6] = VAR_0[VAR_6 + 1] - VAR_0[VAR_6]; diff_mean = 0.0; for (VAR_6 = 2; VAR_6 < LP_ORDER - 2; VAR_6++) diff_mean += VAR_1[VAR_6] * (1.0f / (LP_ORDER - 4)); VAR_7 = 0; for (VAR_6 = 0; VAR_6 < 3; VAR_6++) { VAR_3[VAR_6] = auto_correlation(VAR_1, diff_mean, VAR_6 + 2); if (VAR_3[VAR_6] > VAR_3[VAR_7])
VAR_7 = VAR_6; } VAR_7++; for (VAR_6 = LP_ORDER - 1; VAR_6 < LP_ORDER_16k - 1; VAR_6++) VAR_0[VAR_6] = VAR_0[VAR_6 - 1] + VAR_0[VAR_6 - 1 - VAR_7]
- VAR_0[VAR_6 - 2 - VAR_7]; VAR_4   = 7965 + (VAR_0[2] - VAR_0[3] - VAR_0[4]) / 6.0; VAR_5 = 0.5 * (FFMIN(VAR_4, 7600) - VAR_0[LP_ORDER - 2]) /
(VAR_0[LP_ORDER_16k - 2] - VAR_0[LP_ORDER - 2]); for (VAR_6 = LP_ORDER - 1; VAR_6 < LP_ORDER_16k - 1; VAR_6++) VAR_2[VAR_6] = VAR_5 * (VAR_0[VAR_6] - VAR_0[VAR_6 - 1]); for (VAR_6 = LP_ORDER; VAR_6 < LP_ORDER_16k - 1; VAR_6++) if (VAR_2[VAR_6] + VAR_2[VAR_6 - 1] < 5.0) { if (VAR_2[VAR_6] > VAR_2[VAR_6 - 1]) { VAR_2[VAR_6 - 1] = 5.0 - VAR_2[VAR_6]; } else VAR_2[VAR_6] = 5.0 - VAR_2[VAR_6 - 1]; } for (VAR_6 = LP_ORDER - 1; VAR_6 < LP_ORDER_16k - 1; VAR_6++) VAR_0[VAR_6] = VAR_0[VAR_6 - 1] + VAR_2[VAR_6] * (1.0f / (1 << 15)); for (VAR_6 = 0; VAR_6 < LP_ORDER_16k - 1; VAR_6++) VAR_0[VAR_6] *= 0.8; }