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

giles at motherfish-iii.xiph.org giles at motherfish-iii.xiph.org
Wed Sep 15 22:54:23 PDT 2004


Author: giles
Date: 2004-09-15 22:54:23 -0700 (Wed, 15 Sep 2004)
New Revision: 7770

Modified:
   trunk/theora/lib/mcomp.c
Log:
Fix a double-update in GetHalfPixelSumAbsDiffs().

When RefOffset was 0, this routine falls back to the non-fractional 
pixel version, GetSumAbsDiffs(). However, both routines treat the error 
as an accumulator, initializing DiffVal to the passed ErrorSoFar and 
then adding their own contribution. This was problematic, as each 
recursion level repeated the initialization, resulting in an 
effective initial value of 2*ErrorSoFar. We instead pass '0' for 
ErrorSoFar in the recursion so that only the specific contribution in 
added to the accumulator.

Thanks to Wim Taymans for pointing out the issue.



Modified: trunk/theora/lib/mcomp.c
===================================================================
--- trunk/theora/lib/mcomp.c	2004-09-16 05:34:24 UTC (rev 7769)
+++ trunk/theora/lib/mcomp.c	2004-09-16 05:54:23 UTC (rev 7770)
@@ -273,7 +273,7 @@
   if ( RefOffset == 0 ) {
     /* Simple case as for non 0.5 pixel */
     DiffVal += GetSumAbsDiffs( SrcData, RefDataPtr1, PixelsPerLine,
-                               ErrorSoFar);
+                               0);
   } else  {
     for ( i=0; i < BLOCK_HEIGHT_WIDTH; i++ ) {
       DiffVal += abs( ((int)SrcData[0]) - (((int)RefDataPtr1[0] +



More information about the commits mailing list