static void decode_block(BinkAudioContext *s, short *out, int use_dct)

{

    int ch, i, j, k;

    float q, quant[25];

    int width, coeff;

    GetBitContext *gb = &s->gb;



    if (use_dct)

        skip_bits(gb, 2);



    for (ch = 0; ch < s->channels; ch++) {

        FFTSample *coeffs = s->coeffs_ptr[ch];

        q = 0.0f;

        coeffs[0] = get_float(gb) * s->root;

        coeffs[1] = get_float(gb) * s->root;



        for (i = 0; i < s->num_bands; i++) {

            /* constant is result of 0.066399999/log10(M_E) */

            int value = get_bits(gb, 8);

            quant[i] = expf(FFMIN(value, 95) * 0.15289164787221953823f) * s->root;

        }



        // find band (k)

        for (k = 0; s->bands[k] < 1; k++) {

            q = quant[k];

        }



        // parse coefficients

        i = 2;

        while (i < s->frame_len) {

            if (get_bits1(gb)) {

                j = i + rle_length_tab[get_bits(gb, 4)] * 8;

            } else {

                j = i + 8;

            }



            j = FFMIN(j, s->frame_len);



            width = get_bits(gb, 4);

            if (width == 0) {

                memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));

                i = j;

                while (s->bands[k] < i)

                    q = quant[k++];

            } else {

                while (i < j) {

                    if (s->bands[k] == i)

                        q = quant[k++];

                    coeff = get_bits(gb, width);

                    if (coeff) {

                        if (get_bits1(gb))

                            coeffs[i] = -q * coeff;

                        else

                            coeffs[i] =  q * coeff;

                    } else {

                        coeffs[i] = 0.0f;

                    }

                    i++;

                }

            }

        }



        if (CONFIG_BINKAUDIO_DCT_DECODER && use_dct) {

            coeffs[0] /= 0.5;

            ff_dct_calc (&s->trans.dct,  coeffs);

            s->dsp.vector_fmul_scalar(coeffs, coeffs, s->frame_len / 2, s->frame_len);

        }

        else if (CONFIG_BINKAUDIO_RDFT_DECODER)

            ff_rdft_calc(&s->trans.rdft, coeffs);

    }



    s->fmt_conv.float_to_int16_interleave(out, (const float **)s->coeffs_ptr,

                                          s->frame_len, s->channels);



    if (!s->first) {

        int count = s->overlap_len * s->channels;

        int shift = av_log2(count);

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

            out[i] = (s->previous[i] * (count - i) + out[i] * i) >> shift;

        }

    }



    memcpy(s->previous, out + s->block_size,

           s->overlap_len * s->channels * sizeof(*out));



    s->first = 0;

}

static void decode_block(BinkAudioContext *s, short *out, int use_dct)

{

    int ch, i, j, k;

    float q, quant[25];

    int width, coeff;

    GetBitContext *gb = &s->gb;



    if (use_dct)

        skip_bits(gb, 2);



    for (ch = 0; ch < s->channels; ch++) {

        FFTSample *coeffs = s->coeffs_ptr[ch];

        q = 0.0f;

        coeffs[0] = get_float(gb) * s->root;

        coeffs[1] = get_float(gb) * s->root;



        for (i = 0; i < s->num_bands; i++) {

            

            int value = get_bits(gb, 8);

            quant[i] = expf(FFMIN(value, 95) * 0.15289164787221953823f) * s->root;

        }



        

        for (k = 0; s->bands[k] < 1; k++) {

            q = quant[k];

        }



        

        i = 2;

        while (i < s->frame_len) {

            if (get_bits1(gb)) {

                j = i + rle_length_tab[get_bits(gb, 4)] * 8;

            } else {

                j = i + 8;

            }



            j = FFMIN(j, s->frame_len);



            width = get_bits(gb, 4);

            if (width == 0) {

                memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));

                i = j;

                while (s->bands[k] < i)

                    q = quant[k++];

            } else {

                while (i < j) {

                    if (s->bands[k] == i)

                        q = quant[k++];

                    coeff = get_bits(gb, width);

                    if (coeff) {

                        if (get_bits1(gb))

                            coeffs[i] = -q * coeff;

                        else

                            coeffs[i] =  q * coeff;

                    } else {

                        coeffs[i] = 0.0f;

                    }

                    i++;

                }

            }

        }



        if (CONFIG_BINKAUDIO_DCT_DECODER && use_dct) {

            coeffs[0] /= 0.5;

            ff_dct_calc (&s->trans.dct,  coeffs);

            s->dsp.vector_fmul_scalar(coeffs, coeffs, s->frame_len / 2, s->frame_len);

        }

        else if (CONFIG_BINKAUDIO_RDFT_DECODER)

            ff_rdft_calc(&s->trans.rdft, coeffs);

    }



    s->fmt_conv.float_to_int16_interleave(out, (const float **)s->coeffs_ptr,

                                          s->frame_len, s->channels);



    if (!s->first) {

        int count = s->overlap_len * s->channels;

        int shift = av_log2(count);

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

            out[i] = (s->previous[i] * (count - i) + out[i] * i) >> shift;

        }

    }



    memcpy(s->previous, out + s->block_size,

           s->overlap_len * s->channels * sizeof(*out));



    s->first = 0;

}

