static void synth_block_fcb_acb(WMAVoiceContext *s, GetBitContext *gb,

                                int block_idx, int size,

                                int block_pitch_sh2,

                                const struct frame_type_desc *frame_desc,

                                float *excitation)

{

    static const float gain_coeff[6] = {

        0.8169, -0.06545, 0.1726, 0.0185, -0.0359, 0.0458

    };

    float pulses[MAX_FRAMESIZE / 2], pred_err, acb_gain, fcb_gain;

    int n, idx, gain_weight;

    AMRFixed fcb;



    assert(size <= MAX_FRAMESIZE / 2);

    memset(pulses, 0, sizeof(*pulses) * size);



    fcb.pitch_lag      = block_pitch_sh2 >> 2;

    fcb.pitch_fac      = 1.0;

    fcb.no_repeat_mask = 0;

    fcb.n              = 0;



    /* For the other frame types, this is where we apply the innovation

     * (fixed) codebook pulses of the speech signal. */

    if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {

        aw_pulse_set1(s, gb, block_idx, &fcb);

        aw_pulse_set2(s, gb, block_idx, &fcb);

    } else /* FCB_TYPE_EXC_PULSES */ {

        int offset_nbits = 5 - frame_desc->log_n_blocks;



        fcb.no_repeat_mask = -1;

        /* similar to ff_decode_10_pulses_35bits(), but with single pulses

         * (instead of double) for a subset of pulses */

        for (n = 0; n < 5; n++) {

            float sign;

            int pos1, pos2;



            sign           = get_bits1(gb) ? 1.0 : -1.0;

            pos1           = get_bits(gb, offset_nbits);

            fcb.x[fcb.n]   = n + 5 * pos1;

            fcb.y[fcb.n++] = sign;

            if (n < frame_desc->dbl_pulses) {

                pos2           = get_bits(gb, offset_nbits);

                fcb.x[fcb.n]   = n + 5 * pos2;

                fcb.y[fcb.n++] = (pos1 < pos2) ? -sign : sign;

            }

        }

    }

    ff_set_fixed_vector(pulses, &fcb, 1.0, size);



    /* Calculate gain for adaptive & fixed codebook signal.

     * see ff_amr_set_fixed_gain(). */

    idx = get_bits(gb, 7);

    fcb_gain = expf(avpriv_scalarproduct_float_c(s->gain_pred_err,

                                                 gain_coeff, 6) -

                    5.2409161640 + wmavoice_gain_codebook_fcb[idx]);

    acb_gain = wmavoice_gain_codebook_acb[idx];

    pred_err = av_clipf(wmavoice_gain_codebook_fcb[idx],

                        -2.9957322736 /* log(0.05) */,

                         1.6094379124 /* log(5.0)  */);



    gain_weight = 8 >> frame_desc->log_n_blocks;

    memmove(&s->gain_pred_err[gain_weight], s->gain_pred_err,

            sizeof(*s->gain_pred_err) * (6 - gain_weight));

    for (n = 0; n < gain_weight; n++)

        s->gain_pred_err[n] = pred_err;



    /* Calculation of adaptive codebook */

    if (frame_desc->acb_type == ACB_TYPE_ASYMMETRIC) {

        int len;

        for (n = 0; n < size; n += len) {

            int next_idx_sh16;

            int abs_idx    = block_idx * size + n;

            int pitch_sh16 = (s->last_pitch_val << 16) +

                             s->pitch_diff_sh16 * abs_idx;

            int pitch      = (pitch_sh16 + 0x6FFF) >> 16;

            int idx_sh16   = ((pitch << 16) - pitch_sh16) * 8 + 0x58000;

            idx            = idx_sh16 >> 16;

            if (s->pitch_diff_sh16) {

                if (s->pitch_diff_sh16 > 0) {

                    next_idx_sh16 = (idx_sh16) &~ 0xFFFF;

                } else

                    next_idx_sh16 = (idx_sh16 + 0x10000) &~ 0xFFFF;

                len = av_clip((idx_sh16 - next_idx_sh16) / s->pitch_diff_sh16 / 8,

                              1, size - n);

            } else

                len = size;



            ff_acelp_interpolatef(&excitation[n], &excitation[n - pitch],

                                  wmavoice_ipol1_coeffs, 17,

                                  idx, 9, len);

        }

    } else /* ACB_TYPE_HAMMING */ {

        int block_pitch = block_pitch_sh2 >> 2;

        idx             = block_pitch_sh2 & 3;

        if (idx) {

            ff_acelp_interpolatef(excitation, &excitation[-block_pitch],

                                  wmavoice_ipol2_coeffs, 4,

                                  idx, 8, size);

        } else

            av_memcpy_backptr((uint8_t *) excitation, sizeof(float) * block_pitch,

                              sizeof(float) * size);

    }



    /* Interpolate ACB/FCB and use as excitation signal */

    ff_weighted_vector_sumf(excitation, excitation, pulses,

                            acb_gain, fcb_gain, size);

}

