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:
parent
73120e555c
commit
8d67072fea
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user