unsigned long get_time_std_deviation( const struct coda_upcall_stats_entry * pentry ) { unsigned long time_avg; if ( pentry->count <= 1 ) return 0; time_avg = get_time_average( pentry ); return sqr_root( (pentry->time_squared_sum / pentry->count) - time_avg * time_avg ); }
static Errcode sep1(Sep_cb *sep) { Errcode err; int i,j; Rgb3 *absc, *pt; UBYTE *rgb_cnums; int rgb_ccount; int threshold; int occolor; int cscale; if (vs.sep_rgb == 1) /* case NEAR */ { cscale = sqr_root((long)RGB_MAX*RGB_MAX*3)+1; threshold = vs.sep_threshold * cscale/100; if ((rgb_cnums = pj_malloc(COLORS)) == NULL) return(Err_no_memory); occolor = vs.ccolor; vs.ccolor = closestc(&sep->sep_rgb_dest,vb.pencel->cmap->ctab, COLORS); rgb_ccount = 0; absc = sep->abs_ctable; i = sep->p.ccount; while (--i >= 0) { pt = vb.pencel->cmap->ctab; for (j=0; j<COLORS; j++) { if (rgb_close_enough(pt, absc, threshold) ) { if (!in_cnums(j, rgb_cnums, rgb_ccount)) rgb_cnums[rgb_ccount++] = j; } ++pt; } ++absc; } err = render_separate(rgb_cnums,rgb_ccount,&sep->p.rect); pj_free(rgb_cnums); vs.ccolor = occolor; } else { err = render_separate(sep->p.ctable,sep->p.ccount,&sep->p.rect); } if(vs.cycle_draw && err >= Success) cycle_ccolor(); return(err); }
static int rgb_close_enough(PLANEPTR c1, PLANEPTR c2, int threshold) { return( sqr_root((long)color_dif(c1,c2)) <= threshold); }
static int rgb_close_enough(Rgb3 *c1,Rgb3 *c2,int threshold) { return( sqr_root((long)color_dif(c1,c2)) <= threshold); }