[FFmpeg-cvslog] g723.1: replace loop of normalize_bits( by av_log2()
Michael Niedermayer
git at videolan.org
Thu Sep 29 22:09:48 CEST 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Sep 29 21:39:08 2011 +0200| [431f8af8242c41ef922f9daf791b0be26dc0bba4] | committer: Michael Niedermayer
g723.1: replace loop of normalize_bits( by av_log2()
idea by vitor
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=431f8af8242c41ef922f9daf791b0be26dc0bba4
---
libavcodec/g723_1.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index a48eca3..9c019a9 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -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;
}
More information about the ffmpeg-cvslog
mailing list