static void synth_block_fcb_acb(WMAVoiceContext *s, GetBitContext *gb,

                                int block_idx, int size,

                                int block_pitch_sh2,

                                const struct frame_type_desc *frame_desc,

                                float *excitation)

{

    static const float gain_coeff[6] = {

        0.8169, -0.06545, 0.1726, 0.0185, -0.0359, 0.0458

    };

    float pulses[MAX_FRAMESIZE / 2], pred_err, acb_gain, fcb_gain;

    int n, idx, gain_weight;

    AMRFixed fcb;



    assert(size <= MAX_FRAMESIZE / 2);

    memset(pulses, 0, sizeof(*pulses) * size);



    fcb.pitch_lag      = block_pitch_sh2 >> 2;

    fcb.pitch_fac      = 1.0;

    fcb.no_repeat_mask = 0;

    fcb.n              = 0;



    



    if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {

        aw_pulse_set1(s, gb, block_idx, &fcb);

        aw_pulse_set2(s, gb, block_idx, &fcb);

    } else  {

        int offset_nbits = 5 - frame_desc->log_n_blocks;



        fcb.no_repeat_mask = -1;

        



        for (n = 0; n < 5; n++) {

            float sign;

            int pos1, pos2;



            sign           = get_bits1(gb) ? 1.0 : -1.0;

            pos1           = get_bits(gb, offset_nbits);

            fcb.x[fcb.n]   = n + 5 * pos1;

            fcb.y[fcb.n++] = sign;

            if (n < frame_desc->dbl_pulses) {

                pos2           = get_bits(gb, offset_nbits);

                fcb.x[fcb.n]   = n + 5 * pos2;

                fcb.y[fcb.n++] = (pos1 < pos2) ? -sign : sign;

            }

        }

    }

    ff_set_fixed_vector(pulses, &fcb, 1.0, size);



    



    idx = get_bits(gb, 7);

    fcb_gain = expf(avpriv_scalarproduct_float_c(s->gain_pred_err,

                                                 gain_coeff, 6) -

                    5.2409161640 + wmavoice_gain_codebook_fcb[idx]);

    acb_gain = wmavoice_gain_codebook_acb[idx];

    pred_err = av_clipf(wmavoice_gain_codebook_fcb[idx],

                        -2.9957322736 ,

                         1.6094379124 );



    gain_weight = 8 >> frame_desc->log_n_blocks;

    memmove(&s->gain_pred_err[gain_weight], s->gain_pred_err,

            sizeof(*s->gain_pred_err) * (6 - gain_weight));

    for (n = 0; n < gain_weight; n++)

        s->gain_pred_err[n] = pred_err;



    

    if (frame_desc->acb_type == ACB_TYPE_ASYMMETRIC) {

        int len;

        for (n = 0; n < size; n += len) {

            int next_idx_sh16;

            int abs_idx    = block_idx * size + n;

            int pitch_sh16 = (s->last_pitch_val << 16) +

                             s->pitch_diff_sh16 * abs_idx;

            int pitch      = (pitch_sh16 + 0x6FFF) >> 16;

            int idx_sh16   = ((pitch << 16) - pitch_sh16) * 8 + 0x58000;

            idx            = idx_sh16 >> 16;

            if (s->pitch_diff_sh16) {

                if (s->pitch_diff_sh16 > 0) {

                    next_idx_sh16 = (idx_sh16) &~ 0xFFFF;

                } else

                    next_idx_sh16 = (idx_sh16 + 0x10000) &~ 0xFFFF;

                len = av_clip((idx_sh16 - next_idx_sh16) / s->pitch_diff_sh16 / 8,

                              1, size - n);

            } else

                len = size;



            ff_acelp_interpolatef(&excitation[n], &excitation[n - pitch],

                                  wmavoice_ipol1_coeffs, 17,

                                  idx, 9, len);

        }

    } else  {

        int block_pitch = block_pitch_sh2 >> 2;

        idx             = block_pitch_sh2 & 3;

        if (idx) {

            ff_acelp_interpolatef(excitation, &excitation[-block_pitch],

                                  wmavoice_ipol2_coeffs, 4,

                                  idx, 8, size);

        } else

            av_memcpy_backptr((uint8_t *) excitation, sizeof(float) * block_pitch,

                              sizeof(float) * size);

    }



    

    ff_weighted_vector_sumf(excitation, excitation, pulses,

                            acb_gain, fcb_gain, size);

}

        aw_pulse_set2(s, gb, block_idx, &fcb);
static void FUNC_0(WMAVoiceContext *VAR_0, GetBitContext *VAR_1,

                                int VAR_2, int VAR_3,

                                int VAR_4,

                                const struct frame_type_desc *VAR_5,

                                float *VAR_6)

