Lines Matching refs:bv
279 best_splittable_box (struct box *bv, unsigned int boxes, const double max_mse) in best_splittable_box() argument
286 if (bv[i].colors < 2) { in best_splittable_box()
292 MAX (bv[i].variance.r, MAX (bv[i].variance.g, bv[i].variance.b)); in best_splittable_box()
293 double thissum = bv[i].sum * MAX (bv[i].variance.a, cv); in best_splittable_box()
295 if (bv[i].max_error > max_mse) { in best_splittable_box()
296 thissum = thissum * bv[i].max_error / max_mse; in best_splittable_box()
318 static void set_colormap_from_boxes (colormap * map, struct box *bv,
321 const struct box *bv, unsigned int boxes);
341 total_box_error_below_target (double target_mse, struct box bv[], in total_box_error_below_target() argument
351 if (bv[i].total_error >= 0) { in total_box_error_below_target()
352 total_error += bv[i].total_error; in total_box_error_below_target()
359 if (bv[i].total_error < 0) { in total_box_error_below_target()
360 bv[i].total_error = box_error (&bv[i], hist->achv); in total_box_error_below_target()
361 total_error += bv[i].total_error; in total_box_error_below_target()
381 struct box *bv = g_alloca (sizeof (struct box) * newcolors); in mediancut() local
389 bv[0].ind = 0; in mediancut()
390 bv[0].colors = hist->size; in mediancut()
391 bv[0].color = in mediancut()
392 averagepixels (bv[0].colors, &achv[bv[0].ind], min_opaque_val, (f_pixel) { in mediancut()
394 bv[0].variance = box_variance (achv, &bv[0]); in mediancut()
395 bv[0].max_error = box_max_error (achv, &bv[0]); in mediancut()
396 bv[0].sum = 0; in mediancut()
397 bv[0].total_error = -1; in mediancut()
398 for (i = 0; i < bv[0].colors; i++) in mediancut()
399 bv[0].sum += achv[i].adjusted_weight; in mediancut()
420 set_colormap_from_boxes (representative_subset, bv, boxes, achv); in mediancut()
425 bi = best_splittable_box (bv, boxes, current_max_mse); in mediancut()
429 indx = bv[bi].ind; in mediancut()
430 clrs = bv[bi].colors; in mediancut()
442 halfvar = prepare_sort (&bv[bi], achv); in mediancut()
452 sm = bv[bi].sum; in mediancut()
457 previous_center = bv[bi].color; in mediancut()
458 bv[bi].colors = break_at; in mediancut()
459 bv[bi].sum = lowersum; in mediancut()
460 bv[bi].color = in mediancut()
461 averagepixels (bv[bi].colors, &achv[bv[bi].ind], min_opaque_val, in mediancut()
463 bv[bi].total_error = -1; in mediancut()
464 bv[bi].variance = box_variance (achv, &bv[bi]); in mediancut()
465 bv[bi].max_error = box_max_error (achv, &bv[bi]); in mediancut()
466 bv[boxes].ind = indx + break_at; in mediancut()
467 bv[boxes].colors = clrs - break_at; in mediancut()
468 bv[boxes].sum = sm - lowersum; in mediancut()
469 bv[boxes].color = in mediancut()
470 averagepixels (bv[boxes].colors, &achv[bv[boxes].ind], min_opaque_val, in mediancut()
472 bv[boxes].total_error = -1; in mediancut()
473 bv[boxes].variance = box_variance (achv, &bv[boxes]); in mediancut()
474 bv[boxes].max_error = box_max_error (achv, &bv[boxes]); in mediancut()
478 if (total_box_error_below_target (target_mse, bv, boxes, hist)) { in mediancut()
484 set_colormap_from_boxes (map, bv, boxes, achv); in mediancut()
487 adjust_histogram (achv, map, bv, boxes); in mediancut()
493 set_colormap_from_boxes (colormap * map, struct box *bv, unsigned int boxes, in set_colormap_from_boxes() argument
505 map->palette[bi].acolor = bv[bi].color; in set_colormap_from_boxes()
509 for (unsigned int i = bv[bi].ind; i < bv[bi].ind + bv[bi].colors; i++) { in set_colormap_from_boxes()
517 adjust_histogram (hist_item * achv, const colormap * map, const struct box *bv, in adjust_histogram() argument
521 for (unsigned int i = bv[bi].ind; i < bv[bi].ind + bv[bi].colors; i++) { in adjust_histogram()