double get_syscall_elapse(sc_state_t *state) { struct timespec st, ed; unsigned long elapse; int loopcnt, loop = 20; int index = loop >> 2; int iter, iteration = get_iteration(); result_t *r = (result_t *)malloc(sizeof(result_t) * loop); loopcnt = loop; while(loopcnt --) { if(state->prepare) { state->prepare(state); } iter = iteration; clock_gettime(CLOCK_REALTIME, &st); while(iter--) { state->bench(state); }; clock_gettime(CLOCK_REALTIME, &ed); elapse = get_total_us(&st, &ed); save_result(r, loopcnt, elapse, iteration); if(state->cooldown) state->cooldown(state); } qsort(r, loop, sizeof(result_t ), cmp_result); double latency = get_latency(r[index].elapse, r[index].iter); return latency; }
void RegionBasedActiveContourYUV::initialize_for_each_frame() { unsigned int it = get_iteration(); ActiveContour::initialize_for_each_frame(); // condition for video tracking : // If the active contour moves enough ( > 120 ), variables sums, n_in, n_out // are too different and are recalculated. // If the active contour does not evolve ( < 5 because a last cycle 2 is performed ) // in the case of uniform images (or during the object initialization), // variables are (re)calculated for convergence. // Otherwise, variables are not calculated. if( it > 120 || it < 5 ) { initialize_sums(); } calculate_means(); }