static void FUNC_0(BinkAudioContext *VAR_0, short *VAR_1, int VAR_2)

{

    int VAR_3, VAR_4, VAR_5, VAR_6;

    float VAR_7, VAR_8[25];

    int VAR_9, VAR_10;

    GetBitContext *gb = &VAR_0->gb;



    if (VAR_2)

        skip_bits(gb, 2);



    for (VAR_3 = 0; VAR_3 < VAR_0->channels; VAR_3++) {

        FFTSample *coeffs = VAR_0->coeffs_ptr[VAR_3];

        VAR_7 = 0.0f;

        coeffs[0] = get_float(gb) * VAR_0->root;

        coeffs[1] = get_float(gb) * VAR_0->root;



        for (VAR_4 = 0; VAR_4 < VAR_0->num_bands; VAR_4++) {

            

            int value = get_bits(gb, 8);

            VAR_8[VAR_4] = expf(FFMIN(value, 95) * 0.15289164787221953823f) * VAR_0->root;

        }



        

        for (VAR_6 = 0; VAR_0->bands[VAR_6] < 1; VAR_6++) {

            VAR_7 = VAR_8[VAR_6];

        }



        

        VAR_4 = 2;

        while (VAR_4 < VAR_0->frame_len) {

            if (get_bits1(gb)) {

                VAR_5 = VAR_4 + rle_length_tab[get_bits(gb, 4)] * 8;

            } else {

                VAR_5 = VAR_4 + 8;

            }



            VAR_5 = FFMIN(VAR_5, VAR_0->frame_len);



            VAR_9 = get_bits(gb, 4);

            if (VAR_9 == 0) {

                memset(coeffs + VAR_4, 0, (VAR_5 - VAR_4) * sizeof(*coeffs));

                VAR_4 = VAR_5;

                while (VAR_0->bands[VAR_6] < VAR_4)

                    VAR_7 = VAR_8[VAR_6++];

            } else {

                while (VAR_4 < VAR_5) {

                    if (VAR_0->bands[VAR_6] == VAR_4)

                        VAR_7 = VAR_8[VAR_6++];

                    VAR_10 = get_bits(gb, VAR_9);

                    if (VAR_10) {

                        if (get_bits1(gb))

                            coeffs[VAR_4] = -VAR_7 * VAR_10;

                        else

                            coeffs[VAR_4] =  VAR_7 * VAR_10;

                    } else {

                        coeffs[VAR_4] = 0.0f;

                    }

                    VAR_4++;

                }

            }

        }



        if (CONFIG_BINKAUDIO_DCT_DECODER && VAR_2) {

            coeffs[0] /= 0.5;

            ff_dct_calc (&VAR_0->trans.dct,  coeffs);

            VAR_0->dsp.vector_fmul_scalar(coeffs, coeffs, VAR_0->frame_len / 2, VAR_0->frame_len);

        }

        else if (CONFIG_BINKAUDIO_RDFT_DECODER)

            ff_rdft_calc(&VAR_0->trans.rdft, coeffs);

    }



    VAR_0->fmt_conv.float_to_int16_interleave(VAR_1, (const float **)VAR_0->coeffs_ptr,

                                          VAR_0->frame_len, VAR_0->channels);



    if (!VAR_0->first) {

        int VAR_11 = VAR_0->overlap_len * VAR_0->channels;

        int VAR_12 = av_log2(VAR_11);

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

            VAR_1[VAR_4] = (VAR_0->previous[VAR_4] * (VAR_11 - VAR_4) + VAR_1[VAR_4] * VAR_4) >> VAR_12;

        }

    }



    memcpy(VAR_0->previous, VAR_1 + VAR_0->block_size,

           VAR_0->overlap_len * VAR_0->channels * sizeof(*VAR_1));



    VAR_0->first = 0;

}

