]> git.sesse.net Git - ffmpeg/commitdiff
palettegen: Fill with last color, not black
authorTomas Härdin <tjoppen@acc.umu.se>
Wed, 16 Jan 2019 12:07:48 +0000 (13:07 +0100)
committerTomas Härdin <tjoppen@acc.umu.se>
Tue, 19 Feb 2019 20:29:03 +0000 (21:29 +0100)
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
tests/ref/fate/filter-palettegen-2

index 5ff73e6b2b0d9cd7b69fb8102cc47961dd62a8df..44323782d22a366504521a610ad8367567846dc5 100644 (file)
@@ -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] = 0xff000000; // pad with black
+                pal[x] = last_color; // pad with last color
             }
         }
         pal += pal_linesize;
index aa07b6cb939de4da5fc68e3373c550ee270af274..9abec0fe8ef4b09f816e3268a7ac3904d393715b 100644 (file)
@@ -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