PR #20897 opened by damitha URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20897 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20897.patch
Addressing the fact that first frame has a LCT when global palette is used for pal8. issue: [#20896](https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/20896) >From 66ba0e8c08668f1796469058024db4cd182289ec Mon Sep 17 00:00:00 2001 From: Damitha Gunawardena <[email protected]> Date: Wed, 12 Nov 2025 15:12:07 +1100 Subject: [PATCH] avcodec/gifenc: avoid redundant local color table when global palette is used Addressing the fact that first frame has a LCT when global pallette is used for pal8. issue: #20896 --- libavcodec/gif.c | 2 ++ tests/ref/fate/gifenc-pal8 | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/gif.c b/libavcodec/gif.c index c11cad8d38..132ce07e6c 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -492,6 +492,8 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt, memcpy(s->palette, palette, AVPALETTE_SIZE); s->transparent_index = get_palette_transparency_index(palette); s->palette_loaded = 1; + if (s->use_global_palette) + palette = NULL; } else if (!memcmp(s->palette, palette, AVPALETTE_SIZE)) { palette = NULL; } diff --git a/tests/ref/fate/gifenc-pal8 b/tests/ref/fate/gifenc-pal8 index 1a074b8fd8..d4a42b03b2 100644 --- a/tests/ref/fate/gifenc-pal8 +++ b/tests/ref/fate/gifenc-pal8 @@ -3,7 +3,7 @@ #codec_id 0: gif #dimensions 0: 217x217 #sar 0: 0/1 -0, 0, 0, 1, 2109, 0x39642b3d +0, 0, 0, 1, 1341, 0xe4e2af18 0, 1, 1, 1, 236, 0x332769fd, F=0x0 0, 2, 2, 1, 186, 0x770d5061, F=0x0 0, 3, 3, 1, 208, 0x55784c8f, F=0x0 -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
