static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_groups *m)

{

    int start_freq = s->start_freq[ch_index];

    int end_freq   = s->end_freq[ch_index];

    uint8_t *baps  = s->bap[ch_index];

    int8_t *exps   = s->dexps[ch_index];

    int32_t *coeffs = s->fixed_coeffs[ch_index];

    int dither     = (ch_index == CPL_CH) || s->dither_flag[ch_index];

    GetBitContext *gbc = &s->gbc;

    int freq;



    for (freq = start_freq; freq < end_freq; freq++) {

        int bap = baps[freq];

        int mantissa;

        switch (bap) {

        case 0:

            /* random noise with approximate range of -0.707 to 0.707 */

            if (dither)

                mantissa = (((av_lfg_get(&s->dith_state)>>8)*181)>>8) - 5931008;

            else

                mantissa = 0;

            break;

        case 1:

            if (m->b1) {

                m->b1--;

                mantissa = m->b1_mant[m->b1];

            } else {

                int bits      = get_bits(gbc, 5);

                mantissa      = b1_mantissas[bits][0];

                m->b1_mant[1] = b1_mantissas[bits][1];

                m->b1_mant[0] = b1_mantissas[bits][2];

                m->b1         = 2;


            break;

        case 2:

            if (m->b2) {

                m->b2--;

                mantissa = m->b2_mant[m->b2];

            } else {

                int bits      = get_bits(gbc, 7);

                mantissa      = b2_mantissas[bits][0];

                m->b2_mant[1] = b2_mantissas[bits][1];

                m->b2_mant[0] = b2_mantissas[bits][2];

                m->b2         = 2;


            break;

        case 3:

            mantissa = b3_mantissas[get_bits(gbc, 3)];

            break;

        case 4:

            if (m->b4) {

                m->b4 = 0;

                mantissa = m->b4_mant;

            } else {

                int bits   = get_bits(gbc, 7);

                mantissa   = b4_mantissas[bits][0];

                m->b4_mant = b4_mantissas[bits][1];

                m->b4      = 1;


            break;

        case 5:

            mantissa = b5_mantissas[get_bits(gbc, 4)];

            break;

        default: /* 6 to 15 */

            /* Shift mantissa and sign-extend it. */





            mantissa = get_sbits(gbc, quantization_tab[bap]);

            mantissa <<= 24 - quantization_tab[bap];

            break;


        coeffs[freq] = mantissa >> exps[freq];


static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_groups *m)

{

    int start_freq = s->start_freq[ch_index];

    int end_freq   = s->end_freq[ch_index];

    uint8_t *baps  = s->bap[ch_index];

    int8_t *exps   = s->dexps[ch_index];

    int32_t *coeffs = s->fixed_coeffs[ch_index];

    int dither     = (ch_index == CPL_CH) || s->dither_flag[ch_index];

    GetBitContext *gbc = &s->gbc;

    int freq;



    for (freq = start_freq; freq < end_freq; freq++) {

        int bap = baps[freq];

        int mantissa;

        switch (bap) {

        case 0:

            

            if (dither)

                mantissa = (((av_lfg_get(&s->dith_state)>>8)*181)>>8) - 5931008;

            else

                mantissa = 0;

            break;

        case 1:

            if (m->b1) {

                m->b1--;

                mantissa = m->b1_mant[m->b1];

            } else {

                int bits      = get_bits(gbc, 5);

                mantissa      = b1_mantissas[bits][0];

                m->b1_mant[1] = b1_mantissas[bits][1];

                m->b1_mant[0] = b1_mantissas[bits][2];

                m->b1         = 2;


            break;

        case 2:

            if (m->b2) {

                m->b2--;

                mantissa = m->b2_mant[m->b2];

            } else {

                int bits      = get_bits(gbc, 7);

                mantissa      = b2_mantissas[bits][0];

                m->b2_mant[1] = b2_mantissas[bits][1];

                m->b2_mant[0] = b2_mantissas[bits][2];

                m->b2         = 2;


            break;

        case 3:

            mantissa = b3_mantissas[get_bits(gbc, 3)];

            break;

        case 4:

            if (m->b4) {

                m->b4 = 0;

                mantissa = m->b4_mant;

            } else {

                int bits   = get_bits(gbc, 7);

                mantissa   = b4_mantissas[bits][0];

                m->b4_mant = b4_mantissas[bits][1];

                m->b4      = 1;


            break;

        case 5:

            mantissa = b5_mantissas[get_bits(gbc, 4)];

            break;

        default: 

            





            mantissa = get_sbits(gbc, quantization_tab[bap]);

            mantissa <<= 24 - quantization_tab[bap];

            break;


        coeffs[freq] = mantissa >> exps[freq];


static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1, mant_groups *VAR_2)

{

    int VAR_3 = VAR_0->VAR_3[VAR_1];

    int VAR_4   = VAR_0->VAR_4[VAR_1];

    uint8_t *baps  = VAR_0->VAR_7[VAR_1];

    int8_t *exps   = VAR_0->dexps[VAR_1];

    int32_t *coeffs = VAR_0->fixed_coeffs[VAR_1];

    int VAR_5     = (VAR_1 == CPL_CH) || VAR_0->dither_flag[VAR_1];

    GetBitContext *gbc = &VAR_0->gbc;

    int VAR_6;



    for (VAR_6 = VAR_3; VAR_6 < VAR_4; VAR_6++) {

        int VAR_7 = baps[VAR_6];

        int VAR_8;

        switch (VAR_7) {

        case 0:

            

            if (VAR_5)

                VAR_8 = (((av_lfg_get(&VAR_0->dith_state)>>8)*181)>>8) - 5931008;

            else

                VAR_8 = 0;

            break;

        case 1:

            if (VAR_2->b1) {

                VAR_2->b1--;

                VAR_8 = VAR_2->b1_mant[VAR_2->b1];

            } else {

                int VAR_10      = get_bits(gbc, 5);

                VAR_8      = b1_mantissas[VAR_10][0];

                VAR_2->b1_mant[1] = b1_mantissas[VAR_10][1];

                VAR_2->b1_mant[0] = b1_mantissas[VAR_10][2];

                VAR_2->b1         = 2;


            break;

        case 2:

            if (VAR_2->b2) {

                VAR_2->b2--;

                VAR_8 = VAR_2->b2_mant[VAR_2->b2];

            } else {

                int VAR_10      = get_bits(gbc, 7);

                VAR_8      = b2_mantissas[VAR_10][0];

                VAR_2->b2_mant[1] = b2_mantissas[VAR_10][1];

                VAR_2->b2_mant[0] = b2_mantissas[VAR_10][2];

                VAR_2->b2         = 2;


            break;

        case 3:

            VAR_8 = b3_mantissas[get_bits(gbc, 3)];

            break;

        case 4:

            if (VAR_2->b4) {

                VAR_2->b4 = 0;

                VAR_8 = VAR_2->b4_mant;

            } else {

                int VAR_10   = get_bits(gbc, 7);

                VAR_8   = b4_mantissas[VAR_10][0];

                VAR_2->b4_mant = b4_mantissas[VAR_10][1];

                VAR_2->b4      = 1;


            break;

        case 5:

            VAR_8 = b5_mantissas[get_bits(gbc, 4)];

            break;

        default: 

            





            VAR_8 = get_sbits(gbc, quantization_tab[VAR_7]);

            VAR_8 <<= 24 - quantization_tab[VAR_7];

            break;


        coeffs[VAR_6] = VAR_8 >> exps[VAR_6];


static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1, mant_groups *VAR_2)
{ int VAR_3 = VAR_0->VAR_3[VAR_1]; int VAR_4   = VAR_0->VAR_4[VAR_1]; uint8_t *baps  = VAR_0->VAR_7[VAR_1]; int8_t *exps   = VAR_0->dexps[VAR_1]; int32_t *coeffs = VAR_0->fixed_coeffs[VAR_1]; int VAR_5     = (VAR_1 == CPL_CH) || VAR_0->dither_flag[VAR_1]; GetBitContext *gbc = &VAR_0->gbc; int VAR_6; for (VAR_6 = VAR_3; VAR_6 < VAR_4; VAR_6++) { int VAR_7 = baps[VAR_6]; int VAR_8; switch (VAR_7) { case 0:
if (VAR_5)
VAR_8 = (((av_lfg_get(&VAR_0->dith_state)>>8)*181)>>8) - 5931008; else
VAR_8 = 0; break; case 1:
if (VAR_2->b1) { VAR_2->b1--; VAR_8 = VAR_2->b1_mant[VAR_2->b1]; } else { int VAR_10      = get_bits(gbc, 5); VAR_8      = b1_mantissas[VAR_10][0]; VAR_2->b1_mant[1] = b1_mantissas[VAR_10][1]; VAR_2->b1_mant[0] = b1_mantissas[VAR_10][2]; VAR_2->b1         = 2; break; case 2:
if (VAR_2->b2) { VAR_2->b2--; VAR_8 = VAR_2->b2_mant[VAR_2->b2]; } else { int VAR_10      = get_bits(gbc, 7); VAR_8      = b2_mantissas[VAR_10][0]; VAR_2->b2_mant[1] = b2_mantissas[VAR_10][1]; VAR_2->b2_mant[0] = b2_mantissas[VAR_10][2]; VAR_2->b2         = 2; break; case 3:
VAR_8 = b3_mantissas[get_bits(gbc, 3)]; break; case 4:
if (VAR_2->b4) { VAR_2->b4 = 0; VAR_8 = VAR_2->b4_mant; } else { int VAR_10   = get_bits(gbc, 7); VAR_8   = b4_mantissas[VAR_10][0]; VAR_2->b4_mant = b4_mantissas[VAR_10][1]; VAR_2->b4      = 1; break; case 5:
VAR_8 = b5_mantissas[get_bits(gbc, 4)]; break; default:
VAR_8 = get_sbits(gbc, quantization_tab[VAR_7]); VAR_8 <<= 24 - quantization_tab[VAR_7]; break; coeffs[VAR_6] = VAR_8 >> exps[VAR_6];