[xiph-commits] r12407 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Wed Jan 31 16:06:49 PST 2007


Author: xiphmont
Date: 2007-01-31 16:06:47 -0800 (Wed, 31 Jan 2007)
New Revision: 12407

Modified:
   trunk/sushivision/example_fractal.c
   trunk/sushivision/panel-2d.c
Log:
Additional minor optimization to rescaling; eliminate divides.


Modified: trunk/sushivision/example_fractal.c
===================================================================
--- trunk/sushivision/example_fractal.c	2007-01-31 21:33:09 UTC (rev 12406)
+++ trunk/sushivision/example_fractal.c	2007-02-01 00:06:47 UTC (rev 12407)
@@ -54,12 +54,12 @@
 
   s=sushiv_new_instance();
 
-  sushiv_new_dimension_discrete(s,0,"Re(c)",
+  sushiv_new_dimension(s,0,"Re(c)",
   	       5,(double []){-2.25,-0.75,0,0.25,0.75},
-  	       NULL,1,1000,0);
-  sushiv_new_dimension_discrete(s,1,"Im(c)",
+  	       NULL,0);
+  sushiv_new_dimension(s,1,"Im(c)",
   	       5,(double []){-2,-1,0,1,2},
-  	       NULL,1,1000,0);
+  	       NULL,0);
 
   sushiv_new_dimension(s,2,"Re(z0)",
 		       5,(double []){-2.25,-1,0,1,2.25},

Modified: trunk/sushivision/panel-2d.c
===================================================================
--- trunk/sushivision/panel-2d.c	2007-01-31 21:33:09 UTC (rev 12406)
+++ trunk/sushivision/panel-2d.c	2007-02-01 00:06:47 UTC (rev 12407)
@@ -216,8 +216,9 @@
   int x_bin = floor(x_del);
   x_del -= x_bin; 
   linedel *= .00392156862745; // 1./255
+  linedel /= x_scaledel;
   for(i=0;i<pw;i++){
-    float alpha=1.f;
+    float alpha=x_scaledel;
     float x_del2 = x_del + x_scaledel;
       
     while(x_del2>=1.f){
@@ -228,10 +229,10 @@
 	float val = data[x_bin];
 	if(!isnan(val) && val >= obj_alpha){
 	  u_int32_t partial = mapping_calc(map,val,panel[i]);
-	  r[i] += ((partial>>16)&0xff) * pixdel/x_scaledel;
-	  g[i] += ((partial>>8)&0xff) * pixdel/x_scaledel;
-	  b[i] += ((partial)&0xff) * pixdel/x_scaledel;
-	  alpha -= addel/x_scaledel;
+	  r[i] += ((partial>>16)&0xff) * pixdel;
+	  g[i] += ((partial>>8)&0xff) * pixdel;
+	  b[i] += ((partial)&0xff) * pixdel;
+	  alpha -= addel;
 	}
       }
 	
@@ -248,10 +249,10 @@
 	float val = data[x_bin];
 	if(!isnan(val) && val >= obj_alpha){
 	  u_int32_t partial = mapping_calc(map,val,panel[i]);
-	  r[i] += ((partial>>16)&0xff) * pixdel/x_scaledel;
-	  g[i] += ((partial>>8)&0xff) * pixdel/x_scaledel;
-	  b[i] += ((partial)&0xff) * pixdel/x_scaledel;
-	  alpha -= addel/x_scaledel;
+	  r[i] += ((partial>>16)&0xff) * pixdel;
+	  g[i] += ((partial>>8)&0xff) * pixdel;
+	  b[i] += ((partial)&0xff) * pixdel;
+	  alpha -= addel;
 	}
       }
       x_del = x_del2;
@@ -295,7 +296,8 @@
       float r[pw]; 
       float g[pw]; 
       float b[pw]; 
-      float alpha=1.f;
+      float alpha = y_scaledel;
+      float idel = 1./y_scaledel;
       float y_del2 = y_del + y_scaledel;
       u_int32_t *line = panel+i*pw;
       
@@ -309,12 +311,12 @@
 	
 	if(y_bin >= 0 && y_bin < dh){
 	  resample_render_y_plane_line(map,obj_alpha,
-				       r,g,b,addel/y_scaledel,
+				       r,g,b,addel * idel,
 				       line,
 				       panelx,
 				       data+y_bin*dw,
 				       datax);
-	  alpha -= addel/y_scaledel;
+	  alpha -= addel;
 	}
 	
 	y_del2--;
@@ -327,12 +329,12 @@
 	
 	if(y_bin >= 0 && y_bin < dh){
 	  resample_render_y_plane_line(map,obj_alpha,
-				       r,g,b,addel/y_scaledel,
+				       r,g,b,addel * idel,
 				       line,
 				       panelx,
 				       data+y_bin*dw,
 				       datax);
-	  alpha -= addel/y_scaledel;
+	  alpha -= addel;
 	}
 	y_del += addel;
       }



More information about the commits mailing list