From: Fei Wang <fei.w.w...@intel.com> So that hardware decoder can use the flags too.
Signed-off-by: Fei Wang <fei.w.w...@intel.com> --- libavcodec/vvc/refs.c | 38 +++++++++++++++++--------------------- libavcodec/vvc/refs.h | 5 +++++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/libavcodec/vvc/refs.c b/libavcodec/vvc/refs.c index 133ff9eaba..3e5573df29 100644 --- a/libavcodec/vvc/refs.c +++ b/libavcodec/vvc/refs.c @@ -29,10 +29,6 @@ #include "refs.h" -#define VVC_FRAME_FLAG_OUTPUT (1 << 0) -#define VVC_FRAME_FLAG_SHORT_REF (1 << 1) -#define VVC_FRAME_FLAG_LONG_REF (1 << 2) -#define VVC_FRAME_FLAG_BUMPING (1 << 3) typedef struct FrameProgress { atomic_int progress[VVC_PROGRESS_LAST]; @@ -80,7 +76,7 @@ void ff_vvc_clear_refs(VVCFrameContext *fc) { for (int i = 0; i < FF_ARRAY_ELEMS(fc->DPB); i++) ff_vvc_unref_frame(fc, &fc->DPB[i], - VVC_FRAME_FLAG_SHORT_REF | VVC_FRAME_FLAG_LONG_REF); + FF_VVC_FRAME_FLAG_SHORT_REF | FF_VVC_FRAME_FLAG_LONG_REF); } void ff_vvc_flush_dpb(VVCFrameContext *fc) @@ -191,12 +187,12 @@ int ff_vvc_set_new_ref(VVCContext *s, VVCFrameContext *fc, AVFrame **frame) fc->ref = ref; if (s->no_output_before_recovery_flag && (IS_RASL(s) || !GDR_IS_RECOVERED(s))) - ref->flags = VVC_FRAME_FLAG_SHORT_REF; + ref->flags = FF_VVC_FRAME_FLAG_SHORT_REF; else if (ph->r->ph_pic_output_flag) - ref->flags = VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_SHORT_REF; + ref->flags = FF_VVC_FRAME_FLAG_OUTPUT | FF_VVC_FRAME_FLAG_SHORT_REF; if (!ph->r->ph_non_ref_pic_flag) - ref->flags |= VVC_FRAME_FLAG_SHORT_REF; + ref->flags |= FF_VVC_FRAME_FLAG_SHORT_REF; ref->poc = poc; ref->sequence = s->seq_decode; @@ -219,16 +215,16 @@ int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, AVFrame *out, const if (no_output_of_prior_pics_flag) { for (int i = 0; i < FF_ARRAY_ELEMS(fc->DPB); i++) { VVCFrame *frame = &fc->DPB[i]; - if (!(frame->flags & VVC_FRAME_FLAG_BUMPING) && frame->poc != fc->ps.ph.poc && + if (!(frame->flags & FF_VVC_FRAME_FLAG_BUMPING) && frame->poc != fc->ps.ph.poc && frame->sequence == s->seq_output) { - ff_vvc_unref_frame(fc, frame, VVC_FRAME_FLAG_OUTPUT); + ff_vvc_unref_frame(fc, frame, FF_VVC_FRAME_FLAG_OUTPUT); } } } for (int i = 0; i < FF_ARRAY_ELEMS(fc->DPB); i++) { VVCFrame *frame = &fc->DPB[i]; - if ((frame->flags & VVC_FRAME_FLAG_OUTPUT) && + if ((frame->flags & FF_VVC_FRAME_FLAG_OUTPUT) && frame->sequence == s->seq_output) { nb_output++; if (frame->poc < min_poc || nb_output == 1) { @@ -247,10 +243,10 @@ int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, AVFrame *out, const VVCFrame *frame = &fc->DPB[min_idx]; ret = av_frame_ref(out, frame->frame); - if (frame->flags & VVC_FRAME_FLAG_BUMPING) - ff_vvc_unref_frame(fc, frame, VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_BUMPING); + if (frame->flags & FF_VVC_FRAME_FLAG_BUMPING) + ff_vvc_unref_frame(fc, frame, FF_VVC_FRAME_FLAG_OUTPUT | FF_VVC_FRAME_FLAG_BUMPING); else - ff_vvc_unref_frame(fc, frame, VVC_FRAME_FLAG_OUTPUT); + ff_vvc_unref_frame(fc, frame, FF_VVC_FRAME_FLAG_OUTPUT); if (ret < 0) return ret; @@ -289,7 +285,7 @@ void ff_vvc_bump_frame(VVCContext *s, VVCFrameContext *fc) if ((frame->flags) && frame->sequence == s->seq_output && frame->poc != poc) { - if (frame->flags == VVC_FRAME_FLAG_OUTPUT && frame->poc < min_poc) { + if (frame->flags == FF_VVC_FRAME_FLAG_OUTPUT && frame->poc < min_poc) { min_poc = frame->poc; } } @@ -297,10 +293,10 @@ void ff_vvc_bump_frame(VVCContext *s, VVCFrameContext *fc) for (int i = 0; i < FF_ARRAY_ELEMS(fc->DPB); i++) { VVCFrame *frame = &fc->DPB[i]; - if (frame->flags & VVC_FRAME_FLAG_OUTPUT && + if (frame->flags & FF_VVC_FRAME_FLAG_OUTPUT && frame->sequence == s->seq_output && frame->poc <= min_poc) { - frame->flags |= VVC_FRAME_FLAG_BUMPING; + frame->flags |= FF_VVC_FRAME_FLAG_BUMPING; } } @@ -324,7 +320,7 @@ static VVCFrame *find_ref_idx(VVCContext *s, VVCFrameContext *fc, int poc, uint8 static void mark_ref(VVCFrame *frame, int flag) { - frame->flags &= ~(VVC_FRAME_FLAG_LONG_REF | VVC_FRAME_FLAG_SHORT_REF); + frame->flags &= ~(FF_VVC_FRAME_FLAG_LONG_REF | FF_VVC_FRAME_FLAG_SHORT_REF); frame->flags |= flag; } @@ -398,7 +394,7 @@ static int add_candidate_ref(VVCContext *s, VVCFrameContext *fc, RefPicList *lis refp->poc = poc; refp->ref = ref; - refp->is_lt = ref_flag & VVC_FRAME_FLAG_LONG_REF; + refp->is_lt = ref_flag & FF_VVC_FRAME_FLAG_LONG_REF; refp->is_scaled = ref->sps->r->sps_num_subpics_minus1 != fc->ref->sps->r->sps_num_subpics_minus1|| memcmp(&ref->scaling_win, &fc->ref->scaling_win, sizeof(ref->scaling_win)) || ref->pps->r->pps_pic_width_in_luma_samples != fc->ref->pps->r->pps_pic_width_in_luma_samples || @@ -489,11 +485,11 @@ int ff_vvc_slice_rpl(VVCContext *s, VVCFrameContext *fc, SliceContext *sc) if (rpls->st_ref_pic_flag[i]) { poc = poc_base + delta_poc_st(rpls, lx, i, sps); poc_base = poc; - ref_flag = VVC_FRAME_FLAG_SHORT_REF; + ref_flag = FF_VVC_FRAME_FLAG_SHORT_REF; } else { use_msb = ref_lists->delta_poc_msb_cycle_present_flag[lx][j]; poc = poc_lt(&prev_delta_poc_msb, ph->poc, ref_lists, lx, j, max_poc_lsb); - ref_flag = VVC_FRAME_FLAG_LONG_REF; + ref_flag = FF_VVC_FRAME_FLAG_LONG_REF; j++; } ret = add_candidate_ref(s, fc, rpl, poc, ref_flag, use_msb); diff --git a/libavcodec/vvc/refs.h b/libavcodec/vvc/refs.h index 8ae33d4a9a..fc8e0aae6d 100644 --- a/libavcodec/vvc/refs.h +++ b/libavcodec/vvc/refs.h @@ -25,6 +25,11 @@ #include "dec.h" +#define FF_VVC_FRAME_FLAG_OUTPUT (1 << 0) +#define FF_VVC_FRAME_FLAG_SHORT_REF (1 << 1) +#define FF_VVC_FRAME_FLAG_LONG_REF (1 << 2) +#define FF_VVC_FRAME_FLAG_BUMPING (1 << 3) + int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, struct AVFrame *out, int no_output_of_prior_pics_flag, int flush); void ff_vvc_bump_frame(VVCContext *s, VVCFrameContext *fc); int ff_vvc_set_new_ref(VVCContext *s, VVCFrameContext *fc, struct AVFrame **frame); -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".