[xiph-commits] r17959 - trunk/theora/lib

tterribe at svn.xiph.org tterribe at svn.xiph.org
Wed May 4 12:27:58 PDT 2011


Author: tterribe
Date: 2011-05-04 12:27:58 -0700 (Wed, 04 May 2011)
New Revision: 17959

Modified:
   trunk/theora/lib/analyze.c
Log:
Another overflow fix.

This extends the fix from r17276 dealing with the removal of the DC
 skip-prevention flag in r17174.
If we allow SKIPing even when the cost is right near the maximum
 representable SSD, then the cost of other blocks can push it over
 the edge, causing us to randomly skip a block halfway through the
 macroblock.


Modified: trunk/theora/lib/analyze.c
===================================================================
--- trunk/theora/lib/analyze.c	2011-05-04 19:20:46 UTC (rev 17958)
+++ trunk/theora/lib/analyze.c	2011-05-04 19:27:58 UTC (rev 17959)
@@ -1866,7 +1866,7 @@
         best_qii=qii;
       }
     }
-    if(_skip_ssd[bi]<(UINT_MAX>>OC_BIT_SCALE)&&nskipped<3){
+    if(_skip_ssd[bi]<(UINT_MAX>>OC_BIT_SCALE+2)&&nskipped<3){
       *(ft+1)=*&fr;
       oc_fr_skip_block(ft+1);
       cur_overhead=ft[1].bits-fr.bits<<OC_BIT_SCALE;
@@ -1947,7 +1947,7 @@
           best_qii=qii;
         }
       }
-      if(_skip_ssd[bi]<(UINT_MAX>>OC_BIT_SCALE)){
+      if(_skip_ssd[bi]<(UINT_MAX>>OC_BIT_SCALE+2)){
         cur_ssd=_skip_ssd[bi]<<OC_BIT_SCALE;
         cur_cost=OC_MODE_RD_COST(ssd+cur_ssd,rate,lambda);
         if(cur_cost<=best_cost){



More information about the commits mailing list