From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id ED38B4DF1C for ; Thu, 8 Jan 2026 02:34:04 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'1s5Y9IEGOzgMinG3SivK0YgqmUlm865nQD36EfhO9tI=', expected b'F72zoqgy96BfGBmFCQg5PDqPvt8+SSwxgkRR8FHhvQc=')) header.d=niedermayer.cc header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1767839619; h=date : to : message-id : references : mime-version : in-reply-to : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : from; bh=4S2xeBSk1B4qoQVd4Oy5QcC7nJE8RDxMp7b+j0eF6lE=; b=CF+yI9iS8GHNj3D1OOmx/fMpenJhsDWKovayLrAedMP5loJO7i3AjLjNCZIwVxpf4Eype IYJP2/DMhK9QGJ/e+foAVTruacfmoqajVCIaMV9IWK3osWjnNyh3PwXg5EQOYNCONZPR0d4 KR1uEM9WLOOK3UDyy4TlLJ1RpE3HzN/ID6N7czIFHcHqpfO8qZzTJE1ikaBwEimUm9DkJmr EgwlRiUHY78a/fhuweYsCes+/YPunvTlsu5LwIg2BdQ2nqC8JfpkftZJ4jIgw11bcmnDbq3 OHWszCbUljPZLjpqe+LI8pZDwxQ2NJq+oRIhDYYni4AYVt7+QfzNQT2nzOeg== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id B9FCC690DA7; Thu, 8 Jan 2026 04:33:39 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1767839602; b=UDFDt1bSoRJ76nkYZHTUv2s/BjUsOpd45UqsR653TRacFwt/xAlriDAFC+dSCnAmiwfTy Jpi2jKb+yZ5lQdjSpCUD0DGyqz3qrmEhSrXevFDCeI3JS1TpaV5VJ/5fv2P95xdg9H+L2vp atX1HFm6pURxhUJXF93MNY0X9yB0L/a1Ktiz3t9Hq7T5aPt4cTmDLZcUadukUZMZb2V9BO0 zdkCQe4QfYJbEE4x9kqTRsUhKPTcOdJTuoWHOnCj5IPzhBHqJKqBc9b9pKWhssrZgN20z5s x/G/Ensj45xNETTGiVbmqI2laVcmvCmIwa2R9xc1tPL9LOYaqY14NUCmu8iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1767839602; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=1s5Y9IEGOzgMinG3SivK0YgqmUlm865nQD36EfhO9tI=; b=XvgtagWR206ujnrhDdbT7rX5THRjbGpNgbtmRjicDKOUE8Ocnv6PkBI7dVZECVzrHysRn iwP7WP6yo2EzfbYVZtaK96QhntheKkzihtkQAP4L1Rk9P6JO71V/6TgdMIO2zinLeiy9uhH Mq4cX/k1R0KhZsc20YVFZGYP/soiPqmVTkeh7KmM6r2h5jqsxIM45pzo93jZyYXWiYPqVGF iyiWuAlGae0zpurb3XIhQOa44ChGPXMyIOP658iPAcL2YZeOTOyI/XMMlIQXw/O4u/Z+05o tWjo2FOjVIXq1yf7gdoeyFQ+gLGIvvXgc+NOWdRl7I5jS4oh0iDTn2UHuzvA== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=niedermayer.cc; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=niedermayer.cc; arc=none (Message is not ARC signed); dmarc=none Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id EC99B690D2F for ; Thu, 8 Jan 2026 04:33:07 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 326D01F47A for ; Thu, 8 Jan 2026 02:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1767839587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=F72zoqgy96BfGBmFCQg5PDqPvt8+SSwxgkRR8FHhvQc=; b=NEiPVYsy7q0nhllxJpUtchw32YkywqFzT/eOmTQlR6RmjWbMN6S/gOWAJSWl2QXA32mMia LqWi6DZT5nke+7fieBhhkceTBtMuPIBp46AjCK86vf/cxBEbi5o4hZbHGmiIZb828rLB2K 1UvZgrkYXKrvTARmO76CdXsI0VDOJtlE95k4Pf8NmpprnZvyt4SuKkqC46cLxFRkP9FpMH 2fHRmPiZPqm+8Z0sFx56K6vH3Qup2ukpmG6XP75uDEp96FfNjlxTG3EQvtMsW5ftVCAwDP v+ohSvLvNMztfwM/Lwmy9Ac9vM9Pnt6knqpksseYyUeFvRZKE7Whu3Eufi7nQg== Date: Thu, 8 Jan 2026 03:33:05 +0100 To: FFmpeg development discussions and patches Message-ID: References: <20260102112935.1842-1-hassanhanyrashad@gmail.com> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc X-GND-State: clean X-GND-Score: -90 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddutdegjeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculddutddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeffheevhfdvvdfhtdfgtefhtdeuleeftdevkeffleejtefhgedthfefgffgueeftdenucffohhmrghinhepfhhfmhhpvghgrdhorhhgnecukfhppeeguddrieeirdeiiedrhedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieeirdehtddphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhqihgupeefvdeiffdtudfhgeejtedpmhhouggvpehsmhhtphhouhhtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh Message-ID-Hash: 64K4Y6RQ3FUN7UTTYHNAX7R6EPP7FL6E X-Message-ID-Hash: 64K4Y6RQ3FUN7UTTYHNAX7R6EPP7FL6E X-MailFrom: SRS0=puFR=7N=niedermayer.cc=michael@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] Re: [PATCH] apng: fix rgb24 blending bug for non-alpha frames List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michael Niedermayer via ffmpeg-devel Cc: Michael Niedermayer Content-Type: multipart/mixed; boundary="===============7277486288524293597==" Archived-At: List-Archive: List-Post: --===============7277486288524293597== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rNC8+9Fj2DBxoQOC" Content-Disposition: inline --rNC8+9Fj2DBxoQOC Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Hassan On Tue, Jan 06, 2026 at 04:15:52PM +0200, hassan hany via ffmpeg-devel wrot= e: > Okay well I looked into it and it turns out that just disabling the dispo= se > background operation for non alpha formats just fixes the issue and > produces a 504kb APNG that is correct with no gray bars (currently ffmp= eg > produces a broken 503kb one) now reading the spec it does say " >=20 > - APNG_DISPOSE_OP_BACKGROUND: the frame's region of the output buffer = is > to be cleared to fully transparent black before rendering the next fra= me." > and we don't have transparency in non alpha formats the patch fixing this should be against master not against your previous pa= tch also you may want to submit it to code.ffmpeg.org thx >=20 >=20 > On Mon, Jan 5, 2026 at 6:13=E2=80=AFPM Michael Niedermayer via ffmpeg-dev= el < > ffmpeg-devel@ffmpeg.org> wrote: >=20 > > > > On Fri, Jan 02, 2026 at 01:29:32PM +0200, Hassan Hany via ffmpeg-devel > > wrote: > > > From: "U-DESKTOP-70DF2U5\\GIGABYT" > > > > > > Delta frame optimization in APNG encoder caused gray bars for RGB24 > > frames. > > > This patch disables delta optimization for non-alpha frames, ensuring > > correct > > > rendering. Delta optimization is preserved for RGBA frames. > > > > > > Fixes: trac Ticket #9602 > > > > > > Signed-off-by: U-DESKTOP-70DF2U5\GIGABYT > > > --- > > > This bug caused visible artifacts such as gray bars in non-alpha > > > pixel formats such as RGB24 or GRAY. This patch disabled delta frame > > > optimization only for non alpha channels. the output size increased > > > from 512kb to 1.1mb on the test sample but correctness was restored > > > and the relevant APNG FATE tests were ran and no regression occurred > > > libavcodec/pngenc.c | 15 ++++++++++++++- > > > 1 file changed, 14 insertions(+), 1 deletion(-) > > > > > > diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c > > > index e627bf83fc..3e46363b00 100644 > > > --- a/libavcodec/pngenc.c > > > +++ b/libavcodec/pngenc.c > > > @@ -39,7 +39,7 @@ > > > #include "libavutil/opt.h" > > > #include "libavutil/rational.h" > > > #include "libavutil/stereo3d.h" > > > - > > > +#include "libavutil/pixdesc.h" > > > #include > > > > > > #define IOBUF_SIZE 4096 > > > @@ -894,6 +894,19 @@ static int apng_encode_frame(AVCodecContext *avc= tx, > > const AVFrame *pict, > > > best_fctl_chunk->blend_op =3D APNG_BLEND_OP_SOURCE; > > > return encode_frame(avctx, pict); > > > } > > > + > > > + const AVPixFmtDescriptor *desc =3D av_pix_fmt_desc_get(pict->for= mat); > > > + > > > + if(!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)){ > > > + best_fctl_chunk->width =3D pict->width; > > > + best_fctl_chunk->height =3D pict->height; > > > + best_fctl_chunk->x_offset =3D 0; > > > + best_fctl_chunk->y_offset =3D 0; > > > + best_fctl_chunk->blend_op =3D APNG_BLEND_OP_SOURCE; > > > + best_fctl_chunk->dispose_op =3D APNG_DISPOSE_OP_NONE; > > > + return encode_frame(avctx, pict); > > > + } > > > + > > > > This looks like a hack not like a bugfix > > besides the indention is wrong and there are tabs > > > > thx > > > > [...] > > -- > > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > > > If the United States is serious about tackling the national security > > threats > > related to an insecure 5G network, it needs to rethink the extent to wh= ich > > it > > values corporate profits and government espionage over security.-Bruce > > Schneier > > _______________________________________________ > > ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org > > To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org > > > pngenc.c | 15 +++++---------- > 1 file changed, 5 insertions(+), 10 deletions(-) > 91fbbe797e2361746d404905b52e881444161f53 /var0001-avcodec-apngenc-disabl= e-background-disposal-for-non-.patch > From dd17f2d1037b529ee64f5a69a88c90b4f36033f5 Mon Sep 17 00:00:00 2001 > From: "U-DESKTOP-70DF2U5\\GIGABYT" > Date: Tue, 6 Jan 2026 15:39:51 +0200 > Subject: [PATCH] avcodec/apngenc: disable background disposal for non-alp= ha > formats >=20 > --- > libavcodec/pngenc.c | 15 +++++---------- > 1 file changed, 5 insertions(+), 10 deletions(-) >=20 > diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c > index 3e46363b00..adf5c1009e 100644 > --- a/libavcodec/pngenc.c > +++ b/libavcodec/pngenc.c > @@ -897,16 +897,6 @@ static int apng_encode_frame(AVCodecContext *avctx, = const AVFrame *pict, > =20 > const AVPixFmtDescriptor *desc =3D av_pix_fmt_desc_get(pict->format); > =20 > - if(!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)){ > - best_fctl_chunk->width =3D pict->width; > - best_fctl_chunk->height =3D pict->height; > - best_fctl_chunk->x_offset =3D 0; > - best_fctl_chunk->y_offset =3D 0; > - best_fctl_chunk->blend_op =3D APNG_BLEND_OP_SOURCE; > - best_fctl_chunk->dispose_op =3D APNG_DISPOSE_OP_NONE; > - return encode_frame(avctx, pict); > - }=20 > - =20 > =20 > diffFrame =3D av_frame_alloc(); > if (!diffFrame) > @@ -932,6 +922,11 @@ static int apng_encode_frame(AVCodecContext *avctx, = const AVFrame *pict, > // 0: APNG_DISPOSE_OP_NONE > // 1: APNG_DISPOSE_OP_BACKGROUND > // 2: APNG_DISPOSE_OP_PREVIOUS > + if(last_fctl_chunk.dispose_op=3D=3DAPNG_DISPOSE_OP_BACKGROUND) { > + if(!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)) { > + continue; > + } > + } > =20 > for (fctl_chunk.blend_op =3D 0; fctl_chunk.blend_op < 2; ++fctl_= chunk.blend_op) { > // 0: APNG_BLEND_OP_SOURCE > --=20 > 2.52.0 >=20 > _______________________________________________ > ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org > To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Modern terrorism, a quick summary: Need oil, start war with country that has oil, kill hundread thousand in war. Let country fall into chaos, be surprised about raise of fundamantalists. Drop more bombs, kill more people, be surprised about them taking revenge and drop even more bombs and strip your own citizens of their rights and freedoms. to be continued --rNC8+9Fj2DBxoQOC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaV8XXgAKCRBhHseHBAsP qxDCAJ0Zym9VGo8J+boMVZuIvDKrS1G8igCghu0w/a7IYt+BctZ2oB0lBrpRPyI= =pfwj -----END PGP SIGNATURE----- --rNC8+9Fj2DBxoQOC-- --===============7277486288524293597== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org --===============7277486288524293597==--