changeset 2048:533717e2910f libavcodec

h261 dequant fix
author michael
date Mon, 31 May 2004 00:42:55 +0000
parents 541686b38a5e
children 19c713e14316
files mpegvideo.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mpegvideo.c	Sun May 30 22:29:15 2004 +0000
+++ b/mpegvideo.c	Mon May 31 00:42:55 2004 +0000
@@ -5800,7 +5800,7 @@
 static void dct_unquantize_h261_intra_c(MpegEncContext *s, 
                                   DCTELEM *block, int n, int qscale)
 {
-    int i, level, odd;
+    int i, level, even;
     int nCoeffs;
     
     assert(s->block_last_index[n]>=0);
@@ -5809,16 +5809,16 @@
         block[0] = block[0] * s->y_dc_scale;
     else
         block[0] = block[0] * s->c_dc_scale;
-    odd = qscale & 0x1;
+    even = (qscale & 1)^1;
     nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
 
     for(i=1; i<=nCoeffs; i++){
         level = block[i];
         if (level){
             if (level < 0){
-                level = qscale * ((level << 1) - 1) + (~odd);
+                level = qscale * ((level << 1) - 1) + even;
             }else{
-                level = qscale * ((level << 1) + 1) - (~odd);
+                level = qscale * ((level << 1) + 1) - even;
             }
         }
         block[i] = level;
@@ -5828,12 +5828,12 @@
 static void dct_unquantize_h261_inter_c(MpegEncContext *s, 
                                   DCTELEM *block, int n, int qscale)
 {
-    int i, level, odd;
+    int i, level, even;
     int nCoeffs;
     
     assert(s->block_last_index[n]>=0);
-    
-    odd = qscale & 0x1;
+
+    even = (qscale & 1)^1;
     
     nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
 
@@ -5841,9 +5841,9 @@
         level = block[i];
         if (level){
             if (level < 0){
-                level = qscale * ((level << 1) - 1) + (~odd);
+                level = qscale * ((level << 1) - 1) + even;
             }else{
-                level = qscale * ((level << 1) + 1) - (~odd);
+                level = qscale * ((level << 1) + 1) - even;
             }
         }
         block[i] = level;