static void group_exponents(AC3EncodeContext *s)

{

    int blk, ch, i;

    int group_size, nb_groups, bit_count;

    uint8_t *p;

    int delta0, delta1, delta2;

    int exp0, exp1;



    bit_count = 0;

    for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {

        AC3Block *block = &s->blocks[blk];

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

            if (s->exp_strategy[ch][blk] == EXP_REUSE)

                continue;

            group_size = s->exp_strategy[ch][blk] + (s->exp_strategy[ch][blk] == EXP_D45);

            nb_groups = exponent_group_tab[s->exp_strategy[ch][blk]-1][s->nb_coefs[ch]];

            bit_count += 4 + (nb_groups * 7);

            p = block->exp[ch];



            /* DC exponent */

            exp1 = *p++;

            block->grouped_exp[ch][0] = exp1;



            /* remaining exponents are delta encoded */

            for (i = 1; i <= nb_groups; i++) {

                /* merge three delta in one code */

                exp0   = exp1;

                exp1   = p[0];

                p     += group_size;

                delta0 = exp1 - exp0 + 2;



                exp0   = exp1;

                exp1   = p[0];

                p     += group_size;

                delta1 = exp1 - exp0 + 2;



                exp0   = exp1;

                exp1   = p[0];

                p     += group_size;

                delta2 = exp1 - exp0 + 2;



                block->grouped_exp[ch][i] = ((delta0 * 5 + delta1) * 5) + delta2;

            }

        }

    }



    s->exponent_bits = bit_count;

}

static void group_exponents(AC3EncodeContext *s)

{

    int blk, ch, i;

    int group_size, nb_groups, bit_count;

    uint8_t *p;

    int delta0, delta1, delta2;

    int exp0, exp1;



    bit_count = 0;

    for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {

        AC3Block *block = &s->blocks[blk];

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

            if (s->exp_strategy[ch][blk] == EXP_REUSE)

                continue;

            group_size = s->exp_strategy[ch][blk] + (s->exp_strategy[ch][blk] == EXP_D45);

            nb_groups = exponent_group_tab[s->exp_strategy[ch][blk]-1][s->nb_coefs[ch]];

            bit_count += 4 + (nb_groups * 7);

            p = block->exp[ch];



            

            exp1 = *p++;

            block->grouped_exp[ch][0] = exp1;



            

            for (i = 1; i <= nb_groups; i++) {

                

                exp0   = exp1;

                exp1   = p[0];

                p     += group_size;

                delta0 = exp1 - exp0 + 2;



                exp0   = exp1;

                exp1   = p[0];

                p     += group_size;

                delta1 = exp1 - exp0 + 2;



                exp0   = exp1;

                exp1   = p[0];

                p     += group_size;

                delta2 = exp1 - exp0 + 2;



                block->grouped_exp[ch][i] = ((delta0 * 5 + delta1) * 5) + delta2;

            }

        }

    }



    s->exponent_bits = bit_count;

}

static void FUNC_0(AC3EncodeContext *VAR_0)

{

    int VAR_1, VAR_2, VAR_3;

    int VAR_4, VAR_5, VAR_6;

    uint8_t *p;

    int VAR_7, VAR_8, VAR_9;

    int VAR_10, VAR_11;



    VAR_6 = 0;

    for (VAR_1 = 0; VAR_1 < AC3_MAX_BLOCKS; VAR_1++) {

        AC3Block *block = &VAR_0->blocks[VAR_1];

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

            if (VAR_0->exp_strategy[VAR_2][VAR_1] == EXP_REUSE)

                continue;

            VAR_4 = VAR_0->exp_strategy[VAR_2][VAR_1] + (VAR_0->exp_strategy[VAR_2][VAR_1] == EXP_D45);

            VAR_5 = exponent_group_tab[VAR_0->exp_strategy[VAR_2][VAR_1]-1][VAR_0->nb_coefs[VAR_2]];

            VAR_6 += 4 + (VAR_5 * 7);

            p = block->exp[VAR_2];



            

            VAR_11 = *p++;

            block->grouped_exp[VAR_2][0] = VAR_11;



            

            for (VAR_3 = 1; VAR_3 <= VAR_5; VAR_3++) {

                

                VAR_10   = VAR_11;

                VAR_11   = p[0];

                p     += VAR_4;

                VAR_7 = VAR_11 - VAR_10 + 2;



                VAR_10   = VAR_11;

                VAR_11   = p[0];

                p     += VAR_4;

                VAR_8 = VAR_11 - VAR_10 + 2;



                VAR_10   = VAR_11;

                VAR_11   = p[0];

                p     += VAR_4;

                VAR_9 = VAR_11 - VAR_10 + 2;



                block->grouped_exp[VAR_2][VAR_3] = ((VAR_7 * 5 + VAR_8) * 5) + VAR_9;

            }

        }

    }



    VAR_0->exponent_bits = VAR_6;

}

static void FUNC_0(AC3EncodeContext *VAR_0)
{ int VAR_1, VAR_2, VAR_3; int VAR_4, VAR_5, VAR_6; uint8_t *p; int VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11; VAR_6 = 0; for (VAR_1 = 0; VAR_1 < AC3_MAX_BLOCKS; VAR_1++) { AC3Block *block = &VAR_0->blocks[VAR_1]; for (VAR_2 = 0; VAR_2 < VAR_0->channels; VAR_2++) { if (VAR_0->exp_strategy[VAR_2][VAR_1] == EXP_REUSE)
continue; VAR_4 = VAR_0->exp_strategy[VAR_2][VAR_1] + (VAR_0->exp_strategy[VAR_2][VAR_1] == EXP_D45); VAR_5 = exponent_group_tab[VAR_0->exp_strategy[VAR_2][VAR_1]-1][VAR_0->nb_coefs[VAR_2]]; VAR_6 += 4 + (VAR_5 * 7); p = block->exp[VAR_2]; VAR_11 = *p++; block->grouped_exp[VAR_2][0] = VAR_11; for (VAR_3 = 1; VAR_3 <= VAR_5; VAR_3++) { VAR_10   = VAR_11; VAR_11   = p[0]; p     += VAR_4; VAR_7 = VAR_11 - VAR_10 + 2; VAR_10   = VAR_11; VAR_11   = p[0]; p     += VAR_4; VAR_8 = VAR_11 - VAR_10 + 2; VAR_10   = VAR_11; VAR_11   = p[0]; p     += VAR_4; VAR_9 = VAR_11 - VAR_10 + 2; block->grouped_exp[VAR_2][VAR_3] = ((VAR_7 * 5 + VAR_8) * 5) + VAR_9; } } } VAR_0->exponent_bits = VAR_6; }