From 02877def4993f438df78ae6a0edf70379a14aed1 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 14 Dec 2010 14:51:20 +0000 Subject: [PATCH] Simplify group size calculation in 2 places. Originally committed as revision 25961 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ac3enc.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index e094ea830f..0359773be5 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -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; uint8_t exp1[AC3_MAX_COEFS]; - switch (exp_strategy) { - case EXP_D15: - group_size = 1; - break; - case EXP_D25: - group_size = 2; - break; - default: - case EXP_D45: - group_size = 4; - break; - } + group_size = exp_strategy + (exp_strategy == EXP_D45); nb_groups = ((nb_exps + (group_size * 3) - 4) / (3 * group_size)) * 3; /* for each group, compute the minimum exponent */ @@ -833,20 +822,9 @@ static void output_audio_block(AC3EncodeContext *s, /* exponents */ for (ch = 0; ch < s->channels; ch++) { - switch (exp_strategy[ch]) { - case EXP_REUSE: + if (exp_strategy[ch] == EXP_REUSE) continue; - case EXP_D15: - group_size = 1; - break; - case EXP_D25: - group_size = 2; - break; - default: - case EXP_D45: - group_size = 4; - break; - } + group_size = exp_strategy[ch] + (exp_strategy[ch] == EXP_D45); nb_groups = (s->nb_coefs[ch] + (group_size * 3) - 4) / (3 * group_size); p = encoded_exp[ch];