diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-06 09:44:10 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-09 19:22:23 +0300 |
commit | f025b8e110b36c1cdb4fb56c4cd57aeca1767b5b (patch) | |
tree | 3b668e0c57158154ea4b7bdaa13cbd5ad23221da /libavcodec/wavpack.c | |
parent | b3551b6072687539c9e162fcec9e1e42a668ee8c (diff) |
avcodec/threadframe: Add ff_thread_(get|release)_ext_buffer()
These will be used by the codecs that need allocated progress
and is in preparation for no longer using ThreadFrame by the codecs
that don't.
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r-- | libavcodec/wavpack.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 5a338d7658..30790ef16e 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -1019,7 +1019,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) if (dst == src) return 0; - ff_thread_release_buffer(dst, &fdst->curr_frame); + ff_thread_release_ext_buffer(dst, &fdst->curr_frame); if (fsrc->curr_frame.f->data[0]) { if ((ret = ff_thread_ref_frame(&fdst->curr_frame, &fsrc->curr_frame)) < 0) return ret; @@ -1066,10 +1066,10 @@ static av_cold int wavpack_decode_end(AVCodecContext *avctx) av_freep(&s->fdec[i]); s->fdec_num = 0; - ff_thread_release_buffer(avctx, &s->curr_frame); + ff_thread_release_ext_buffer(avctx, &s->curr_frame); av_frame_free(&s->curr_frame.f); - ff_thread_release_buffer(avctx, &s->prev_frame); + ff_thread_release_ext_buffer(avctx, &s->prev_frame); av_frame_free(&s->prev_frame.f); av_buffer_unref(&s->dsd_ref); @@ -1539,7 +1539,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no, av_log(avctx, AV_LOG_ERROR, "Error reinitializing the DSD context\n"); return ret; } - ff_thread_release_buffer(avctx, &wc->curr_frame); + ff_thread_release_ext_buffer(avctx, &wc->curr_frame); } avctx->channels = new_channels; avctx->channel_layout = new_chmask; @@ -1547,12 +1547,14 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no, avctx->sample_fmt = sample_fmt; avctx->bits_per_raw_sample = orig_bpp; - ff_thread_release_buffer(avctx, &wc->prev_frame); + ff_thread_release_ext_buffer(avctx, &wc->prev_frame); FFSWAP(ThreadFrame, wc->curr_frame, wc->prev_frame); /* get output buffer */ wc->curr_frame.f->nb_samples = s->samples; - if ((ret = ff_thread_get_buffer(avctx, &wc->curr_frame, AV_GET_BUFFER_FLAG_REF)) < 0) + ret = ff_thread_get_ext_buffer(avctx, &wc->curr_frame, + AV_GET_BUFFER_FLAG_REF); + if (ret < 0) return ret; wc->frame = wc->curr_frame.f; @@ -1676,7 +1678,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data, } ff_thread_await_progress(&s->prev_frame, INT_MAX, 0); - ff_thread_release_buffer(avctx, &s->prev_frame); + ff_thread_release_ext_buffer(avctx, &s->prev_frame); if (s->modulation == MODULATION_DSD) avctx->execute2(avctx, dsd_channel, s->frame, NULL, avctx->channels); @@ -1693,7 +1695,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data, error: if (s->frame) { ff_thread_await_progress(&s->prev_frame, INT_MAX, 0); - ff_thread_release_buffer(avctx, &s->prev_frame); + ff_thread_release_ext_buffer(avctx, &s->prev_frame); ff_thread_report_progress(&s->curr_frame, INT_MAX, 0); } |