Commit 02877def authored by Justin Ruggles's avatar Justin Ruggles

Simplify group size calculation in 2 places.

Originally committed as revision 25961 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 98161553
...@@ -309,18 +309,7 @@ static int encode_exp(uint8_t encoded_exp[AC3_MAX_COEFS], ...@@ -309,18 +309,7 @@ static int encode_exp(uint8_t encoded_exp[AC3_MAX_COEFS],
int group_size, nb_groups, i, j, k, exp_min; int group_size, nb_groups, i, j, k, exp_min;
uint8_t exp1[AC3_MAX_COEFS]; uint8_t exp1[AC3_MAX_COEFS];
switch (exp_strategy) { group_size = exp_strategy + (exp_strategy == EXP_D45);
case EXP_D15:
group_size = 1;
break;
case EXP_D25:
group_size = 2;
break;
default:
case EXP_D45:
group_size = 4;
break;
}
nb_groups = ((nb_exps + (group_size * 3) - 4) / (3 * group_size)) * 3; nb_groups = ((nb_exps + (group_size * 3) - 4) / (3 * group_size)) * 3;
/* for each group, compute the minimum exponent */ /* for each group, compute the minimum exponent */
...@@ -833,20 +822,9 @@ static void output_audio_block(AC3EncodeContext *s, ...@@ -833,20 +822,9 @@ static void output_audio_block(AC3EncodeContext *s,
/* exponents */ /* exponents */
for (ch = 0; ch < s->channels; ch++) { for (ch = 0; ch < s->channels; ch++) {
switch (exp_strategy[ch]) { if (exp_strategy[ch] == EXP_REUSE)
case EXP_REUSE:
continue; continue;
case EXP_D15: group_size = exp_strategy[ch] + (exp_strategy[ch] == EXP_D45);
group_size = 1;
break;
case EXP_D25:
group_size = 2;
break;
default:
case EXP_D45:
group_size = 4;
break;
}
nb_groups = (s->nb_coefs[ch] + (group_size * 3) - 4) / (3 * group_size); nb_groups = (s->nb_coefs[ch] + (group_size * 3) - 4) / (3 * group_size);
p = encoded_exp[ch]; p = encoded_exp[ch];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment