aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/av1dec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-12 16:52:49 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-22 22:09:59 +0200
commit315c956cbd14f021e49dac7fc0b906fad1672aad (patch)
treee16e4f55eeb57cc9c2afcf3f16a48c91d473cb08 /libavcodec/av1dec.c
parent86ed68420d3b60439d0b7767c53d0fdc1deb7277 (diff)
downloadffmpeg-315c956cbd14f021e49dac7fc0b906fad1672aad.tar.gz
avcodec/pthread_frame: Remove ff_thread_release_buffer()
It is unnecessary since the removal of non-thread-safe callbacks in e0786a8eeb9e7c8feb057e83f284491f0a87e463. Since then, the AVCodecContext has only been used as logcontext. Removing ff_thread_release_buffer() allowed to remove AVCodecContext* parameters from several other functions (not only unref functions, but also e.g. ff_h264_ref_picture() which calls ff_h264_unref_picture() on error). Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/av1dec.c')
-rw-r--r--libavcodec/av1dec.c31
1 files changed, 17 insertions, 14 deletions
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) {
+ 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);
@@ -916,7 +919,7 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f)
return 0;
fail:
- av1_frame_unref(avctx, f);
+ av1_frame_unref(f);
return ret;
}
@@ -1134,7 +1137,7 @@ static int update_reference_list(AVCodecContext *avctx)
for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
if (header->refresh_frame_flags & (1 << i)) {
- av1_frame_unref(avctx, &s->ref[i]);
+ av1_frame_unref(&s->ref[i]);
if ((ret = av1_frame_ref(avctx, &s->ref[i], &s->cur_frame)) < 0) {
av_log(avctx, AV_LOG_ERROR,
"Failed to update frame %d in reference list\n", i);
@@ -1150,7 +1153,7 @@ static int get_current_frame(AVCodecContext *avctx)
AV1DecContext *s = avctx->priv_data;
int ret;
- av1_frame_unref(avctx, &s->cur_frame);
+ av1_frame_unref(&s->cur_frame);
s->cur_frame.header_ref = ff_refstruct_ref(s->header_ref);
@@ -1257,7 +1260,7 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
s->raw_frame_header = &obu->obu.frame_header;
if (s->raw_frame_header->show_existing_frame) {
- av1_frame_unref(avctx, &s->cur_frame);
+ av1_frame_unref(&s->cur_frame);
ret = av1_frame_ref(avctx, &s->cur_frame,
&s->ref[s->raw_frame_header->frame_to_show_map_idx]);
@@ -1452,9 +1455,9 @@ static void av1_decode_flush(AVCodecContext *avctx)
AV1RawMetadataITUTT35 itut_t35;
for (int i = 0; i < FF_ARRAY_ELEMS(s->ref); i++)
- av1_frame_unref(avctx, &s->ref[i]);
+ av1_frame_unref(&s->ref[i]);
- av1_frame_unref(avctx, &s->cur_frame);
+ av1_frame_unref(&s->cur_frame);
s->operating_point_idc = 0;
s->nb_unit = 0;
s->raw_frame_header = NULL;