[FFmpeg-devel] [PATCH 5/6] avfilter: add paletteuse filter

Clément Bœsch u at pkh.me
Tue Jan 27 14:20:31 CET 2015

On Sun, Jan 25, 2015 at 07:55:22PM +0100, Clément Bœsch wrote:
> ---
>  doc/filters.texi            |  31 +++++
>  libavfilter/Makefile        |   1 +
>  libavfilter/allfilters.c    |   1 +
>  libavfilter/vf_paletteuse.c | 282 ++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 315 insertions(+)
>  create mode 100644 libavfilter/vf_paletteuse.c

So I did various improvements here by implementing various other error
diffusion based dithering methods: Floyd/Steinberg, Sierra2 and
Sierra2-4A. All of them seem better than Heckbert. You can observe
Heckbert vs Sierra4 here: https://lut.im/xAxNDhk4/lGZV0BS4

This match what's being said on
http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT about the
"false" Floyd-Steinberg filter, which is actually from Heckbert paper.

Somehow, Sierra4 seems to produce smaller output here (but can't be used
as a generic rule, tested on only one input). Still, all these error
diffusion ditherings make a huge impact on size:

-rw-r--r-- 1 ux ux  37M Jan 27 12:03 out-dither-floyd_steinberg.gif
-rw-r--r-- 1 ux ux  38M Jan 27 12:03 out-dither-heckbert.gif
-rw-r--r-- 1 ux ux 8.5M Jan 27 12:03 out-dither-none.gif
-rw-r--r-- 1 ux ux  38M Jan 27 12:03 out-dither-sierra2_4a.gif
-rw-r--r-- 1 ux ux  34M Jan 27 12:03 out-dither-sierra2.gif

So I'm currently trying to implement some ordered dithering to get a way
more stable output for mostly still images. If you have recommendation on
some dithering algorithm(s) I could test (it seems there are a bunch of
them out here), I'm all hear.

There are many improvement possible in this filter, notably on how the
color is chosen, but I will probably push this patchset at the end of the
week because the results are already good enough IMO.

Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150127/51af7b5a/attachment.asc>

More information about the ffmpeg-devel mailing list