static void modified_levinson_durbin(int *window, int window_entries,

        int *out, int out_entries, int channels, int *tap_quant)

{

    int i;

    int *state = av_calloc(window_entries, sizeof(*state));



    memcpy(state, window, 4* window_entries);



    for (i = 0; i < out_entries; i++)

    {

        int step = (i+1)*channels, k, j;

        double xx = 0.0, xy = 0.0;

#if 1

        int *x_ptr = &(window[step]);

        int *state_ptr = &(state[0]);

        j = window_entries - step;

        for (;j>0;j--,x_ptr++,state_ptr++)

        {

            double x_value = *x_ptr;

            double state_value = *state_ptr;

            xx += state_value*state_value;

            xy += x_value*state_value;

        }

#else

        for (j = 0; j <= (window_entries - step); j++);

        {

            double stepval = window[step+j];

            double stateval = window[j];

//            xx += (double)window[j]*(double)window[j];

//            xy += (double)window[step+j]*(double)window[j];

            xx += stateval*stateval;

            xy += stepval*stateval;

        }

#endif

        if (xx == 0.0)

            k = 0;

        else

            k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5));



        if (k > (LATTICE_FACTOR/tap_quant[i]))

            k = LATTICE_FACTOR/tap_quant[i];

        if (-k > (LATTICE_FACTOR/tap_quant[i]))

            k = -(LATTICE_FACTOR/tap_quant[i]);



        out[i] = k;

        k *= tap_quant[i];



#if 1

        x_ptr = &(window[step]);

        state_ptr = &(state[0]);

        j = window_entries - step;

        for (;j>0;j--,x_ptr++,state_ptr++)

        {

            int x_value = *x_ptr;

            int state_value = *state_ptr;

            *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT);

            *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT);

        }

#else

        for (j=0; j <= (window_entries - step); j++)

        {

            int stepval = window[step+j];

            int stateval=state[j];

            window[step+j] += shift_down(k * stateval, LATTICE_SHIFT);

            state[j] += shift_down(k * stepval, LATTICE_SHIFT);

        }

#endif

    }



    av_free(state);

}

static void modified_levinson_durbin(int *window, int window_entries,

        int *out, int out_entries, int channels, int *tap_quant)

{

    int i;

    int *state = av_calloc(window_entries, sizeof(*state));



    memcpy(state, window, 4* window_entries);



    for (i = 0; i < out_entries; i++)

    {

        int step = (i+1)*channels, k, j;

        double xx = 0.0, xy = 0.0;

#if 1

        int *x_ptr = &(window[step]);

        int *state_ptr = &(state[0]);

        j = window_entries - step;

        for (;j>0;j--,x_ptr++,state_ptr++)

        {

            double x_value = *x_ptr;

            double state_value = *state_ptr;

            xx += state_value*state_value;

            xy += x_value*state_value;

        }

#else

        for (j = 0; j <= (window_entries - step); j++);

        {

            double stepval = window[step+j];

            double stateval = window[j];





            xx += stateval*stateval;

            xy += stepval*stateval;

        }

#endif

        if (xx == 0.0)

            k = 0;

        else

            k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5));



        if (k > (LATTICE_FACTOR/tap_quant[i]))

            k = LATTICE_FACTOR/tap_quant[i];

        if (-k > (LATTICE_FACTOR/tap_quant[i]))

            k = -(LATTICE_FACTOR/tap_quant[i]);



        out[i] = k;

        k *= tap_quant[i];



#if 1

        x_ptr = &(window[step]);

        state_ptr = &(state[0]);

        j = window_entries - step;

        for (;j>0;j--,x_ptr++,state_ptr++)

        {

            int x_value = *x_ptr;

            int state_value = *state_ptr;

            *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT);

            *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT);

        }

#else

        for (j=0; j <= (window_entries - step); j++)

        {

            int stepval = window[step+j];

            int stateval=state[j];

            window[step+j] += shift_down(k * stateval, LATTICE_SHIFT);

            state[j] += shift_down(k * stepval, LATTICE_SHIFT);

        }

#endif

    }



    av_free(state);

}

static void FUNC_0(int *VAR_0, int VAR_1,

        int *VAR_2, int VAR_3, int VAR_4, int *VAR_5)

