[xiph-commits] r12406 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Wed Jan 31 13:33:10 PST 2007


Author: xiphmont
Date: 2007-01-31 13:33:09 -0800 (Wed, 31 Jan 2007)
New Revision: 12406

Modified:
   trunk/sushivision/panel-2d.c
Log:
Hack fast_scale variants to not drop the last value of a vector to be scaled.



Modified: trunk/sushivision/panel-2d.c
===================================================================
--- trunk/sushivision/panel-2d.c	2007-01-31 20:10:04 UTC (rev 12405)
+++ trunk/sushivision/panel-2d.c	2007-01-31 21:33:09 UTC (rev 12406)
@@ -613,8 +613,17 @@
   for(x=0;x<w;x++){
     double xval = (x)*newscale+new_lo;
     double map = ((xval-old_lo)*oldscale);
-    mapbase[x]=(int)floor(map);
-    mapdel[x]=map-floor(map);
+    int base = (int)floor(map);
+    double del = map - floor(map);
+    /* hack to overwhelm roundoff error; this is inside a purely
+       temporary cosmetic approximation anyway*/
+    if(base>0 && del < .0001){
+      mapbase[x]=base-1;
+      mapdel[x]=1.f;
+    }else{
+      mapbase[x]=base;
+      mapdel[x]=del;
+    }
   }
 
   for(y=0;y<h;y++){
@@ -660,8 +669,17 @@
   for(y=0;y<h;y++){
     double yval = (y)*newscale+new_lo;
     double map = ((yval-old_lo)*oldscale);
-    mapbase[y]=(int)floor(map);
-    mapdel[y]=map-floor(map);
+    int base = (int)floor(map);
+    double del = map - floor(map);
+    /* hack to overwhelm roundoff error; this is inside a purely
+       temporary cosmetic approximation anyway*/
+    if(base>0 && del < .0001){
+      mapbase[y]=base-1;
+      mapdel[y]=1.f;
+    }else{
+      mapbase[y]=base;
+      mapdel[y]=del;
+    }
   }
   
   for(x=0;x<w;x++){



More information about the commits mailing list