PR #21792 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21792
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21792.patch

Signed-off-by: Michael Niedermayer <[email protected]>


>From 30ca22ed8bd12488fd2becc7aefe1970b0d2845a Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Thu, 19 Feb 2026 03:19:34 +0100
Subject: [PATCH] avcodec/snowdec: fix mconly

Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/snow.c    | 4 ++--
 libavcodec/snowdec.c | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 006d84d8ce..0fffc25424 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -541,8 +541,8 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) 
{
 
     if(!s->scratchbuf) {
         int emu_buf_size;
-        emu_buf_size = FFMAX(s->mconly_picture->linesize[0], 
2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1);
-        if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf,      
FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE) ||
+        emu_buf_size = FFMAX(s->current_picture->linesize[0], 
2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1);
+        if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf,      
FFMAX(s->current_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE) ||
             !FF_ALLOCZ_TYPED_ARRAY(s->emu_edge_buffer, emu_buf_size))
             return AVERROR(ENOMEM);
     }
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index c16e824c73..752cb4363a 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -605,14 +605,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*picture,
     if ((res = decode_header(s)) < 0)
         return res;
 
-    if (!s->mconly_picture->data[0]) {
+    if (avctx->debug & 2048) {
+        av_frame_unref(s->mconly_picture);
         res = ff_get_buffer(avctx, s->mconly_picture, AV_GET_BUFFER_FLAG_REF);
         if (res < 0)
             return res;
-    }
-    if (s->mconly_picture->format != avctx->pix_fmt) {
-        av_log(avctx, AV_LOG_ERROR, "pixel format changed\n");
-        return AVERROR_INVALIDDATA;
+
+        av_assert0 (s->mconly_picture->format == avctx->pix_fmt);
     }
 
     if ((res=ff_snow_common_init_after_header(avctx)) < 0)
-- 
2.52.0

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

Reply via email to