374 inT16 ok_blob_count = 0;
380 BLOB_CHOICE_LIST_C_IT list_it = blob_choices;
381 BLOB_CHOICE_IT choice_it;
383 blob_count = blob_choices->length ();
384 ratings = (
float *)
alloc_mem (blob_count *
sizeof (
float));
385 for (list_it.mark_cycle_pt (), index = 0;
386 !list_it.cycled_list (); list_it.forward (), index++) {
387 choice_it.set_to_list (list_it.data ());
388 if (choice_it.length () > 0) {
389 ratings[ok_blob_count] = choice_it.data ()->certainty ();
398 qsort (ratings, ok_blob_count,
sizeof (
float),
sort_floats);
401 gapstart = ratings[0] - 1;
402 if (ok_blob_count >= 3) {
403 for (index = 0; index < ok_blob_count - 1; index++) {
404 if (ratings[index + 1] - ratings[index] > bestgap) {
405 bestgap = ratings[index + 1] - ratings[index];
407 gapstart = ratings[index];
411 threshold = gapstart + bestgap / 2;
int sort_floats(const void *arg1, const void *arg2)
void free_mem(void *oldchunk)
void * alloc_mem(inT32 count)