[xiph-commits] r14015 - trunk/sushivision
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Fri Oct 19 10:56:34 PDT 2007
Author: xiphmont
Date: 2007-10-19 10:56:33 -0700 (Fri, 19 Oct 2007)
New Revision: 14015
Modified:
trunk/sushivision/panel.c
trunk/sushivision/panel.h
trunk/sushivision/plane-2d.c
trunk/sushivision/plane-bg.c
trunk/sushivision/plane.h
Log:
In progress
Modified: trunk/sushivision/panel.c
===================================================================
--- trunk/sushivision/panel.c 2007-10-19 14:06:07 UTC (rev 14014)
+++ trunk/sushivision/panel.c 2007-10-19 17:56:33 UTC (rev 14015)
@@ -162,8 +162,10 @@
if(p->recompute_pending){
p->recompute_pending=0;
p->comp_serialno++;
+ p->legend_serialno++;
p->image_resize=1;
p->data_resize=1;
+ p->data_work=1;
p->rescale=1;
p->relegend=1;
p->bgrender=0;
@@ -208,19 +210,17 @@
// legend regeneration
if(p->relegend){
- if(bg_legend(p) == STATUS_IDLE){
- p->expose=1;
- p->relegend=0;
- }
+ p->relegend=0; // must be unset before relegend
+ bg_legend(p);
+ p->expose=1;
return done_working(p);
}
// axis scale redraw
if(p->rescale){
- if(bg_scale(p) == STATUS_IDLE){
- p->expose=1;
- p->rescale=0;
- }
+ p->rescale=0; // must be unset before rescale
+ bg_scale(p);
+ p->expose=1;
return done_working(p);
}
@@ -243,6 +243,7 @@
!p->rescale &&
!p->bgrender){
// wait till all these ops are done
+ p->expose = 0;
bg_expose(p);
return done_working(p);
}
@@ -269,8 +270,34 @@
}
// computation work
- status = plane_loop(p,&p->data_next_plane,data_work);
- if(status == STATUS_WORKING) return done_working(p);
+ if(p->data_work){
+ status = plane_loop(p,&p->data_next_plane,data_work);
+ if(status == STATUS_WORKING){
+
+ // throttled image render
+ if(p->map_render==0){
+ // no render currently in progress
+ struct timeval now;
+ gettimeofday(&now,NULL);
+
+ if(p->map_throttle_last.tv_sec==0){
+ p->map_throttle_last=now;
+ }else{
+ long test = (now.tv_sec - p->map_throttle_last.tv_sec)*1000 +
+ (now.tv_usec - p->map_throttle_last.tv_usec)/1000;
+ if(test>500)
+ // first request since throttle
+ p->map_render=1;
+ }
+ }
+ return done_working(p);
+ }
+ if(status == STATUS_IDLE){
+ p->map_render = 1;
+ p->relegend = 1;
+ p->data_work = 0;
+ }
+ }
return done_idle(p);
}
Modified: trunk/sushivision/panel.h
===================================================================
--- trunk/sushivision/panel.h 2007-10-19 14:06:07 UTC (rev 14014)
+++ trunk/sushivision/panel.h 2007-10-19 17:56:33 UTC (rev 14015)
@@ -34,9 +34,6 @@
int dimensions;
int *dimension_list;
- int objectives;
- int *objective_list;
-
// axis 0 == X
// axis 1 == Y
// axis 2 == Z
@@ -59,6 +56,7 @@
int next_plane;
// UI objects
+ sv_plot_t *plot;
GtkWidget *obj_table;
GtkWidget *dim_table;
sv_spinner_t *spinner;
Modified: trunk/sushivision/plane-2d.c
===================================================================
--- trunk/sushivision/plane-2d.c 2007-10-19 14:06:07 UTC (rev 14014)
+++ trunk/sushivision/plane-2d.c 2007-10-19 17:56:33 UTC (rev 14015)
@@ -1093,31 +1093,6 @@
pl->image_task = 4;
- if(pl->data_next>=dh){
- pl->data_task = 5;
- if(!pl->data_outstanding) {
- // immediate image render
- p->map_render = 1;
- }
- }
-
- // throttled image render
- if(p->map_render==0){
- // no render currently in progress
- struct timeval now;
- gettimeofday(&now,NULL);
-
- if(p->map_throttle_last.tv_sec==0){
- p->map_throttle_last=now;
- }else{
- long test = (now.tv_sec - p->map_throttle_last.tv_sec)*1000 +
- (now.tv_usec - p->map_throttle_last.tv_usec)/1000;
- if(test>500)
- // first request since throttle
- p->map_render=1;
- }
- }
-
return STATUS_WORKING;
}
Modified: trunk/sushivision/plane-bg.c
===================================================================
--- trunk/sushivision/plane-bg.c 2007-10-19 14:06:07 UTC (rev 14014)
+++ trunk/sushivision/plane-bg.c 2007-10-19 17:56:33 UTC (rev 14015)
@@ -74,16 +74,82 @@
}
int bg_legend(sv_panel_t *p){
+ sv_planebg_t *bg = &p->bg;
+ sv_plot_t *plot = p->plot;
+ int serialno = p->legend_serialno;
+ if(plot){
+ int i,j;
+ char buffer[320];
+ int depth = 0;
+ pthread_mutex_unlock(p->status_m);
+ _sv_plot_legend_clear(plot);
+ pthread_mutex_lock(p->status_m);
+ if(serialno != p->legend_serialno)return STATUS_WORKING;
+
+ // potentially add each dimension to the legend; add axis
+ // dimensions only if crosshairs are active
+
+ // display decimal precision relative to display scales
+ if(3-_sv_scalespace_decimal_exponent(&bg->image_x) > depth)
+ depth = 3-_sv_scalespace_decimal_exponent(&bg->image_x);
+ if(3-_sv_scalespace_decimal_exponent(&bg->image_y) > depth)
+ depth = 3-_sv_scalespace_decimal_exponent(&bg->image_y);
+ for(i=0;i<p->dimensions;i++){
+ sv_dim_data_t *d = p->dim_data+i;
+ int flag=0;
+ for(j=0;j<p->axes;j++)
+ if(p->axis_dims[j] != i &&
+ (j<=2 || !p->cross_active)){
+ flag=1;
+ break;
+ }
+
+ if(!flag){
+ snprintf(buffer,320,"%s = %+.*f",
+ d->legend,
+ depth,
+ d->val);
+ pthread_mutex_unlock(p->status_m);
+ _sv_plot_legend_add(plot,buffer);
+ pthread_mutex_lock(p->status_m);
+ if(serialno != p->legend_serialno)return STATUS_WORKING;
+ }
+ }
+
+ // add each active objective plane to the legend
+ // choose the value under the crosshairs
+ if(plot->cross_active){
+ // ask each plane for entries...
+ int firstflag=0;
+ for(i=0;i<p->planes;i++){
+ int retflag=p->plane_list[i]->legend(p->plane_list[i],buffer,320);
+ pthread_mutex_unlock(p->status_m);
+ if(retflag && !firstflag)
+ _sv_plot_legend_add(plot,NULL);
+ firstflag|=retflag;
+ _sv_plot_legend_add(plot,buffer);
+ pthread_mutex_lock(p->status_m);
+ if(serialno != p->legend_serialno)return STATUS_WORKING;
+ }
+ }
+ }
+
+ pthread_mutex_unlock(p->status_m);
+ _sv_plot_draw_legend(plot);
+ pthread_mutex_lock(p->status_m);
+ if(serialno != p->legend_serialno)return STATUS_WORKING;
+
+ return STATUS_IDLE;
}
int bg_scale(sv_panel_t *p){
- gdk_unlock ();
+
_sv_plot_draw_scales(plot); // this should happen outside lock
- gdk_lock ();
+
}
int bg_render(sv_panel_t *p){
@@ -262,6 +328,12 @@
}
}
}
+
+ XXXXXX outside lock
+ _sv_plot_draw_legend(plot);
+
+
+
}
// subtype entry point for legend redraws; lock held
Modified: trunk/sushivision/plane.h
===================================================================
--- trunk/sushivision/plane.h 2007-10-19 14:06:07 UTC (rev 14014)
+++ trunk/sushivision/plane.h 2007-10-19 17:56:33 UTC (rev 14015)
@@ -34,20 +34,23 @@
double *dim_input; // function input vector (without iterator values)
sv_scalespace_t *pending_data_scales;
sv_scalespace_t *data_scales;
+
+ sv_ucolor_t *image;
+ sv_ucolor_t (*mix[])(sv_ucolor_t, sv_ucolor_t);
sv_scalespace_t image_x;
sv_scalespace_t image_y;
int axes;
void (*recompute_setup)(sv_plane_t *);
- int (*image_resize)(sv_plane_t *);
- int (*data_resize)(sv_plane_t *);
- int (*image_work)(sv_plane_t *);
- int (*data_work)(sv_plane_t *);
+ int (*image_resize)(sv_plane_t *);
+ int (*data_resize)(sv_plane_t *);
+ int (*image_work)(sv_plane_t *);
+ int (*data_work)(sv_plane_t *);
void (*plane_remap)(sv_plane_t *);
void (*plane_free)(sv_plane_t *);
- void (*demultiplex_2d)(sv_plane_t *, double *out, int dw, int x, int y, int n);
+ void (*demultiplex)(sv_plane_t *, double *out, int dw, int x, int y, int n);
} sv_plane_common_t;
@@ -55,16 +58,11 @@
sv_plane_common_t c;
// image data and concurrency tracking
- sv_ucolor_t *image;
// status
- int image_serialno;
- int image_waiting;
- int image_incomplete;
+ int image_outstanding;
int image_nextline;
- sv_scalespace_t image_x;
- sv_scalespace_t image_y;
- unsigned char *image_status; // rendering flags
+ unsigned char *image_flags;
};
@@ -77,7 +75,6 @@
// data; access unlocked
float *data;
float *pending_data;
- sv_ucolor_t *image;
sv_ucolor_t *pending_image;
int *map;
slider_map_t scale;
@@ -92,7 +89,7 @@
int image_task; /* -1 busy, 0 realloc, 1 resizeA, 2 resizeB, 3 commit, 4 working, 5 idle */
int image_next;
int image_mapnum;
- int *image_flags;
+ unsigned char *image_flags;
// resampling helpers
unsigned char *resample_xdelA;
More information about the commits
mailing list