OSDN Git Service

ac3dsp: simplify extract_exponents() now that it does not need to do clipping.
authorJustin Ruggles <justin.ruggles@gmail.com>
Thu, 16 Jun 2011 20:55:33 +0000 (16:55 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Fri, 1 Jul 2011 17:02:11 +0000 (13:02 -0400)
libavcodec/ac3dsp.c

index 8ce5f8d..98c7357 100644 (file)
@@ -164,21 +164,8 @@ static void ac3_extract_exponents_c(uint8_t *exp, int32_t *coef, int nb_coefs)
     int i;
 
     for (i = 0; i < nb_coefs; i++) {
-        int e;
         int v = abs(coef[i]);
-        if (v == 0)
-            e = 24;
-        else {
-            e = 23 - av_log2(v);
-            if (e >= 24) {
-                e = 24;
-                coef[i] = 0;
-            } else if (e < 0) {
-                e = 0;
-                coef[i] = av_clip(coef[i], -16777215, 16777215);
-            }
-        }
-        exp[i] = e;
+        exp[i] = v ? 23 - av_log2(v) : 24;
     }
 }