[xiph-commits] r12426 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sun Feb 4 15:57:59 PST 2007


Author: xiphmont
Date: 2007-02-04 15:57:54 -0800 (Sun, 04 Feb 2007)
New Revision: 12426

Modified:
   trunk/sushivision/dimension.c
   trunk/sushivision/example_discrete.c
   trunk/sushivision/example_fractal.c
   trunk/sushivision/panel-2d.c
Log:
Minor but important fixes to discrete dimensions/resampling



Modified: trunk/sushivision/dimension.c
===================================================================
--- trunk/sushivision/dimension.c	2007-02-04 11:55:24 UTC (rev 12425)
+++ trunk/sushivision/dimension.c	2007-02-04 23:57:54 UTC (rev 12426)
@@ -85,19 +85,19 @@
       // although the rest of the code assumes 'hi' is a one-past, the
       // discrete dim code assumes hi is an inclusive bound, so we
       // just extend.
-      if(lo_i<hi_i){
+      if(lo_i>hi_i){ // == must be 1 to match scale gen code when width is 0
+	extend = -1;
+      }else{
 	extend = 1;
-      }else{
-	extend = -1;
       }
 
       data_w = abs(hi_i-lo_i)+1;
       if(!(d->flags & SUSHIV_DIM_ZEROINDEX))
 	floor_i = 0;
 
-      *panel = scalespace_linear((double)lo_i * d->private->discrete_numerator / 
+      *panel = scalespace_linear((double)(lo_i-extend*.4) * d->private->discrete_numerator / 
 				 d->private->discrete_denominator,
-				 (double)hi_i * d->private->discrete_numerator / 
+				 (double)(hi_i+extend*.4) * d->private->discrete_numerator / 
 				 d->private->discrete_denominator,
 				 panel_w, spacing, legend);
 

Modified: trunk/sushivision/example_discrete.c
===================================================================
--- trunk/sushivision/example_discrete.c	2007-02-04 11:55:24 UTC (rev 12425)
+++ trunk/sushivision/example_discrete.c	2007-02-04 23:57:54 UTC (rev 12426)
@@ -31,10 +31,10 @@
   int X = rint(d[0]);
   int Y = rint(d[1]);
 
-  if(!(X&0x3) && !(Y&0x3)) 
+  if(!(X%100) && !(Y%100)) 
     ret[0]=1.;
   else
-    ret[0]=((X+Y)&0xf)*.02;
+    ret[0]=0.;
 }
 
 int sushiv_submain(int argc, char *argv[]){
@@ -42,10 +42,10 @@
   s=sushiv_new_instance();
 
   sushiv_new_dimension_discrete(s,0,"A",
-				5,(double []){-100,-10,0,10,100},
+				5,(double []){-500,-10,0,10,500},
 				NULL,1,1,0);
   sushiv_new_dimension_discrete(s,1,"B",
-				5,(double []){-100,-10,0,10,100},
+				5,(double []){-500,-10,0,10,500},
 				NULL,1,1,0);
 
   sushiv_dimension_set_value(s,0,0,-2);

Modified: trunk/sushivision/example_fractal.c
===================================================================
--- trunk/sushivision/example_fractal.c	2007-02-04 11:55:24 UTC (rev 12425)
+++ trunk/sushivision/example_fractal.c	2007-02-04 23:57:54 UTC (rev 12426)
@@ -54,12 +54,12 @@
 
   s=sushiv_new_instance();
 
-  sushiv_new_dimension(s,0,"Re(c)",
-  	       5,(double []){-2.25,-0.75,0,0.25,0.75},
-  	       NULL,0);
-  sushiv_new_dimension(s,1,"Im(c)",
-  	       5,(double []){-2,-1,0,1,2},
-  	       NULL,0);
+  sushiv_new_dimension_discrete(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)",
+				5,(double []){-2,-1,0,1,2},
+				NULL,1,1000,0);
 
   sushiv_new_dimension(s,2,"Re(z0)",
 		       5,(double []){-2.25,-1,0,1,2.25},
@@ -76,7 +76,7 @@
   					     "ten thousand",
   					     "one hundred thousand"},
 				NULL,0);
-  sushiv_dimension_set_value(s,4,1,10000);
+  sushiv_dimension_set_value(s,4,1,100);
 
   sushiv_new_function(s, 0, 5, 2, fractal_objective, 0);
 

Modified: trunk/sushivision/panel-2d.c
===================================================================
--- trunk/sushivision/panel-2d.c	2007-02-04 11:55:24 UTC (rev 12425)
+++ trunk/sushivision/panel-2d.c	2007-02-04 23:57:54 UTC (rev 12426)
@@ -257,8 +257,8 @@
 	  alpha -= addel;
 	}
       }
-      x_del = x_del2;
     }
+    x_del = x_del2;
 
     /* partial pixels need some of the background mixed in */
     if(alpha>0.f){
@@ -329,7 +329,7 @@
 				       r,g,b,addel * idel,
 				       line,
 				       panelx,
-				       data+y_bin*dw,
+				       dline,
 				       datax);
 	  alpha -= addel * idel;
 	}
@@ -353,12 +353,12 @@
 				       r,g,b,addel * idel,
 				       line,
 				       panelx,
-				       data+y_bin*dw,
+				       dline,
 				       datax);
 	  alpha -= addel * idel;
 	}
-	y_del += addel;
       }
+      y_del = y_del2;
 
       /* work is finished; replace panel line with it */
       if(alpha>.0001){ // less than a color step of rounding error
@@ -1103,8 +1103,9 @@
       
       p2->scaling_in_progress = 0;
       gdk_threads_leave ();
+      _sushiv_panel_dirty_map(p);
       _sushiv_wake_workers();   
-      _sushiv_panel2d_remap(p);
+      //_sushiv_panel2d_remap(p);
       plot_draw_scales(plot);
 
     }else



More information about the commits mailing list