Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avcodec/snow: Remove ff_snow_release_buffer()
Date: Sun, 9 Mar 2025 04:56:41 +0100
Message-ID: <AS8P250MB07441DD496768A3B9E08416E8FD72@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 27 bytes --]

Patch attached.

- Andreas

[-- Attachment #2: 0001-avcodec-snow-Remove-ff_snow_release_buffer.patch --]
[-- Type: text/x-patch, Size: 2927 bytes --]

From 6a826c7b15021eeb8c4b3ab288262c18daa43fcf Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@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.rheinhardt@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


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

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

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

                 reply	other threads:[~2025-03-09  3:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB07441DD496768A3B9E08416E8FD72@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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