Commit 8d67072f authored by Fabrice Bellard's avatar Fabrice Bellard

fixed symetric quantization (better quality!)


Originally committed as revision 130 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 73120e55
...@@ -842,10 +842,12 @@ static inline int sym_quant(int c, int e, int levels) ...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment