diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-06 14:49:23 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-09 17:22:35 +0100 |
commit | 02220b88fc38ef9dd4f2d519f5d3e4151258b60c (patch) | |
tree | 5ab09d5c019a822c0a839c6076bccff670986867 /libavcodec/dxva2_av1.c | |
parent | f025b8e110b36c1cdb4fb56c4cd57aeca1767b5b (diff) |
avcodec/thread: Don't use ThreadFrame when unnecessary
The majority of frame-threaded decoders (mainly the intra-only)
need exactly one part of ThreadFrame: The AVFrame. They don't
need the owners nor the progress, yet they had to use it because
ff_thread_(get|release)_buffer() requires it.
This commit changes this and makes these functions work with ordinary
AVFrames; the decoders that need the extra fields for progress
use ff_thread_(get|release)_ext_buffer() which work exactly
as ff_thread_(get|release)_buffer() used to do.
This also avoids some unnecessary allocations of progress AVBuffers,
namely for H.264 and HEVC film grain frames: These frames are not
used for synchronization and therefore don't need a ThreadFrame.
Also move the ThreadFrame structure as well as ff_thread_ref_frame()
to threadframe.h, the header for frame-threaded decoders with
inter-frame dependencies.
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/dxva2_av1.c')
-rw-r--r-- | libavcodec/dxva2_av1.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/dxva2_av1.c b/libavcodec/dxva2_av1.c index 8a912bf6c1..7b4483f855 100644 --- a/libavcodec/dxva2_av1.c +++ b/libavcodec/dxva2_av1.c @@ -72,7 +72,7 @@ static int fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *c pp->max_width = seq->max_frame_width_minus_1 + 1; pp->max_height = seq->max_frame_height_minus_1 + 1; - pp->CurrPicTextureIndex = ff_dxva2_get_surface_index(avctx, ctx, h->cur_frame.tf.f); + pp->CurrPicTextureIndex = ff_dxva2_get_surface_index(avctx, ctx, h->cur_frame.f); pp->superres_denom = frame_header->use_superres ? frame_header->coded_denom + AV1_SUPERRES_DENOM_MIN : AV1_SUPERRES_NUM; pp->bitdepth = get_bit_depth_from_seq(seq); pp->seq_profile = seq->seq_profile; @@ -132,7 +132,7 @@ static int fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *c memset(pp->RefFrameMapTextureIndex, 0xFF, sizeof(pp->RefFrameMapTextureIndex)); for (i = 0; i < AV1_REFS_PER_FRAME; i++) { int8_t ref_idx = frame_header->ref_frame_idx[i]; - AVFrame *ref_frame = h->ref[ref_idx].tf.f; + AVFrame *ref_frame = h->ref[ref_idx].f; pp->frame_refs[i].width = ref_frame->width; pp->frame_refs[i].height = ref_frame->height; @@ -146,7 +146,7 @@ static int fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *c } } for (i = 0; i < AV1_NUM_REF_FRAMES; i++) { - AVFrame *ref_frame = h->ref[i].tf.f; + AVFrame *ref_frame = h->ref[i].f; if (ref_frame->buf[0]) pp->RefFrameMapTextureIndex[i] = ff_dxva2_get_surface_index(avctx, ctx, ref_frame); } @@ -436,7 +436,7 @@ static int dxva2_av1_end_frame(AVCodecContext *avctx) if (ctx_pic->bitstream_size <= 0) return -1; - ret = ff_dxva2_common_end_frame(avctx, h->cur_frame.tf.f, + ret = ff_dxva2_common_end_frame(avctx, h->cur_frame.f, &ctx_pic->pp, sizeof(ctx_pic->pp), NULL, 0, commit_bitstream_and_slice_buffer); |