static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf)

{

    int16_t filter_coef[2][LPC_ORDER], *buf_ptr;

    int filter_signal[LPC_ORDER + FRAME_LEN], *signal_ptr;

    int i, j, k;



    memcpy(buf, p->fir_mem, LPC_ORDER * sizeof(*buf));

    memcpy(filter_signal, p->iir_mem, LPC_ORDER * sizeof(*filter_signal));



    for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) {

        for (k = 0; k < LPC_ORDER; k++) {

            filter_coef[0][k] = (-lpc[k] * postfilter_tbl[0][k] +

                                 (1 << 14)) >> 15;

            filter_coef[1][k] = (-lpc[k] * postfilter_tbl[1][k] +

                                 (1 << 14)) >> 15;

        }

        iir_filter(filter_coef[0], filter_coef[1], buf + i,

                   filter_signal + i);

        lpc += LPC_ORDER;

    }



    memcpy(p->fir_mem, buf + FRAME_LEN, LPC_ORDER * sizeof(*p->fir_mem));

    memcpy(p->iir_mem, filter_signal + FRAME_LEN,

           LPC_ORDER * sizeof(*p->iir_mem));



    buf_ptr    = buf + LPC_ORDER;

    signal_ptr = filter_signal + LPC_ORDER;

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

        int16_t temp_vector[SUBFRAME_LEN];

        int temp;

        int auto_corr[2];

        int scale, energy;



        /* Normalize */

        memcpy(temp_vector, buf_ptr, SUBFRAME_LEN * sizeof(*temp_vector));

        scale = scale_vector(temp_vector, SUBFRAME_LEN);



        /* Compute auto correlation coefficients */

        auto_corr[0] = dot_product(temp_vector, temp_vector + 1,

                                   SUBFRAME_LEN - 1, 1);

        auto_corr[1] = dot_product(temp_vector, temp_vector, SUBFRAME_LEN, 1);



        /* Compute reflection coefficient */

        temp = auto_corr[1] >> 16;

        if (temp) {

            temp = (auto_corr[0] >> 2) / temp;

        }

        p->reflection_coef = (3 * p->reflection_coef + temp + 2) >> 2;

        temp = -p->reflection_coef >> 1 & ~3;



        /* Compensation filter */

        for (j = 0; j < SUBFRAME_LEN; j++) {

            buf_ptr[j] = av_clipl_int32(signal_ptr[j] +

                                        ((signal_ptr[j - 1] >> 16) *

                                         temp << 1)) >> 16;

        }



        /* Compute normalized signal energy */

        temp = 2 * scale + 4;

        if (temp < 0) {

            energy = av_clipl_int32((int64_t)auto_corr[1] << -temp);

        } else

            energy = auto_corr[1] >> temp;



        gain_scale(p, buf_ptr, energy);



        buf_ptr    += SUBFRAME_LEN;

        signal_ptr += SUBFRAME_LEN;

    }

}

static void formant_postfilter(G723_1_Context *p, int16_t *lpc, int16_t *buf)

