* [FFmpeg-devel] [PATCH] avcodec/gifenc: avoid redundant local color table when global palette is used (PR #20897)
@ 2025-11-12 4:22 damitha via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: damitha via ffmpeg-devel @ 2025-11-12 4:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: damitha
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 <damitha.gunawardena@gmail.com>
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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-11-12 4:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-12 4:22 [FFmpeg-devel] [PATCH] avcodec/gifenc: avoid redundant local color table when global palette is used (PR #20897) damitha via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git