diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-06 16:49:23 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-09 19:22:35 +0300 |
commit | 02220b88fc38ef9dd4f2d519f5d3e4151258b60c (patch) | |
tree | 5ab09d5c019a822c0a839c6076bccff670986867 /libavcodec/nvdec_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/nvdec_av1.c')
-rw-r--r-- | libavcodec/nvdec_av1.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/nvdec_av1.c b/libavcodec/nvdec_av1.c index 1ce846a60d..3bbcd76123 100644 --- a/libavcodec/nvdec_av1.c +++ b/libavcodec/nvdec_av1.c @@ -49,7 +49,7 @@ static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u CUVIDAV1PICPARAMS *ppc = &pp->CodecSpecific.av1; FrameDecodeData *fdd; NVDECFrame *cf; - AVFrame *cur_frame = s->cur_frame.tf.f; + AVFrame *cur_frame = s->cur_frame.f; unsigned char remap_lr_type[4] = { AV1_RESTORE_NONE, AV1_RESTORE_SWITCHABLE, AV1_RESTORE_WIENER, AV1_RESTORE_SGRPROJ }; @@ -233,7 +233,7 @@ static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u ppc->loop_filter_ref_deltas[i] = frame_header->loop_filter_ref_deltas[i]; /* Reference Frames */ - ppc->ref_frame_map[i] = ff_nvdec_get_ref_idx(s->ref[i].tf.f); + ppc->ref_frame_map[i] = ff_nvdec_get_ref_idx(s->ref[i].f); } if (frame_header->primary_ref_frame == AV1_PRIMARY_REF_NONE) { @@ -246,7 +246,7 @@ static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u for (i = 0; i < AV1_REFS_PER_FRAME; ++i) { /* Ref Frame List */ int8_t ref_idx = frame_header->ref_frame_idx[i]; - AVFrame *ref_frame = s->ref[ref_idx].tf.f; + AVFrame *ref_frame = s->ref[ref_idx].f; ppc->ref_frame[i].index = ppc->ref_frame_map[ref_idx]; ppc->ref_frame[i].width = ref_frame->width; |