{

    int16_t filter_coef[2][LPC_ORDER], *buf_ptr;

    int filter_signal[LPC_ORDER + FRAME_LEN], *signal_ptr;

    int i, j, k;



    memcpy(buf, p->fir_mem, LPC_ORDER * sizeof(*buf));

    memcpy(filter_signal, p->iir_mem, LPC_ORDER * sizeof(*filter_signal));



    for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) {

        for (k = 0; k < LPC_ORDER; k++) {

            filter_coef[0][k] = (-lpc[k] * postfilter_tbl[0][k] +

                                 (1 << 14)) >> 15;

            filter_coef[1][k] = (-lpc[k] * postfilter_tbl[1][k] +

                                 (1 << 14)) >> 15;

        }

        iir_filter(filter_coef[0], filter_coef[1], buf + i,

                   filter_signal + i);

        lpc += LPC_ORDER;

    }



    memcpy(p->fir_mem, buf + FRAME_LEN, LPC_ORDER * sizeof(*p->fir_mem));

    memcpy(p->iir_mem, filter_signal + FRAME_LEN,

           LPC_ORDER * sizeof(*p->iir_mem));



    buf_ptr    = buf + LPC_ORDER;

    signal_ptr = filter_signal + LPC_ORDER;

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

        int16_t temp_vector[SUBFRAME_LEN];

        int temp;

        int auto_corr[2];

        int scale, energy;



        

        memcpy(temp_vector, buf_ptr, SUBFRAME_LEN * sizeof(*temp_vector));

        scale = scale_vector(temp_vector, SUBFRAME_LEN);



        

        auto_corr[0] = dot_product(temp_vector, temp_vector + 1,

                                   SUBFRAME_LEN - 1, 1);

        auto_corr[1] = dot_product(temp_vector, temp_vector, SUBFRAME_LEN, 1);



        

        temp = auto_corr[1] >> 16;

        if (temp) {

            temp = (auto_corr[0] >> 2) / temp;

        }

        p->reflection_coef = (3 * p->reflection_coef + temp + 2) >> 2;

        temp = -p->reflection_coef >> 1 & ~3;



        

        for (j = 0; j < SUBFRAME_LEN; j++) {

            buf_ptr[j] = av_clipl_int32(signal_ptr[j] +

                                        ((signal_ptr[j - 1] >> 16) *

                                         temp << 1)) >> 16;

        }



        

        temp = 2 * scale + 4;

        if (temp < 0) {

            energy = av_clipl_int32((int64_t)auto_corr[1] << -temp);

        } else

            energy = auto_corr[1] >> temp;



        gain_scale(p, buf_ptr, energy);



        buf_ptr    += SUBFRAME_LEN;

        signal_ptr += SUBFRAME_LEN;

    }

}

            buf_ptr[j] = av_clipl_int32(signal_ptr[j] +
static void FUNC_0(G723_1_Context *VAR_0, int16_t *VAR_1, int16_t *VAR_2)

{

    int16_t filter_coef[2][LPC_ORDER], *buf_ptr;

    int VAR_3[LPC_ORDER + FRAME_LEN], *signal_ptr;

    int VAR_4, VAR_5, VAR_6;



    memcpy(VAR_2, VAR_0->fir_mem, LPC_ORDER * sizeof(*VAR_2));

    memcpy(VAR_3, VAR_0->iir_mem, LPC_ORDER * sizeof(*VAR_3));



    for (VAR_4 = LPC_ORDER, VAR_5 = 0; VAR_5 < SUBFRAMES; VAR_4 += SUBFRAME_LEN, VAR_5++) {

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

            filter_coef[0][VAR_6] = (-VAR_1[VAR_6] * postfilter_tbl[0][VAR_6] +

                                 (1 << 14)) >> 15;

            filter_coef[1][VAR_6] = (-VAR_1[VAR_6] * postfilter_tbl[1][VAR_6] +

                                 (1 << 14)) >> 15;

        }

        iir_filter(filter_coef[0], filter_coef[1], VAR_2 + VAR_4,

                   VAR_3 + VAR_4);

        VAR_1 += LPC_ORDER;

    }



    memcpy(VAR_0->fir_mem, VAR_2 + FRAME_LEN, LPC_ORDER * sizeof(*VAR_0->fir_mem));

    memcpy(VAR_0->iir_mem, VAR_3 + FRAME_LEN,

           LPC_ORDER * sizeof(*VAR_0->iir_mem));



    buf_ptr    = VAR_2 + LPC_ORDER;

    signal_ptr = VAR_3 + LPC_ORDER;

    for (VAR_4 = 0; VAR_4 < SUBFRAMES; VAR_4++) {

        int16_t temp_vector[SUBFRAME_LEN];

        int temp;

        int auto_corr[2];

        int scale, energy;



        

        memcpy(temp_vector, buf_ptr, SUBFRAME_LEN * sizeof(*temp_vector));

        scale = scale_vector(temp_vector, SUBFRAME_LEN);



        

        auto_corr[0] = dot_product(temp_vector, temp_vector + 1,

                                   SUBFRAME_LEN - 1, 1);

        auto_corr[1] = dot_product(temp_vector, temp_vector, SUBFRAME_LEN, 1);



        

        temp = auto_corr[1] >> 16;

        if (temp) {

            temp = (auto_corr[0] >> 2) / temp;

        }

        VAR_0->reflection_coef = (3 * VAR_0->reflection_coef + temp + 2) >> 2;

        temp = -VAR_0->reflection_coef >> 1 & ~3;



        

        for (VAR_5 = 0; VAR_5 < SUBFRAME_LEN; VAR_5++) {

            buf_ptr[VAR_5] = av_clipl_int32(signal_ptr[VAR_5] +

                                        ((signal_ptr[VAR_5 - 1] >> 16) *

                                         temp << 1)) >> 16;

        }



        

        temp = 2 * scale + 4;

        if (temp < 0) {

            energy = av_clipl_int32((int64_t)auto_corr[1] << -temp);

        } else

            energy = auto_corr[1] >> temp;



        gain_scale(VAR_0, buf_ptr, energy);



        buf_ptr    += SUBFRAME_LEN;

        signal_ptr += SUBFRAME_LEN;

    }

}

