diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-22 20:33:32 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-10-26 13:18:01 +0200 |
commit | ba6a5e7a3d4c372a98f910dda7e4d65847eda817 (patch) | |
tree | a44ce357d729911d65d9201cc79c89c1611d9d7e /libavcodec | |
parent | 2b300eb533a45c471f09f60885e3c38ed9e5df1b (diff) | |
download | ffmpeg-ba6a5e7a3d4c372a98f910dda7e4d65847eda817.tar.gz |
avcodec/hevcdec: Move collocated_ref to HEVCContext
Only the collocated_ref of the current frame (i.e. HEVCContext.ref)
is ever used*, so move it to HEVCContext directly after ref.
*: This goes so far that collocated_ref was not even synced across
threads in case of frame-threading.
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/hevc_mvs.c | 2 | ||||
-rw-r--r-- | libavcodec/hevc_refs.c | 5 | ||||
-rw-r--r-- | libavcodec/hevcdec.c | 6 | ||||
-rw-r--r-- | libavcodec/hevcdec.h | 2 |
4 files changed, 7 insertions, 8 deletions
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c index c231797a57..0a8cc2c43d 100644 --- a/libavcodec/hevc_mvs.c +++ b/libavcodec/hevc_mvs.c @@ -227,7 +227,7 @@ static int temporal_luma_motion_vector(const HEVCContext *s, int x0, int y0, int availableFlagLXCol = 0; int colPic; - const HEVCFrame *ref = s->ref->collocated_ref; + const HEVCFrame *ref = s->collocated_ref; if (!ref) { memset(mvLXCol, 0, sizeof(*mvLXCol)); diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 793514e5d8..10fdeaf7ff 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -51,8 +51,6 @@ void ff_hevc_unref_frame(HEVCFrame *frame, int flags) frame->rpl_tab = NULL; frame->refPicList = NULL; - frame->collocated_ref = NULL; - ff_refstruct_unref(&frame->hwaccel_picture_private); } } @@ -156,6 +154,7 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc) *frame = ref->frame; s->ref = ref; + s->collocated_ref = NULL; if (s->sh.pic_output_flag) ref->flags = HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_SHORT_REF; @@ -387,7 +386,7 @@ int ff_hevc_slice_rpl(HEVCContext *s) if (sh->collocated_list == list_idx && sh->collocated_ref_idx < rpl->nb_refs) - s->ref->collocated_ref = rpl->ref[sh->collocated_ref_idx]; + s->collocated_ref = rpl->ref[sh->collocated_ref_idx]; } return 0; diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index eb881c3ddb..b267f6ebcf 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2920,7 +2920,7 @@ static int hevc_frame_start(HEVCContext *s) fail: if (s->ref) ff_hevc_unref_frame(s->ref, ~0); - s->ref = NULL; + s->ref = s->collocated_ref = NULL; return ret; } @@ -3136,7 +3136,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) int i, ret = 0; int eos_at_start = 1; - s->ref = NULL; + s->ref = s->collocated_ref = NULL; s->last_eos = s->eos; s->eos = 0; s->overlap = 0; @@ -3351,7 +3351,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, AVFrame *rframe, old, s->dovi_ctx.dv_profile); } - s->ref = NULL; + s->ref = s->collocated_ref = NULL; ret = decode_nal_units(s, avpkt->data, avpkt->size); if (ret < 0) return ret; diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 7f165b077d..6ef7d4f60f 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -413,7 +413,6 @@ typedef struct HEVCFrame { RefPicListTab **rpl_tab; int ctb_count; int poc; - struct HEVCFrame *collocated_ref; AVBufferRef *tab_mvf_buf; AVBufferRef *rpl_tab_buf; @@ -529,6 +528,7 @@ typedef struct HEVCContext { enum HEVCNALUnitType nal_unit_type; int temporal_id; ///< temporal_id_plus1 - 1 HEVCFrame *ref; + HEVCFrame *collocated_ref; HEVCFrame DPB[32]; int poc; int pocTid0; |