changeset 87:6f0e167504e8 libavcodec

fixed symetric quantization (better quality!)
author glantau
date Sun, 16 Sep 2001 21:52:58 +0000
parents 5e0eb8a361b7
children 06f63b58d2a8
files ac3enc.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ac3enc.c	Sun Sep 16 21:52:17 2001 +0000
+++ b/ac3enc.c	Sun Sep 16 21:52:58 2001 +0000
@@ -842,10 +842,12 @@
     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);