{

    int VAR_6;

    int *VAR_7 = av_calloc(VAR_1, sizeof(*VAR_7));



    memcpy(VAR_7, VAR_0, 4* VAR_1);



    for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++)

    {

        int VAR_8 = (VAR_6+1)*VAR_4, VAR_9, VAR_10;

        double VAR_11 = 0.0, VAR_12 = 0.0;

#if 1

        int *VAR_13 = &(VAR_0[VAR_8]);

        int *VAR_14 = &(VAR_7[0]);

        VAR_10 = VAR_1 - VAR_8;

        for (;VAR_10>0;VAR_10--,VAR_13++,VAR_14++)

        {

            double VAR_17 = *VAR_13;

            double VAR_17 = *VAR_14;

            VAR_11 += VAR_17*VAR_17;

            VAR_12 += VAR_17*VAR_17;

        }

#else

        for (VAR_10 = 0; VAR_10 <= (VAR_1 - VAR_8); VAR_10++);

        {

            double stepval = VAR_0[VAR_8+VAR_10];

            double stateval = VAR_0[VAR_10];





            VAR_11 += stateval*stateval;

            VAR_12 += stepval*stateval;

        }

#endif

        if (VAR_11 == 0.0)

            VAR_9 = 0;

        else

            VAR_9 = (int)(floor(-VAR_12/VAR_11 * (double)LATTICE_FACTOR / (double)(VAR_5[VAR_6]) + 0.5));



        if (VAR_9 > (LATTICE_FACTOR/VAR_5[VAR_6]))

            VAR_9 = LATTICE_FACTOR/VAR_5[VAR_6];

        if (-VAR_9 > (LATTICE_FACTOR/VAR_5[VAR_6]))

            VAR_9 = -(LATTICE_FACTOR/VAR_5[VAR_6]);



        VAR_2[VAR_6] = VAR_9;

        VAR_9 *= VAR_5[VAR_6];



#if 1

        VAR_13 = &(VAR_0[VAR_8]);

        VAR_14 = &(VAR_7[0]);

        VAR_10 = VAR_1 - VAR_8;

        for (;VAR_10>0;VAR_10--,VAR_13++,VAR_14++)

        {

            int VAR_17 = *VAR_13;

            int VAR_17 = *VAR_14;

            *VAR_13 = VAR_17 + shift_down(VAR_9*VAR_17,LATTICE_SHIFT);

            *VAR_14 = VAR_17 + shift_down(VAR_9*VAR_17, LATTICE_SHIFT);

        }

#else

        for (VAR_10=0; VAR_10 <= (VAR_1 - VAR_8); VAR_10++)

        {

            int stepval = VAR_0[VAR_8+VAR_10];

            int stateval=VAR_7[VAR_10];

            VAR_0[VAR_8+VAR_10] += shift_down(VAR_9 * stateval, LATTICE_SHIFT);

            VAR_7[VAR_10] += shift_down(VAR_9 * stepval, LATTICE_SHIFT);

        }

#endif

    }



    av_free(VAR_7);

}

static void FUNC_0(int *VAR_0, int VAR_1,
int *VAR_2, int VAR_3, int VAR_4, int *VAR_5)
{ int VAR_6; int *VAR_7 = av_calloc(VAR_1, sizeof(*VAR_7)); memcpy(VAR_7, VAR_0, 4* VAR_1); for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) { int VAR_8 = (VAR_6+1)*VAR_4, VAR_9, VAR_10; double VAR_11 = 0.0, VAR_12 = 0.0; #if 1
int *VAR_13 = &(VAR_0[VAR_8]); int *VAR_14 = &(VAR_7[0]); VAR_10 = VAR_1 - VAR_8; for (;VAR_10>0;VAR_10--,VAR_13++,VAR_14++) { double VAR_17 = *VAR_13; double VAR_17 = *VAR_14; VAR_11 += VAR_17*VAR_17; VAR_12 += VAR_17*VAR_17; } #else
for (VAR_10 = 0; VAR_10 <= (VAR_1 - VAR_8); VAR_10++); { double stepval = VAR_0[VAR_8+VAR_10]; double stateval = VAR_0[VAR_10]; VAR_11 += stateval*stateval; VAR_12 += stepval*stateval; } #endif
if (VAR_11 == 0.0)
VAR_9 = 0; else
VAR_9 = (int)(floor(-VAR_12/VAR_11 * (double)LATTICE_FACTOR / (double)(VAR_5[VAR_6]) + 0.5)); if (VAR_9 > (LATTICE_FACTOR/VAR_5[VAR_6]))
VAR_9 = LATTICE_FACTOR/VAR_5[VAR_6]; if (-VAR_9 > (LATTICE_FACTOR/VAR_5[VAR_6]))
VAR_9 = -(LATTICE_FACTOR/VAR_5[VAR_6]); VAR_2[VAR_6] = VAR_9; VAR_9 *= VAR_5[VAR_6]; #if 1
VAR_13 = &(VAR_0[VAR_8]); VAR_14 = &(VAR_7[0]); VAR_10 = VAR_1 - VAR_8; for (;VAR_10>0;VAR_10--,VAR_13++,VAR_14++) { int VAR_17 = *VAR_13; int VAR_17 = *VAR_14; *VAR_13 = VAR_17 + shift_down(VAR_9*VAR_17,LATTICE_SHIFT); *VAR_14 = VAR_17 + shift_down(VAR_9*VAR_17, LATTICE_SHIFT); } #else
for (VAR_10=0; VAR_10 <= (VAR_1 - VAR_8); VAR_10++) { int stepval = VAR_0[VAR_8+VAR_10]; int stateval=VAR_7[VAR_10]; VAR_0[VAR_8+VAR_10] += shift_down(VAR_9 * stateval, LATTICE_SHIFT); VAR_7[VAR_10] += shift_down(VAR_9 * stepval, LATTICE_SHIFT); } #endif
} av_free(VAR_7); }