Re: [FFmpeg-devel] [PATCH] palettegen: Fill with last color, not black
sön 2019-02-17 klockan 23:22 +0100 skrev Tomas Härdin: > tor 2019-01-17 klockan 11:14 +0100 skrev Michael Niedermayer: > > On Thu, Jan 17, 2019 at 09:44:47AM +0100, Clément Bœsch wrote: > > > On Wed, Jan 16, 2019 at 01:40:20PM +0100, Tomas Härdin wrote: > > > > Hi > > > > > > > > I was helping the fine folks at peppercarrot.com with web video > > > > nonsense, and I notice palettegen outputs more colors than it > > > > should > > > > due to padding the generated palette with pure black. > > > > > > > > Compare this (ffmpeg version 3.2.12-1~deb9u1): > > > > http://www.härdin.se/files/peppercarrot_gif/output-blackspecks-64 > > > > .gif > > > > with this (282a471 with this patch applied): > > > > http://www.härdin.se/files/peppercarrot_gif/output-fixed-64.gif > > > > > > > > The attached patch fixes this by padding with the last color > > > > instead of > > > > black. > > > > > > > > /Tomas > > > > From 3a01f62fdcc95cc7afaf5aa6e439b8742cce43bc Mon Sep 17 00:00:00 > > > > 2001 > > > > > > > > From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= > > > > Date: Wed, 16 Jan 2019 13:07:48 +0100 > > > > Subject: [PATCH] palettegen: Fill with last color, not black > > > > > > > > If we fill with black then the generated palette will have one > > > > color more > > > > than what the user requested. This also resulted in unwanted > > > > black specks in > > > > the output of paletteuse, especially when generating small > > > > palettes. > > > > --- > > > > libavfilter/vf_palettegen.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/libavfilter/vf_palettegen.c > > > > b/libavfilter/vf_palettegen.c > > > > index 5ff73e6b2b..44323782d2 100644 > > > > --- a/libavfilter/vf_palettegen.c > > > > +++ b/libavfilter/vf_palettegen.c > > > > @@ -245,7 +245,7 @@ static void write_palette(AVFilterContext > > > > *ctx, AVFrame *out) > > > > av_log(ctx, AV_LOG_WARNING, "Dupped color: > > > > %08"PRIX32"\n", pal[x]); > > > > last_color = pal[x]; > > > > } else { > > > > -pal[x] = 0xff00; // pad with black > > > > +pal[x] = last_color; // pad with last color > > > > } > > > > } > > > > pal += pal_linesize; > > > > > > Code LGTM, thanks > > > > > > No FATE change? > > > > > > --- ./tests/ref/fate/filter-palettegen-22019-01-15 > > 01:24:17.53094 +0100 > > > > +++ tests/data/fate/filter-palettegen-2 2019-01-17 > > 11:13:21.077198948 +0100 > > @@ -3,4 +3,4 @@ > > #codec_id 0: rawvideo > > #dimensions 0: 16x16 > > #sar 0: 1/1 > > -0, 0, 0,1, 1024, 0x906ff5aa > > +0, 0, 0,1, 1024, 0x23e072c8 > > Test filter-palettegen-2 failed. Look at tests/data/fate/filter- > > palettegen-2.err for details. > > make: *** [fate-filter-palettegen-2] Error 1 > > Finally got around to fixing this. Updated patch attached, passes FATE > for me. I'll push in a day or two Pushed /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] palettegen: Fill with last color, not black
tor 2019-01-17 klockan 11:14 +0100 skrev Michael Niedermayer: > On Thu, Jan 17, 2019 at 09:44:47AM +0100, Clément Bœsch wrote: > > On Wed, Jan 16, 2019 at 01:40:20PM +0100, Tomas Härdin wrote: > > > Hi > > > > > > I was helping the fine folks at peppercarrot.com with web video > > > nonsense, and I notice palettegen outputs more colors than it > > > should > > > due to padding the generated palette with pure black. > > > > > > Compare this (ffmpeg version 3.2.12-1~deb9u1): > > > http://www.härdin.se/files/peppercarrot_gif/output-blackspecks-64 > > > .gif > > > with this (282a471 with this patch applied): > > > http://www.härdin.se/files/peppercarrot_gif/output-fixed-64.gif > > > > > > The attached patch fixes this by padding with the last color > > > instead of > > > black. > > > > > > /Tomas > > > From 3a01f62fdcc95cc7afaf5aa6e439b8742cce43bc Mon Sep 17 00:00:00 > > > 2001 > > > From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= > > > Date: Wed, 16 Jan 2019 13:07:48 +0100 > > > Subject: [PATCH] palettegen: Fill with last color, not black > > > > > > If we fill with black then the generated palette will have one > > > color more > > > than what the user requested. This also resulted in unwanted > > > black specks in > > > the output of paletteuse, especially when generating small > > > palettes. > > > --- > > > libavfilter/vf_palettegen.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/libavfilter/vf_palettegen.c > > > b/libavfilter/vf_palettegen.c > > > index 5ff73e6b2b..44323782d2 100644 > > > --- a/libavfilter/vf_palettegen.c > > > +++ b/libavfilter/vf_palettegen.c > > > @@ -245,7 +245,7 @@ static void write_palette(AVFilterContext > > > *ctx, AVFrame *out) > > > av_log(ctx, AV_LOG_WARNING, "Dupped color: > > > %08"PRIX32"\n", pal[x]); > > > last_color = pal[x]; > > > } else { > > > -pal[x] = 0xff00; // pad with black > > > +pal[x] = last_color; // pad with last color > > > } > > > } > > > pal += pal_linesize; > > > > Code LGTM, thanks > > > > No FATE change? > > --- ./tests/ref/fate/filter-palettegen-2 2019-01-15 > 01:24:17.53094 +0100 > +++ tests/data/fate/filter-palettegen-2 2019-01-17 > 11:13:21.077198948 +0100 > @@ -3,4 +3,4 @@ > #codec_id 0: rawvideo > #dimensions 0: 16x16 > #sar 0: 1/1 > -0, 0, 0,1, 1024, 0x906ff5aa > +0, 0, 0,1, 1024, 0x23e072c8 > Test filter-palettegen-2 failed. Look at tests/data/fate/filter- > palettegen-2.err for details. > make: *** [fate-filter-palettegen-2] Error 1 Finally got around to fixing this. Updated patch attached, passes FATE for me. I'll push in a day or two /TomasFrom 20b5a4dfe58496eb8dc603b279e17b8fec07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Wed, 16 Jan 2019 13:07:48 +0100 Subject: [PATCH] palettegen: Fill with last color, not black If we fill with black then the generated palette will have one color more than what the user requested. This also resulted in unwanted black specks in the output of paletteuse, especially when generating small palettes. --- libavfilter/vf_palettegen.c| 2 +- tests/ref/fate/filter-palettegen-2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c index 5ff73e6b2b..44323782d2 100644 --- a/libavfilter/vf_palettegen.c +++ b/libavfilter/vf_palettegen.c @@ -245,7 +245,7 @@ static void write_palette(AVFilterContext *ctx, AVFrame *out) av_log(ctx, AV_LOG_WARNING, "Dupped color: %08"PRIX32"\n", pal[x]); last_color = pal[x]; } else { -pal[x] = 0xff00; // pad with black +pal[x] = last_color; // pad with last color } } pal += pal_linesize; diff --git a/tests/ref/fate/filter-palettegen-2 b/tests/ref/fate/filter-palettegen-2 index aa07b6cb93..9abec0fe8e 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, 0x906ff5aa +0, 0, 0,1, 1024, 0x23e072c8 -- 2.11.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] palettegen: Fill with last color, not black
On Thu, Jan 17, 2019 at 09:44:47AM +0100, Clément Bœsch wrote: > On Wed, Jan 16, 2019 at 01:40:20PM +0100, Tomas Härdin wrote: > > Hi > > > > I was helping the fine folks at peppercarrot.com with web video > > nonsense, and I notice palettegen outputs more colors than it should > > due to padding the generated palette with pure black. > > > > Compare this (ffmpeg version 3.2.12-1~deb9u1): > > http://www.härdin.se/files/peppercarrot_gif/output-blackspecks-64.gif > > with this (282a471 with this patch applied): > > http://www.härdin.se/files/peppercarrot_gif/output-fixed-64.gif > > > > The attached patch fixes this by padding with the last color instead of > > black. > > > > /Tomas > > > From 3a01f62fdcc95cc7afaf5aa6e439b8742cce43bc Mon Sep 17 00:00:00 2001 > > From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= > > Date: Wed, 16 Jan 2019 13:07:48 +0100 > > Subject: [PATCH] palettegen: Fill with last color, not black > > > > If we fill with black then the generated palette will have one color more > > than what the user requested. This also resulted in unwanted black specks in > > the output of paletteuse, especially when generating small palettes. > > --- > > libavfilter/vf_palettegen.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c > > index 5ff73e6b2b..44323782d2 100644 > > --- a/libavfilter/vf_palettegen.c > > +++ b/libavfilter/vf_palettegen.c > > @@ -245,7 +245,7 @@ static void write_palette(AVFilterContext *ctx, AVFrame > > *out) > > av_log(ctx, AV_LOG_WARNING, "Dupped color: > > %08"PRIX32"\n", pal[x]); > > last_color = pal[x]; > > } else { > > -pal[x] = 0xff00; // pad with black > > +pal[x] = last_color; // pad with last color > > } > > } > > pal += pal_linesize; > > Code LGTM, thanks > > No FATE change? --- ./tests/ref/fate/filter-palettegen-22019-01-15 01:24:17.53094 +0100 +++ tests/data/fate/filter-palettegen-2 2019-01-17 11:13:21.077198948 +0100 @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 16x16 #sar 0: 1/1 -0, 0, 0,1, 1024, 0x906ff5aa +0, 0, 0,1, 1024, 0x23e072c8 Test filter-palettegen-2 failed. Look at tests/data/fate/filter-palettegen-2.err for details. make: *** [fate-filter-palettegen-2] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In fact, the RIAA has been known to suggest that students drop out of college or go to community college in order to be able to afford settlements. -- The RIAA signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] palettegen: Fill with last color, not black
On Wed, Jan 16, 2019 at 01:40:20PM +0100, Tomas Härdin wrote: > Hi > > I was helping the fine folks at peppercarrot.com with web video > nonsense, and I notice palettegen outputs more colors than it should > due to padding the generated palette with pure black. > > Compare this (ffmpeg version 3.2.12-1~deb9u1): > http://www.härdin.se/files/peppercarrot_gif/output-blackspecks-64.gif > with this (282a471 with this patch applied): > http://www.härdin.se/files/peppercarrot_gif/output-fixed-64.gif > > The attached patch fixes this by padding with the last color instead of > black. > > /Tomas > From 3a01f62fdcc95cc7afaf5aa6e439b8742cce43bc Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= > Date: Wed, 16 Jan 2019 13:07:48 +0100 > Subject: [PATCH] palettegen: Fill with last color, not black > > If we fill with black then the generated palette will have one color more > than what the user requested. This also resulted in unwanted black specks in > the output of paletteuse, especially when generating small palettes. > --- > libavfilter/vf_palettegen.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c > index 5ff73e6b2b..44323782d2 100644 > --- a/libavfilter/vf_palettegen.c > +++ b/libavfilter/vf_palettegen.c > @@ -245,7 +245,7 @@ static void write_palette(AVFilterContext *ctx, AVFrame > *out) > av_log(ctx, AV_LOG_WARNING, "Dupped color: > %08"PRIX32"\n", pal[x]); > last_color = pal[x]; > } else { > -pal[x] = 0xff00; // pad with black > +pal[x] = last_color; // pad with last color > } > } > pal += pal_linesize; Code LGTM, thanks No FATE change? Regards, -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] palettegen: Fill with last color, not black
2019-01-16 13:40 GMT+01:00, Tomas Härdin : > Hi > > I was helping the fine folks at peppercarrot.com with web video > nonsense, and I notice palettegen outputs more colors than it should > due to padding the generated palette with pure black. > > Compare this (ffmpeg version 3.2.12-1~deb9u1): > http://www.härdin.se/files/peppercarrot_gif/output-blackspecks-64.gif > with this (282a471 with this patch applied): > http://www.härdin.se/files/peppercarrot_gif/output-fixed-64.gif > > The attached patch fixes this by padding with the last color instead of > black. lgtm, but I believe there is a maintainer so please wait a few days. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel