diff mbox series

[FFmpeg-devel,v2,12/32] avfilter/palettegen: use box->major_axis without intermediate variable

Message ID 20221227231814.2520181-13-u@pkh.me
State Accepted
Commit 9e5f494d2645f00926af21d46073307adf2cea8f
Headers show
Series [FFmpeg-devel,v2,01/32] avfilter/palettegen: allow a minimum of 2 colors | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Clément Bœsch Dec. 27, 2022, 11:17 p.m. UTC
---
 libavfilter/vf_palettegen.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c
index ed1448755c..aa0c8fdc5b 100644
--- a/libavfilter/vf_palettegen.c
+++ b/libavfilter/vf_palettegen.c
@@ -363,22 +363,21 @@  static AVFrame *get_palette_frame(AVFilterContext *ctx)
     s->nb_boxes = 1;
 
     while (box && box->len > 1) {
-        int i, longest;
+        int i;
         uint64_t median, box_weight;
 
         compute_box_stats(s, box);
-        longest = box->major_axis;
         box_weight = box->weight;
 
         ff_dlog(ctx, "box #%02X [%6d..%-6d] (%6d) w:%-6"PRIu64" sort by %c (already sorted:%c) ",
                 box_id, box->start, box->start + box->len - 1, box->len, box_weight,
-                "rgb"[longest], box->sorted_by == longest ? 'y':'n');
+                "rgb"[box->major_axis], box->sorted_by == box->major_axis ? 'y':'n');
 
-        /* sort the range by its longest axis if it's not already sorted */
-        if (box->sorted_by != longest) {
-            cmp_func cmpf = cmp_funcs[longest];
+        /* sort the range by its major axis if it's not already sorted */
+        if (box->sorted_by != box->major_axis) {
+            cmp_func cmpf = cmp_funcs[box->major_axis];
             AV_QSORT(&s->refs[box->start], box->len, const struct color_ref *, cmpf);
-            box->sorted_by = longest;
+            box->sorted_by = box->major_axis;
         }
 
         /* locate the median where to split */