diff options
author | Clément Bœsch <u@pkh.me> | 2022-12-27 14:47:20 +0100 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2023-01-03 17:18:55 +0100 |
commit | 187f5e7f908efee4bb8d4743d910cf6ea4e2ee0f (patch) | |
tree | 0a543c2b6ac4c924b6d12e9c1b1fa487d3c63c0d | |
parent | e49fc1a6efa760856da880afdffc7b042902deb3 (diff) | |
download | ffmpeg-187f5e7f908efee4bb8d4743d910cf6ea4e2ee0f.tar.gz |
avfilter/palettegen: rename variance to cut_score
"Variance" wasn't exactly the correct word; "cut score" is more
agnostic, which will be useful when changing the algorithm in the next
commit.
-rw-r--r-- | libavfilter/vf_palettegen.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c index ca1e02444c..7ecb1211ba 100644 --- a/libavfilter/vf_palettegen.c +++ b/libavfilter/vf_palettegen.c @@ -42,7 +42,7 @@ struct range_box { uint32_t color; // average color int major_axis; // best axis candidate for cutting the box uint64_t weight; // sum of all the weights of the colors - int64_t variance; // overall variance of the box (how much the colors are spread) + int64_t cut_score; // how likely the box is to be cut down (higher implying more likely) int start; // index in PaletteGenContext->refs int len; // number of referenced colors int sorted_by; // whether range of colors is sorted by red (0), green (1) or blue (2) @@ -171,25 +171,25 @@ static void compute_box_stats(PaletteGenContext *s, struct range_box *box) if (er2[0] >= er2[1] && er2[0] >= er2[2]) box->major_axis = 0; if (er2[1] >= er2[0] && er2[1] >= er2[2]) box->major_axis = 1; // prefer green again - box->variance = er2[0] + er2[1] + er2[2]; + box->cut_score = er2[0] + er2[1] + er2[2]; } /** - * Find the next box to split: pick the one with the highest variance + * Find the next box to split: pick the one with the highest cut score */ static int get_next_box_id_to_split(PaletteGenContext *s) { int box_id, best_box_id = -1; - int64_t max_variance = -1; + int64_t max_score = -1; if (s->nb_boxes == s->max_colors - s->reserve_transparent) return -1; for (box_id = 0; box_id < s->nb_boxes; box_id++) { struct range_box *box = &s->boxes[box_id]; - if (s->boxes[box_id].len >= 2 && box->variance > max_variance) { + if (s->boxes[box_id].len >= 2 && box->cut_score > max_score) { best_box_id = box_id; - max_variance = box->variance; + max_score = box->cut_score; } } return best_box_id; |