From 8d67072fea31e3b97e0a527e2a94e418745ba02a Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Sun, 16 Sep 2001 21:52:58 +0000 Subject: [PATCH] fixed symetric quantization (better quality!) Originally committed as revision 130 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ac3enc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 0754c86570..d44347396b 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -842,10 +842,12 @@ static inline int sym_quant(int c, int e, int levels) int v; if (c >= 0) { - v = (levels * (c << e)) >> 25; + v = (levels * (c << e)) >> 24; + v = (v + 1) >> 1; v = (levels >> 1) + v; } else { - v = (levels * ((-c) << e)) >> 25; + v = (levels * ((-c) << e)) >> 24; + v = (v + 1) >> 1; v = (levels >> 1) - v; } assert (v >= 0 && v < levels);