[FFmpeg-soc] [soc]: r854 - dirac/libavcodec/dirac.c

marco subversion at mplayerhq.hu
Thu Aug 16 14:03:43 CEST 2007


Author: marco
Date: Thu Aug 16 14:03:43 2007
New Revision: 854

Log:
use FFABS instead of abs

Modified:
   dirac/libavcodec/dirac.c

Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c	(original)
+++ dirac/libavcodec/dirac.c	Thu Aug 16 14:03:43 2007
@@ -770,7 +770,7 @@ static int inline coeff_quant_offset(Dir
  */
 static int inline coeff_dequant(int coeff,
                                 int qoffset, int qfactor) {
-    int64_t magnitude = FFABS(coeff) * qfactor;
+    int64_t magnitude = coeff * qfactor;
 
     if (! magnitude)
         return 0;
@@ -778,9 +778,6 @@ static int inline coeff_dequant(int coef
     magnitude += qoffset;
     magnitude >>= 2;
 
-    /* Reintroduce the sign.  */
-    if (coeff < 0)
-        magnitude = -magnitude;
     return magnitude;
 }
 
@@ -887,6 +884,7 @@ static void coeff_unpack(DiracContext *s
     int sign_pred;
     int idx;
     int coeff;
+    int read_sign;
     struct dirac_arith_context_set *context;
     int vdata, hdata;
 
@@ -911,10 +909,16 @@ static void coeff_unpack(DiracContext *s
 
     context = &context_sets_waveletcoeff[idx];
 
-    coeff = dirac_arith_read_int(&s->arith, context);
+    coeff = dirac_arith_read_uint(&s->arith, context);
     vdata = coeff_posy(s, level, orientation, v);
     hdata = coeff_posx(s, level, orientation, h);
+
+    read_sign = coeff;
     coeff = coeff_dequant(coeff, qoffset, qfactor);
+    if (read_sign) {
+        if (dirac_arith_get_bit(&s->arith, context->sign))
+            coeff = -coeff;
+    }
 
     data[hdata + vdata * s->padded_width] = coeff;
 }



More information about the FFmpeg-soc mailing list