[FFmpeg-cvslog] r25961 - trunk/libavcodec/ac3enc.c

jbr subversion
Tue Dec 14 15:51:20 CET 2010


Author: jbr
Date: Tue Dec 14 15:51:20 2010
New Revision: 25961

Log:
Simplify group size calculation in 2 places.

Modified:
   trunk/libavcodec/ac3enc.c

Modified: trunk/libavcodec/ac3enc.c
==============================================================================
--- trunk/libavcodec/ac3enc.c	Tue Dec 14 15:51:17 2010	(r25960)
+++ trunk/libavcodec/ac3enc.c	Tue Dec 14 15:51:20 2010	(r25961)
@@ -309,18 +309,7 @@ static int encode_exp(uint8_t encoded_ex
     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(AC3Encode
 
     /* 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];
 



More information about the ffmpeg-cvslog mailing list