static void FUNC_0(G723_1_Context *VAR_0, int16_t *VAR_1, int16_t *VAR_2)
{ int16_t filter_coef[2][LPC_ORDER], *buf_ptr; int VAR_3[LPC_ORDER + FRAME_LEN], *signal_ptr; int VAR_4, VAR_5, VAR_6; memcpy(VAR_2, VAR_0->fir_mem, LPC_ORDER * sizeof(*VAR_2)); memcpy(VAR_3, VAR_0->iir_mem, LPC_ORDER * sizeof(*VAR_3)); for (VAR_4 = LPC_ORDER, VAR_5 = 0; VAR_5 < SUBFRAMES; VAR_4 += SUBFRAME_LEN, VAR_5++) { for (VAR_6 = 0; VAR_6 < LPC_ORDER; VAR_6++) { filter_coef[0][VAR_6] = (-VAR_1[VAR_6] * postfilter_tbl[0][VAR_6] +
(1 << 14)) >> 15; filter_coef[1][VAR_6] = (-VAR_1[VAR_6] * postfilter_tbl[1][VAR_6] +
(1 << 14)) >> 15; } iir_filter(filter_coef[0], filter_coef[1], VAR_2 + VAR_4,
VAR_3 + VAR_4); VAR_1 += LPC_ORDER; } memcpy(VAR_0->fir_mem, VAR_2 + FRAME_LEN, LPC_ORDER * sizeof(*VAR_0->fir_mem)); memcpy(VAR_0->iir_mem, VAR_3 + FRAME_LEN,
LPC_ORDER * sizeof(*VAR_0->iir_mem)); buf_ptr    = VAR_2 + LPC_ORDER; signal_ptr = VAR_3 + LPC_ORDER; for (VAR_4 = 0; VAR_4 < SUBFRAMES; VAR_4++) { int16_t temp_vector[SUBFRAME_LEN]; int temp; int auto_corr[2]; int scale, energy; memcpy(temp_vector, buf_ptr, SUBFRAME_LEN * sizeof(*temp_vector)); scale = scale_vector(temp_vector, SUBFRAME_LEN); auto_corr[0] = dot_product(temp_vector, temp_vector + 1,
SUBFRAME_LEN - 1, 1); auto_corr[1] = dot_product(temp_vector, temp_vector, SUBFRAME_LEN, 1); temp = auto_corr[1] >> 16; if (temp) { temp = (auto_corr[0] >> 2) / temp; } VAR_0->reflection_coef = (3 * VAR_0->reflection_coef + temp + 2) >> 2; temp = -VAR_0->reflection_coef >> 1 & ~3; for (VAR_5 = 0; VAR_5 < SUBFRAME_LEN; VAR_5++) { buf_ptr[VAR_5] = av_clipl_int32(signal_ptr[VAR_5] +
((signal_ptr[VAR_5 - 1] >> 16) *
temp << 1)) >> 16; } temp = 2 * scale + 4; if (temp < 0) { energy = av_clipl_int32((int64_t)auto_corr[1] << -temp); } else energy = auto_corr[1] >> temp; gain_scale(VAR_0, buf_ptr, energy); buf_ptr    += SUBFRAME_LEN; signal_ptr += SUBFRAME_LEN; } }