[FFmpeg-cvslog] g723_1dec: inline normalize_bits() in scale vector and optimize it.

Michael Niedermayer git at videolan.org
Mon Aug 13 15:42:56 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Aug 13 15:18:47 2012 +0200| [603221ebd03348c2cabe9516c60bb6ef183a3880] | committer: Michael Niedermayer

g723_1dec: inline normalize_bits() in scale vector and optimize it.

many branches and cases of scale_vector are irrelevant for the case here
and by inlining they can be reliably removed.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=603221ebd03348c2cabe9516c60bb6ef183a3880
---

 libavcodec/g723_1.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index ae73799..72151b4 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -257,7 +257,8 @@ static int scale_vector(int16_t *dst, const int16_t *vector, int length)
     for (i = 0; i < length; i++)
         max |= FFABS(vector[i]);
 
-    bits  = normalize_bits(max, 15);
+    bits= 14 - av_log2_16bit(max);
+    bits= FFMAX(bits, 0);
 
     for (i = 0; i < length; i++)
         dst[i] = vector[i] << bits >> 3;



More information about the ffmpeg-cvslog mailing list