From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: Re: [FFmpeg-devel] [PATCH 1/2] avcodec/pthread_frame: Remove ff_thread_release_buffer()
Date: Fri, 20 Oct 2023 17:23:29 +0200
Message-ID: <169781540929.30698.17624996838550323031@lain.khirnov.net> (raw)
In-Reply-To: <AS8P250MB0744A7310334883FB81E62058FDBA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
Quoting Andreas Rheinhardt (2023-10-20 16:33:06)
> diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> index c02408548c..1a4339b346 100644
> --- a/libavcodec/av1dec.c
> +++ b/libavcodec/av1dec.c
> @@ -636,9 +636,9 @@ static int get_pixel_format(AVCodecContext *avctx)
> return 0;
> }
>
> -static void av1_frame_unref(AVCodecContext *avctx, AV1Frame *f)
> +static void av1_frame_unref(AV1Frame *f)
> {
> - ff_thread_release_buffer(avctx, f->f);
> + av_frame_unref(f->f);
> ff_refstruct_unref(&f->hwaccel_picture_private);
> ff_refstruct_unref(&f->header_ref);
> f->raw_frame_header = NULL;
> @@ -689,7 +689,7 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s
> return 0;
>
> fail:
> - av1_frame_unref(avctx, dst);
> + av1_frame_unref(dst);
> return AVERROR(ENOMEM);
> }
>
> @@ -699,12 +699,15 @@ static av_cold int av1_decode_free(AVCodecContext *avctx)
> AV1RawMetadataITUTT35 itut_t35;
>
> for (int i = 0; i < FF_ARRAY_ELEMS(s->ref); i++) {
> - av1_frame_unref(avctx, &s->ref[i]);
> - av_frame_free(&s->ref[i].f);
> + if (s->ref[i].f) {
Wouldn't it be simpler and more consistent to check for the frame's
existence in av1_frame_unref()?
> + av1_frame_unref(&s->ref[i]);
> + av_frame_free(&s->ref[i].f);
> + }
> + }
> + if (s->cur_frame.f) {
> + av1_frame_unref(&s->cur_frame);
> + av_frame_free(&s->cur_frame.f);
> }
> - av1_frame_unref(avctx, &s->cur_frame);
> - av_frame_free(&s->cur_frame.f);
> -
> ff_refstruct_unref(&s->seq_ref);
> ff_refstruct_unref(&s->header_ref);
> ff_refstruct_unref(&s->cll_ref);
LGTM otherwise.
--
Anton Khirnov
_______________________________________________
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".
next prev parent reply other threads:[~2023-10-20 15:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 14:33 Andreas Rheinhardt
2023-10-20 14:34 ` [FFmpeg-devel] [PATCH 2/2] avcodec/av1dec, vaapi_av1: Remove excessive logmessages Andreas Rheinhardt
2023-10-20 15:23 ` Anton Khirnov [this message]
2023-10-20 15:41 ` [FFmpeg-devel] [PATCH 1/2] avcodec/pthread_frame: Remove ff_thread_release_buffer() Andreas Rheinhardt
2023-10-20 16:59 ` Anton Khirnov
2023-10-21 15:02 ` Andreas Rheinhardt
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=169781540929.30698.17624996838550323031@lain.khirnov.net \
--to=anton@khirnov.net \
--cc=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