[FFmpeg-devel] [PATCH 3/7] Removing some debugging

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Oct 5 22:44:46 EEST 2017

2017-10-05 16:43 GMT+02:00 Bjorn Roche <bjorn at giphy.com>:
> On Tue, Oct 3, 2017 at 4:02 AM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
>> 2017-10-03 1:52 GMT+02:00 Bjorn Roche <bjorn at giphy.com>:
>> > Attached is a patch for paletteuse only.
>> I tested the following with and without your patch:
>> $ ffmpeg -i fate-suite/lena.pnm -vf palettegen pal.png
>> $ ffmpeg -i fate-suite/lena.pnm -i pal.png -lavfi paletteuse out.png
>> out.png changes with your patch: Is that intended?
> Not intended, but not unexpected -- the ordering of colors in the palette
> changed to make it easier to deal with transparency. However, there are
> visual differences, so that's obviously a bug. I've supplied a new patch
> (below) that fixes that bug, and maintains the order so it's easier to test
> for that.
>> The input frame contains no transparency.
>> Your patch still contains printfs that should be removed
>> (change them to av_log(DEBUG) if you think they are
>> useful) and a new warning is shown at compilation:
>> libavfilter/vf_paletteuse.c: In function ‘colormap_nearest_recursive’:
>> libavfilter/vf_paletteuse.c:242:5: warning: ISO C90 forbids mixed
>> declarations and code
>> Please fix the style: Space after "if", no space after "if ("
> Thank you for your attention. This should also be resolved
> in the attached patch.
> I have tested fate, all dithering (including none, which I added)
> and all color search algorithms.

I tested the following with the sample from ticket #503:
$ ffmpeg -i rgba64le-lzw.tif -vf palettegen pal.png
$ ffmpeg -i rgba64le-lzw.tif -i pal.png -lavfi paletteuse out.gif

The output file has its background (that is supposed to be
transparent) converted to white (which I believe is good)
but the respective colour white (that is the 256th and last
colour in the palette) is not transparent but opaque (0xff).
Instead the first colour (0x00ff00) is the only transparent
colour in the palette. The output gif is opaque.

I confirmed that if I force the first palette entry to opaque
(0xFF00FF00) and the last one to transparent (0xFFFFFF)
in apply_palette() I get the expected transparent output with
above command line.

Thank you, Carl Eugen

More information about the ffmpeg-devel mailing list