static void FUNC_0(BinkAudioContext *VAR_0, short *VAR_1, int VAR_2)
{ int VAR_3, VAR_4, VAR_5, VAR_6; float VAR_7, VAR_8[25]; int VAR_9, VAR_10; GetBitContext *gb = &VAR_0->gb; if (VAR_2)
skip_bits(gb, 2); for (VAR_3 = 0; VAR_3 < VAR_0->channels; VAR_3++) { FFTSample *coeffs = VAR_0->coeffs_ptr[VAR_3]; VAR_7 = 0.0f; coeffs[0] = get_float(gb) * VAR_0->root; coeffs[1] = get_float(gb) * VAR_0->root; for (VAR_4 = 0; VAR_4 < VAR_0->num_bands; VAR_4++) { int value = get_bits(gb, 8); VAR_8[VAR_4] = expf(FFMIN(value, 95) * 0.15289164787221953823f) * VAR_0->root; } for (VAR_6 = 0; VAR_0->bands[VAR_6] < 1; VAR_6++) { VAR_7 = VAR_8[VAR_6]; } VAR_4 = 2; while (VAR_4 < VAR_0->frame_len) { if (get_bits1(gb)) { VAR_5 = VAR_4 + rle_length_tab[get_bits(gb, 4)] * 8; } else { VAR_5 = VAR_4 + 8; } VAR_5 = FFMIN(VAR_5, VAR_0->frame_len); VAR_9 = get_bits(gb, 4); if (VAR_9 == 0) { memset(coeffs + VAR_4, 0, (VAR_5 - VAR_4) * sizeof(*coeffs)); VAR_4 = VAR_5; while (VAR_0->bands[VAR_6] < VAR_4)
VAR_7 = VAR_8[VAR_6++]; } else { while (VAR_4 < VAR_5) { if (VAR_0->bands[VAR_6] == VAR_4)
VAR_7 = VAR_8[VAR_6++]; VAR_10 = get_bits(gb, VAR_9); if (VAR_10) { if (get_bits1(gb))
coeffs[VAR_4] = -VAR_7 * VAR_10; else
coeffs[VAR_4] =  VAR_7 * VAR_10; } else { coeffs[VAR_4] = 0.0f; } VAR_4++; } } } if (CONFIG_BINKAUDIO_DCT_DECODER && VAR_2) { coeffs[0] /= 0.5; ff_dct_calc (&VAR_0->trans.dct,  coeffs); VAR_0->dsp.vector_fmul_scalar(coeffs, coeffs, VAR_0->frame_len / 2, VAR_0->frame_len); } else if (CONFIG_BINKAUDIO_RDFT_DECODER)
ff_rdft_calc(&VAR_0->trans.rdft, coeffs); } VAR_0->fmt_conv.float_to_int16_interleave(VAR_1, (const float **)VAR_0->coeffs_ptr,
VAR_0->frame_len, VAR_0->channels); if (!VAR_0->first) { int VAR_11 = VAR_0->overlap_len * VAR_0->channels; int VAR_12 = av_log2(VAR_11); for (VAR_4 = 0; VAR_4 < VAR_11; VAR_4++) { VAR_1[VAR_4] = (VAR_0->previous[VAR_4] * (VAR_11 - VAR_4) + VAR_1[VAR_4] * VAR_4) >> VAR_12; } } memcpy(VAR_0->previous, VAR_1 + VAR_0->block_size,
VAR_0->overlap_len * VAR_0->channels * sizeof(*VAR_1)); VAR_0->first = 0; }