]> git.sesse.net Git - ffmpeg/commit
avcodec/gifenc: Only write frame palette entries that actually used
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>
Thu, 4 Feb 2021 16:44:44 +0000 (16:44 +0000)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Thu, 25 Feb 2021 16:41:24 +0000 (16:41 +0000)
commit5a343853c0dd9a9d074d416d347ecad9e3271715
treed847c143928220ecf72c2cd75e27df5087bf110c
parent5f2804aba71dbf4833a3cc5e7b30e8351cd9037a
avcodec/gifenc: Only write frame palette entries that actually used

GIF palette entries are not compressed, and writing 256 entries,
which can be up to every frame, uses a significant amount of
space, especially in extreme cases, where palettes can be very
small.

Example, first six seconds of Tears of Steel, palette generated
with libimagequant, 320x240 resolution, and with transparency
optimization + per frame palette:

    * Before patch: 186765 bytes
    * After patch: 77895 bytes

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
libavcodec/gif.c