1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

fixed symetric quantization (better quality!)

Originally committed as revision 130 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Fabrice Bellard 2001-09-16 21:52:58 +00:00
parent 73120e555c
commit 8d67072fea

View File

@ -842,10 +842,12 @@ static inline int sym_quant(int c, int e, int levels)
int v; int v;
if (c >= 0) { if (c >= 0) {
v = (levels * (c << e)) >> 25; v = (levels * (c << e)) >> 24;
v = (v + 1) >> 1;
v = (levels >> 1) + v; v = (levels >> 1) + v;
} else { } else {
v = (levels * ((-c) << e)) >> 25; v = (levels * ((-c) << e)) >> 24;
v = (v + 1) >> 1;
v = (levels >> 1) - v; v = (levels >> 1) - v;
} }
assert (v >= 0 && v < levels); assert (v >= 0 && v < levels);