Patch attached.

- Andreas
From 6a826c7b15021eeb8c4b3ab288262c18daa43fcf Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
Date: Sun, 9 Mar 2025 04:52:50 +0100
Subject: [PATCH] avcodec/snow: Remove ff_snow_release_buffer()

Pointless after 7e41f95dce6390f39a5134a25213828ed65fac6b.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 libavcodec/snow.c    | 13 ++-----------
 libavcodec/snow.h    |  1 -
 libavcodec/snowdec.c |  2 +-
 libavcodec/snowenc.c |  2 +-
 4 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 7998ee27f7..e0ce83eb9c 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -511,27 +511,18 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) {
     return 0;
 }
 
-void ff_snow_release_buffer(AVCodecContext *avctx)
-{
-    SnowContext *s = avctx->priv_data;
-
-    if(s->last_picture[s->max_ref_frames-1]->data[0]){
-        av_frame_unref(s->last_picture[s->max_ref_frames-1]);
-    }
-}
-
 int ff_snow_frames_prepare(SnowContext *s)
 {
    AVFrame *tmp;
 
-    ff_snow_release_buffer(s->avctx);
-
     tmp= s->last_picture[s->max_ref_frames-1];
     for (int i = s->max_ref_frames - 1; i > 0; i--)
         s->last_picture[i] = s->last_picture[i-1];
     s->last_picture[0] = s->current_picture;
     s->current_picture = tmp;
 
+    av_frame_unref(s->current_picture);
+
     if(s->keyframe){
         s->ref_frames= 0;
         s->current_picture->flags |= AV_FRAME_FLAG_KEY;
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index a5e2c138cb..ff7ebc1c58 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -181,7 +181,6 @@ extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
 int ff_snow_common_init(AVCodecContext *avctx);
 int ff_snow_common_init_after_header(AVCodecContext *avctx);
 void ff_snow_common_end(SnowContext *s);
-void ff_snow_release_buffer(AVCodecContext *avctx);
 void ff_snow_reset_contexts(SnowContext *s);
 int ff_snow_alloc_blocks(SnowContext *s);
 int ff_snow_frames_prepare(SnowContext *s);
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index d99da8a4f3..c16e824c73 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -781,7 +781,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
 
     emms_c();
 
-    ff_snow_release_buffer(avctx);
+    av_frame_unref(s->last_picture[s->max_ref_frames - 1]);
 
     if(!(s->avctx->debug&2048))
         res = av_frame_ref(picture, s->current_picture);
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index fe8ffdcdcd..a5bf2a9522 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -2039,7 +2039,7 @@ redo_frame:
 
     update_last_header_values(s);
 
-    ff_snow_release_buffer(avctx);
+    av_frame_unref(s->last_picture[s->max_ref_frames - 1]);
 
     s->current_picture->pict_type = pic->pict_type;
     s->current_picture->quality = pic->quality;
-- 
2.45.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to