Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PR] avcodec/snowdec: fix mconly (PR #21792)
@ 2026-02-19  2:32 michaelni via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: michaelni via ffmpeg-devel @ 2026-02-19  2:32 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: michaelni

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 <michael@niedermayer.cc>


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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 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 -- 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:[~2026-02-19  2:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-19  2:32 [FFmpeg-devel] [PR] avcodec/snowdec: fix mconly (PR #21792) michaelni 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