diff ivi_common.c @ 11864:7204cb7dd601 libavcodec

Quant changes only once per MB so move the corresponding scale factor assignment out of the block decoding loop. Indeo4 doesn't use any scale table but the quant level itself as scale. Therefore access scale table only if its pointer != NULL.
author maxim
date Thu, 10 Jun 2010 17:31:12 +0000
parents 1547c744b8d4
children fdafbcef52f5
line wrap: on
line diff
--- a/ivi_common.c	Thu Jun 10 16:59:56 2010 +0000
+++ b/ivi_common.c	Thu Jun 10 17:31:12 2010 +0000
@@ -364,6 +364,8 @@
 
         base_tab  = is_intra ? band->intra_base  : band->inter_base;
         scale_tab = is_intra ? band->intra_scale : band->inter_scale;
+        if (scale_tab)
+            quant = scale_tab[quant];
 
         if (!is_intra) {
             mv_x = mb->mv_x;
@@ -415,7 +417,7 @@
                     if (IVI_DEBUG && !val)
                         av_log(NULL, AV_LOG_ERROR, "Val = 0 encountered!\n");
 
-                    q = (base_tab[pos] * scale_tab[quant]) >> 9;
+                    q = (base_tab[pos] * quant) >> 9;
                     if (q > 1)
                         val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1);
                     trvec[pos] = val;