Message ID | 20221227231814.2520181-16-u@pkh.me |
---|---|
State | Accepted |
Commit | dafd43b78dc3cf737103fbcafe075a1a85f224c7 |
Headers | show |
Series | [FFmpeg-devel,v2,01/32] avfilter/palettegen: allow a minimum of 2 colors | expand |
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 |
diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c index 7ecb1211ba..00b5f88c49 100644 --- a/libavfilter/vf_palettegen.c +++ b/libavfilter/vf_palettegen.c @@ -171,7 +171,8 @@ 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->cut_score = er2[0] + er2[1] + er2[2]; + /* The box that has the axis with the biggest error amongst all boxes will but cut down */ + box->cut_score = FFMAX3(er2[0], er2[1], er2[2]); } /** diff --git a/tests/ref/fate/filter-palettegen-1 b/tests/ref/fate/filter-palettegen-1 index 278d831846..57be338b42 100644 --- a/tests/ref/fate/filter-palettegen-1 +++ b/tests/ref/fate/filter-palettegen-1 @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 16x16 #sar 0: 1/1 -0, 0, 0, 1, 1024, 0x394ee723 +0, 0, 0, 1, 1024, 0x21c6e6c4 diff --git a/tests/ref/fate/filter-palettegen-2 b/tests/ref/fate/filter-palettegen-2 index e9bc635c81..bcdf54af95 100644 --- a/tests/ref/fate/filter-palettegen-2 +++ b/tests/ref/fate/filter-palettegen-2 @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 16x16 #sar 0: 1/1 -0, 0, 0, 1, 1024, 0xc54d773d +0, 0, 0, 1, 1024, 0x630d76b1