[xiph-commits] r12390 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Mon Jan 29 10:12:59 PST 2007


Author: xiphmont
Date: 2007-01-29 10:12:58 -0800 (Mon, 29 Jan 2007)
New Revision: 12390

Modified:
   trunk/sushivision/mapping.c
   trunk/sushivision/panel-2d.c
Log:
Back to original level of functionality in 2d panel; now to begin debugging discrete and oversampled dimensions



Modified: trunk/sushivision/mapping.c
===================================================================
--- trunk/sushivision/mapping.c	2007-01-29 13:58:10 UTC (rev 12389)
+++ trunk/sushivision/mapping.c	2007-01-29 18:12:58 UTC (rev 12390)
@@ -325,9 +325,6 @@
   int g = (mix>>8)&0xff;
   int b = mix&0xff;
 
-  if(den>0.f)
-    num /= den;
-
   if(m->i_range==0){
     if(num<=m->low)
       o = m->mapfunc(0.,mix);
@@ -338,9 +335,9 @@
     o = m->mapfunc(val,mix);
   }
 
-  r += (((o>>16)&0xff) - r)*den;
-  g += (((o>>8)&0xff) - g)*den;
-  b += ((o&0xff) - b)*den;
+  r += ((int)((o>>16)&0xff) - r)*den;
+  g += ((int)((o>>8)&0xff) - g)*den;
+  b += ((int)(o&0xff) - b)*den;
   if(r<0)r=0;
   if(g<0)g=0;
   if(b<0)b=0;

Modified: trunk/sushivision/panel-2d.c
===================================================================
--- trunk/sushivision/panel-2d.c	2007-01-29 13:58:10 UTC (rev 12389)
+++ trunk/sushivision/panel-2d.c	2007-01-29 18:12:58 UTC (rev 12390)
@@ -65,9 +65,9 @@
 	  float *d = p2->y_den_rend[i];
 
 	  p2->y_num_rend[i] = p2->y_num[i];
-	  p2->y_num = n;
+	  p2->y_num[i] = n;
 	  p2->y_den_rend[i] = p2->y_den[i];
-	  p2->y_den = d;
+	  p2->y_den[i] = d;
 	  
 	  memset(p2->y_num_rend[i],0,sizeof(**p2->y_num_rend)*w*h);
 	  memset(p2->y_den_rend[i],0,sizeof(**p2->y_den_rend)*w*h);
@@ -81,18 +81,19 @@
 	  for(y=0;y<h;y++){
 	    float del = p2->y_rend[y];
 	    if(del>0){
-	      float *a = p2->y_num[i] + y*w;
-	      float *b = p2->y_num_rend[i] + y*w;
+	      float *na = p2->y_num[i] + y*w;
+	      float *nb = p2->y_num_rend[i] + y*w;
+	      float *da = p2->y_den[i] + y*w;
+	      float *db = p2->y_den_rend[i] + y*w;
+
 	      for(x=0;x<w;x++){
-		*a = (*a) + (*a - *b++)*del;
-		a++;
+		*na = (*na) + (*na - *nb++)*del;
+		na++;
 	      }
 
-	      a = p2->y_den[i] + y*w;
-	      b = p2->y_den_rend[i] + y*w;
 	      for(x=0;x<w;x++){
-		*a = *a+(*a-*b++)*del;
-		a++;
+		*da = (*da) + (*da - *db++)*del;
+		da++;
 	      }
 	    }
 	  }
@@ -349,18 +350,19 @@
 	    float *d = p2->y_den_rend[j] + outbin*w;
 	    float *tn = c->y_num[j];
 	    float *td = c->y_den[j];
-	    
+
 	    for(i=0;i<w;i++){
 	      n[i] += tn[i] * addel;
 	      d[i] += td[i] * addel;
 	    }
+
 	  }
 	  p2->y_rend[outbin]+=addel;
+	  gdk_threads_leave ();
 	}else{
 	  gdk_threads_leave ();
 	  return;
 	}
-	gdk_threads_leave ();
       }
 
       outdel2 -= addel;
@@ -384,6 +386,7 @@
 	      n[i] += tn[i] * addel;
 	      d[i] += td[i] * addel;
 	    }
+
 	  }
 	  p2->y_rend[outbin]+=addel;
 	}
@@ -403,7 +406,7 @@
 	
 	memcpy(n,tn,w*sizeof(*n));
 	memcpy(d,td,w*sizeof(*n));
-	
+
       }
     }
     gdk_threads_leave ();
@@ -556,24 +559,27 @@
     for(x=0;x<w;x++){
       float num = numA[x] + (numB[x] - numA[x])*del;
       float den = denA[x] + (denB[x] - denA[x])*del;
-      if(den>0.f){
+      if(den>0.f && !isnan(num)){
 	num /= den;
 	/* map/render result */
-	if(!isnan(num) && num>=alpha)
+	if(num>=alpha)
 	  render[x] = mapping_calc_a(p2->mappings+objnum,num,den,render[x]);
       }
     }
-
+    
   }else{
     // normal render or fully complete resampled render 
-
+    
     float *num = p2->y_num[cond_onum] + w*y;
     float *den = p2->y_den[cond_onum] + w*y;
 
     for(x=0;x<w;x++){
-      /* map/render result */
-      if(!isnan(num[x]) && num[x]>=alpha)
-	render[x] = mapping_calc_a(p2->mappings+objnum,num[x],den[x],render[x]);
+      if(den[x]>0.f && !isnan(num[x])){
+	float val = num[x] / den[x];
+	/* map/render result */
+	if(val>=alpha)
+	  render[x] = mapping_calc_a(p2->mappings+objnum,val,den[x],render[x]);
+      }
     }
   }
 }
@@ -972,8 +978,7 @@
     if( p2->serialno && // we've been through once and alloced
 	(p2->x.pixels != w ||
 	 p2->y.pixels != h)){
-	
-	
+		
       // if a render was in progress, force completion 
       compute_complete_render(p, 0);
       compute_free_render(p);
@@ -1227,8 +1232,8 @@
     c->storage_width = w;
 
     for(i=0;i<p2->y_obj_num;i++){
-      p2->y_num[i] = realloc(p2->y_num[i],w*sizeof(**p2->y_num));
-      p2->y_den[i] = realloc(p2->y_den[i],w*sizeof(**p2->y_den));
+      c->y_num[i] = realloc(c->y_num[i],w*sizeof(**c->y_num));
+      c->y_den[i] = realloc(c->y_den[i],w*sizeof(**c->y_den));
     }
   }
 }



More information about the commits mailing list