g723.1: replace loop of normalize_bits( by av_log2()
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 29 Sep 2011 19:39:08 +0000 (21:39 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 29 Sep 2011 19:44:03 +0000 (21:44 +0200)
idea by vitor
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/g723_1.c

index a48eca3..9c019a9 100644 (file)
@@ -216,8 +216,8 @@ static int normalize_bits(int num, int width)
             return bits;
         if (num < 0)
             num = ~num;
-        for (i = 0; num < limit; i++)
-            num <<= 1;
+        i= bits - av_log2(num) - 1;
+        i= FFMAX(i, 0);
     }
     return i;
 }