Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: damitha via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: damitha <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avcodec/gifenc: avoid redundant local color table when global palette is used (PR #20897)
Date: Wed, 12 Nov 2025 04:22:47 -0000
Message-ID: <176292136828.25.16859164984409181479@2cb04c0e5124> (raw)

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

                 reply	other threads:[~2025-11-12  4:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176292136828.25.16859164984409181479@2cb04c0e5124 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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