On Fri, Jan 02, 2026 at 01:29:32PM +0200, Hassan Hany via ffmpeg-devel wrote:
> From: "U-DESKTOP-70DF2U5\\GIGABYT" <[email protected]>
> 
> 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 <[email protected]>
> ---
> 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 <zlib.h>
>  
>  #define IOBUF_SIZE 4096
> @@ -894,6 +894,19 @@ static int apng_encode_frame(AVCodecContext *avctx, 
> const AVFrame *pict,
>          best_fctl_chunk->blend_op = APNG_BLEND_OP_SOURCE;
>          return encode_frame(avctx, pict);
>      }
> +    
> +    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pict->format);
> +        
> +    if(!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)){
> +         best_fctl_chunk->width = pict->width;
> +         best_fctl_chunk->height = pict->height;
> +         best_fctl_chunk->x_offset = 0;
> +         best_fctl_chunk->y_offset = 0;
> +         best_fctl_chunk->blend_op = APNG_BLEND_OP_SOURCE;
> +         best_fctl_chunk->dispose_op = 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 which it
values corporate profits and government espionage over security.-Bruce Schneier

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to