{

    static const float VAR_7[6] = {

        0.8169, -0.06545, 0.1726, 0.0185, -0.0359, 0.0458

    };

    float VAR_8[MAX_FRAMESIZE / 2], pred_err, acb_gain, fcb_gain;

    int VAR_9, VAR_10, VAR_11;

    AMRFixed fcb;



    assert(VAR_3 <= MAX_FRAMESIZE / 2);

    memset(VAR_8, 0, sizeof(*VAR_8) * VAR_3);



    fcb.pitch_lag      = VAR_4 >> 2;

    fcb.pitch_fac      = 1.0;

    fcb.no_repeat_mask = 0;

    fcb.VAR_9              = 0;



    



    if (VAR_5->fcb_type == FCB_TYPE_AW_PULSES) {

        aw_pulse_set1(VAR_0, VAR_1, VAR_2, &fcb);

        aw_pulse_set2(VAR_0, VAR_1, VAR_2, &fcb);

    } else  {

        int VAR_12 = 5 - VAR_5->log_n_blocks;



        fcb.no_repeat_mask = -1;

        



        for (VAR_9 = 0; VAR_9 < 5; VAR_9++) {

            float VAR_13;

            int VAR_14, VAR_15;



            VAR_13           = get_bits1(VAR_1) ? 1.0 : -1.0;

            VAR_14           = get_bits(VAR_1, VAR_12);

            fcb.x[fcb.VAR_9]   = VAR_9 + 5 * VAR_14;

            fcb.y[fcb.VAR_9++] = VAR_13;

            if (VAR_9 < VAR_5->dbl_pulses) {

                VAR_15           = get_bits(VAR_1, VAR_12);

                fcb.x[fcb.VAR_9]   = VAR_9 + 5 * VAR_15;

                fcb.y[fcb.VAR_9++] = (VAR_14 < VAR_15) ? -VAR_13 : VAR_13;

            }

        }

    }

    ff_set_fixed_vector(VAR_8, &fcb, 1.0, VAR_3);



    



    VAR_10 = get_bits(VAR_1, 7);

    fcb_gain = expf(avpriv_scalarproduct_float_c(VAR_0->gain_pred_err,

                                                 VAR_7, 6) -

                    5.2409161640 + wmavoice_gain_codebook_fcb[VAR_10]);

    acb_gain = wmavoice_gain_codebook_acb[VAR_10];

    pred_err = av_clipf(wmavoice_gain_codebook_fcb[VAR_10],

                        -2.9957322736 ,

                         1.6094379124 );



    VAR_11 = 8 >> VAR_5->log_n_blocks;

    memmove(&VAR_0->gain_pred_err[VAR_11], VAR_0->gain_pred_err,

            sizeof(*VAR_0->gain_pred_err) * (6 - VAR_11));

    for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9++)

        VAR_0->gain_pred_err[VAR_9] = pred_err;



    

    if (VAR_5->acb_type == ACB_TYPE_ASYMMETRIC) {

        int VAR_16;

        for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9 += VAR_16) {

            int VAR_17;

            int VAR_18    = VAR_2 * VAR_3 + VAR_9;

            int VAR_19 = (VAR_0->last_pitch_val << 16) +

                             VAR_0->pitch_diff_sh16 * VAR_18;

            int VAR_20      = (VAR_19 + 0x6FFF) >> 16;

            int VAR_21   = ((VAR_20 << 16) - VAR_19) * 8 + 0x58000;

            VAR_10            = VAR_21 >> 16;

            if (VAR_0->pitch_diff_sh16) {

                if (VAR_0->pitch_diff_sh16 > 0) {

                    VAR_17 = (VAR_21) &~ 0xFFFF;

                } else

                    VAR_17 = (VAR_21 + 0x10000) &~ 0xFFFF;

                VAR_16 = av_clip((VAR_21 - VAR_17) / VAR_0->pitch_diff_sh16 / 8,

                              1, VAR_3 - VAR_9);

            } else

                VAR_16 = VAR_3;



            ff_acelp_interpolatef(&VAR_6[VAR_9], &VAR_6[VAR_9 - VAR_20],

                                  wmavoice_ipol1_coeffs, 17,

                                  VAR_10, 9, VAR_16);

        }

    } else  {

        int VAR_22 = VAR_4 >> 2;

        VAR_10             = VAR_4 & 3;

        if (VAR_10) {

            ff_acelp_interpolatef(VAR_6, &VAR_6[-VAR_22],

                                  wmavoice_ipol2_coeffs, 4,

                                  VAR_10, 8, VAR_3);

        } else

            av_memcpy_backptr((uint8_t *) VAR_6, sizeof(float) * VAR_22,

                              sizeof(float) * VAR_3);

    }



    

    ff_weighted_vector_sumf(VAR_6, VAR_6, VAR_8,

                            acb_gain, fcb_gain, VAR_3);

}

