aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vp9.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/vp9.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/vp9.c')
-rw-r--r--libavcodec/vp9.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index c9cc81ec94..885500fdb4 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -97,9 +97,9 @@ static void vp9_tile_data_free(VP9TileData *td)
av_freep(&td->block_structure);
}
-static void vp9_frame_unref(AVCodecContext *avctx, VP9Frame *f)
+static void vp9_frame_unref(VP9Frame *f)
{
- ff_thread_release_ext_buffer(avctx, &f->tf);
+ ff_thread_release_ext_buffer(&f->tf);
av_buffer_unref(&f->extradata);
ff_refstruct_unref(&f->hwaccel_picture_private);
f->segmentation_map = NULL;
@@ -142,11 +142,11 @@ static int vp9_frame_alloc(AVCodecContext *avctx, VP9Frame *f)
return 0;
fail:
- vp9_frame_unref(avctx, f);
+ vp9_frame_unref(f);
return ret;
}
-static int vp9_frame_ref(AVCodecContext *avctx, VP9Frame *dst, VP9Frame *src)
+static int vp9_frame_ref(VP9Frame *dst, VP9Frame *src)
{
int ret;
@@ -168,7 +168,7 @@ static int vp9_frame_ref(AVCodecContext *avctx, VP9Frame *dst, VP9Frame *src)
return 0;
fail:
- vp9_frame_unref(avctx, dst);
+ vp9_frame_unref(dst);
return AVERROR(ENOMEM);
}
@@ -1242,14 +1242,14 @@ static av_cold int vp9_decode_free(AVCodecContext *avctx)
int i;
for (i = 0; i < 3; i++) {
- vp9_frame_unref(avctx, &s->s.frames[i]);
+ vp9_frame_unref(&s->s.frames[i]);
av_frame_free(&s->s.frames[i].tf.f);
}
av_buffer_pool_uninit(&s->frame_extradata_pool);
for (i = 0; i < 8; i++) {
- ff_thread_release_ext_buffer(avctx, &s->s.refs[i]);
+ ff_thread_release_ext_buffer(&s->s.refs[i]);
av_frame_free(&s->s.refs[i].f);
- ff_thread_release_ext_buffer(avctx, &s->next_refs[i]);
+ ff_thread_release_ext_buffer(&s->next_refs[i]);
av_frame_free(&s->next_refs[i].f);
}
@@ -1577,7 +1577,7 @@ static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
frame->pkt_dts = pkt->dts;
for (i = 0; i < 8; i++) {
if (s->next_refs[i].f->buf[0])
- ff_thread_release_ext_buffer(avctx, &s->next_refs[i]);
+ ff_thread_release_ext_buffer(&s->next_refs[i]);
if (s->s.refs[i].f->buf[0] &&
(ret = ff_thread_ref_frame(&s->next_refs[i], &s->s.refs[i])) < 0)
return ret;
@@ -1590,18 +1590,18 @@ static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (!retain_segmap_ref || s->s.h.keyframe || s->s.h.intraonly) {
if (s->s.frames[REF_FRAME_SEGMAP].tf.f->buf[0])
- vp9_frame_unref(avctx, &s->s.frames[REF_FRAME_SEGMAP]);
+ vp9_frame_unref(&s->s.frames[REF_FRAME_SEGMAP]);
if (!s->s.h.keyframe && !s->s.h.intraonly && !s->s.h.errorres && s->s.frames[CUR_FRAME].tf.f->buf[0] &&
- (ret = vp9_frame_ref(avctx, &s->s.frames[REF_FRAME_SEGMAP], &s->s.frames[CUR_FRAME])) < 0)
+ (ret = vp9_frame_ref(&s->s.frames[REF_FRAME_SEGMAP], &s->s.frames[CUR_FRAME])) < 0)
return ret;
}
if (s->s.frames[REF_FRAME_MVPAIR].tf.f->buf[0])
- vp9_frame_unref(avctx, &s->s.frames[REF_FRAME_MVPAIR]);
+ vp9_frame_unref(&s->s.frames[REF_FRAME_MVPAIR]);
if (!s->s.h.intraonly && !s->s.h.keyframe && !s->s.h.errorres && s->s.frames[CUR_FRAME].tf.f->buf[0] &&
- (ret = vp9_frame_ref(avctx, &s->s.frames[REF_FRAME_MVPAIR], &s->s.frames[CUR_FRAME])) < 0)
+ (ret = vp9_frame_ref(&s->s.frames[REF_FRAME_MVPAIR], &s->s.frames[CUR_FRAME])) < 0)
return ret;
if (s->s.frames[CUR_FRAME].tf.f->buf[0])
- vp9_frame_unref(avctx, &s->s.frames[CUR_FRAME]);
+ vp9_frame_unref(&s->s.frames[CUR_FRAME]);
if ((ret = vp9_frame_alloc(avctx, &s->s.frames[CUR_FRAME])) < 0)
return ret;
f = s->s.frames[CUR_FRAME].tf.f;
@@ -1614,13 +1614,13 @@ static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (s->s.frames[REF_FRAME_SEGMAP].tf.f->buf[0] &&
(s->s.frames[REF_FRAME_MVPAIR].tf.f->width != s->s.frames[CUR_FRAME].tf.f->width ||
s->s.frames[REF_FRAME_MVPAIR].tf.f->height != s->s.frames[CUR_FRAME].tf.f->height)) {
- vp9_frame_unref(avctx, &s->s.frames[REF_FRAME_SEGMAP]);
+ vp9_frame_unref(&s->s.frames[REF_FRAME_SEGMAP]);
}
// ref frame setup
for (i = 0; i < 8; i++) {
if (s->next_refs[i].f->buf[0])
- ff_thread_release_ext_buffer(avctx, &s->next_refs[i]);
+ ff_thread_release_ext_buffer(&s->next_refs[i]);
if (s->s.h.refreshrefmask & (1 << i)) {
ret = ff_thread_ref_frame(&s->next_refs[i], &s->s.frames[CUR_FRAME].tf);
} else if (s->s.refs[i].f->buf[0]) {
@@ -1770,7 +1770,7 @@ finish:
// ref frame setup
for (i = 0; i < 8; i++) {
if (s->s.refs[i].f->buf[0])
- ff_thread_release_ext_buffer(avctx, &s->s.refs[i]);
+ ff_thread_release_ext_buffer(&s->s.refs[i]);
if (s->next_refs[i].f->buf[0] &&
(ret = ff_thread_ref_frame(&s->s.refs[i], &s->next_refs[i])) < 0)
return ret;
@@ -1791,9 +1791,9 @@ static void vp9_decode_flush(AVCodecContext *avctx)
int i;
for (i = 0; i < 3; i++)
- vp9_frame_unref(avctx, &s->s.frames[i]);
+ vp9_frame_unref(&s->s.frames[i]);
for (i = 0; i < 8; i++)
- ff_thread_release_ext_buffer(avctx, &s->s.refs[i]);
+ ff_thread_release_ext_buffer(&s->s.refs[i]);
if (FF_HW_HAS_CB(avctx, flush))
FF_HW_SIMPLE_CALL(avctx, flush);
@@ -1837,15 +1837,15 @@ static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
for (i = 0; i < 3; i++) {
if (s->s.frames[i].tf.f->buf[0])
- vp9_frame_unref(dst, &s->s.frames[i]);
+ vp9_frame_unref(&s->s.frames[i]);
if (ssrc->s.frames[i].tf.f->buf[0]) {
- if ((ret = vp9_frame_ref(dst, &s->s.frames[i], &ssrc->s.frames[i])) < 0)
+ if ((ret = vp9_frame_ref(&s->s.frames[i], &ssrc->s.frames[i])) < 0)
return ret;
}
}
for (i = 0; i < 8; i++) {
if (s->s.refs[i].f->buf[0])
- ff_thread_release_ext_buffer(dst, &s->s.refs[i]);
+ ff_thread_release_ext_buffer(&s->s.refs[i]);
if (ssrc->next_refs[i].f->buf[0]) {
if ((ret = ff_thread_ref_frame(&s->s.refs[i], &ssrc->next_refs[i])) < 0)
return ret;