static void FUNC_0(WMAVoiceContext *VAR_0, GetBitContext *VAR_1,
int VAR_2, int VAR_3,
int VAR_4,
const struct frame_type_desc *VAR_5,
float *VAR_6)
{ static const float VAR_7[6] = { 0.8169, -0.06545, 0.1726, 0.0185, -0.0359, 0.0458
}; float VAR_8[MAX_FRAMESIZE / 2], pred_err, acb_gain, fcb_gain; int VAR_9, VAR_10, VAR_11; AMRFixed fcb; assert(VAR_3 <= MAX_FRAMESIZE / 2); memset(VAR_8, 0, sizeof(*VAR_8) * VAR_3); fcb.pitch_lag      = VAR_4 >> 2; fcb.pitch_fac      = 1.0; fcb.no_repeat_mask = 0; fcb.VAR_9              = 0; if (VAR_5->fcb_type == FCB_TYPE_AW_PULSES) { aw_pulse_set1(VAR_0, VAR_1, VAR_2, &fcb); aw_pulse_set2(VAR_0, VAR_1, VAR_2, &fcb); } else  { int VAR_12 = 5 - VAR_5->log_n_blocks; fcb.no_repeat_mask = -1; for (VAR_9 = 0; VAR_9 < 5; VAR_9++) { float VAR_13; int VAR_14, VAR_15; VAR_13           = get_bits1(VAR_1) ? 1.0 : -1.0; VAR_14           = get_bits(VAR_1, VAR_12); fcb.x[fcb.VAR_9]   = VAR_9 + 5 * VAR_14; fcb.y[fcb.VAR_9++] = VAR_13; if (VAR_9 < VAR_5->dbl_pulses) { VAR_15           = get_bits(VAR_1, VAR_12); fcb.x[fcb.VAR_9]   = VAR_9 + 5 * VAR_15; fcb.y[fcb.VAR_9++] = (VAR_14 < VAR_15) ? -VAR_13 : VAR_13; } } } ff_set_fixed_vector(VAR_8, &fcb, 1.0, VAR_3); VAR_10 = get_bits(VAR_1, 7); fcb_gain = expf(avpriv_scalarproduct_float_c(VAR_0->gain_pred_err,
VAR_7, 6) -
5.2409161640 + wmavoice_gain_codebook_fcb[VAR_10]); acb_gain = wmavoice_gain_codebook_acb[VAR_10]; pred_err = av_clipf(wmavoice_gain_codebook_fcb[VAR_10],
-2.9957322736 ,
1.6094379124 ); VAR_11 = 8 >> VAR_5->log_n_blocks; memmove(&VAR_0->gain_pred_err[VAR_11], VAR_0->gain_pred_err,
sizeof(*VAR_0->gain_pred_err) * (6 - VAR_11)); for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9++) VAR_0->gain_pred_err[VAR_9] = pred_err; if (VAR_5->acb_type == ACB_TYPE_ASYMMETRIC) { int VAR_16; for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9 += VAR_16) { int VAR_17; int VAR_18    = VAR_2 * VAR_3 + VAR_9; int VAR_19 = (VAR_0->last_pitch_val << 16) +
VAR_0->pitch_diff_sh16 * VAR_18; int VAR_20      = (VAR_19 + 0x6FFF) >> 16; int VAR_21   = ((VAR_20 << 16) - VAR_19) * 8 + 0x58000; VAR_10            = VAR_21 >> 16; if (VAR_0->pitch_diff_sh16) { if (VAR_0->pitch_diff_sh16 > 0) { VAR_17 = (VAR_21) &~ 0xFFFF; } else VAR_17 = (VAR_21 + 0x10000) &~ 0xFFFF; VAR_16 = av_clip((VAR_21 - VAR_17) / VAR_0->pitch_diff_sh16 / 8,
1, VAR_3 - VAR_9); } else VAR_16 = VAR_3; ff_acelp_interpolatef(&VAR_6[VAR_9], &VAR_6[VAR_9 - VAR_20],
wmavoice_ipol1_coeffs, 17,
VAR_10, 9, VAR_16); } } else  { int VAR_22 = VAR_4 >> 2; VAR_10             = VAR_4 & 3; if (VAR_10) { ff_acelp_interpolatef(VAR_6, &VAR_6[-VAR_22],
wmavoice_ipol2_coeffs, 4,
VAR_10, 8, VAR_3); } else av_memcpy_backptr((uint8_t *) VAR_6, sizeof(float) * VAR_22,
sizeof(float) * VAR_3); } ff_weighted_vector_sumf(VAR_6, VAR_6, VAR_8,
acb_gain, fcb_gain, VAR_3); }