[FFmpeg-devel] [PATCH v1 07/23] avcodec/vvc: refact, save pf and ciip_flag in ff_vvc_set_intra_mvf
toqsxw at gmail.com
toqsxw at gmail.com
Thu May 1 17:43:05 EEST 2025
From: Wu Jianhua <toqsxw at outlook.com>
Signed-off-by: Wu Jianhua <toqsxw at outlook.com>
---
libavcodec/vvc/ctu.c | 4 ++--
libavcodec/vvc/mvs.c | 24 ++++++++++++++++++++----
libavcodec/vvc/mvs.h | 2 +-
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
index c621b6d5d6..f77697af08 100644
--- a/libavcodec/vvc/ctu.c
+++ b/libavcodec/vvc/ctu.c
@@ -1756,7 +1756,7 @@ static void fill_dmvr_info(const VVCLocalContext *lc)
const CodingUnit *cu = lc->cu;
if (cu->pred_mode == MODE_IBC) {
- ff_vvc_set_intra_mvf(lc, 1);
+ ff_vvc_set_intra_mvf(lc, true, PF_IBC, false);
} else {
const VVCPPS *pps = fc->ps.pps;
const int w = cu->cb_width >> MIN_PU_LOG2;
@@ -1849,8 +1849,8 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, in
return AVERROR_PATCHWELCOME;
} else {
intra_luma_pred_modes(lc);
+ ff_vvc_set_intra_mvf(lc, false, PF_INTRA, cu->ciip_flag);
}
- ff_vvc_set_intra_mvf(lc, 0);
}
if ((tree_type == SINGLE_TREE || tree_type == DUAL_TREE_CHROMA) && sps->r->sps_chroma_format_idc) {
if (pred_mode_plt_flag && tree_type == DUAL_TREE_CHROMA) {
diff --git a/libavcodec/vvc/mvs.c b/libavcodec/vvc/mvs.c
index 566df158a8..8946b00b5b 100644
--- a/libavcodec/vvc/mvs.c
+++ b/libavcodec/vvc/mvs.c
@@ -144,7 +144,8 @@ static int derive_temporal_colocated_mvs(const VVCLocalContext *lc, MvField temp
const SliceContext *sc = lc->sc;
RefPicList* refPicList = sc->rpl;
- if (temp_col.pred_flag == PF_INTRA)
+ if (temp_col.pred_flag == PF_INTRA ||
+ temp_col.pred_flag == PF_IBC)
return 0;
if (sb_flag){
@@ -266,7 +267,7 @@ void ff_vvc_set_mvf(const VVCLocalContext *lc, const int x0, const int y0, const
}
}
-void ff_vvc_set_intra_mvf(const VVCLocalContext *lc, const int dmvr)
+void ff_vvc_set_intra_mvf(const VVCLocalContext *lc, const bool dmvr, const PredFlag pf, const bool ciip_flag)
{
const VVCFrameContext *fc = lc->fc;
const CodingUnit *cu = lc->cu;
@@ -277,7 +278,10 @@ void ff_vvc_set_intra_mvf(const VVCLocalContext *lc, const int dmvr)
for (int dx = 0; dx < cu->cb_width; dx += min_pu_size) {
const int x = cu->x0 + dx;
const int y = cu->y0 + dy;
- TAB_MVF(x, y).pred_flag = PF_INTRA;
+ MvField *mv = &TAB_MVF(x, y);
+
+ mv->pred_flag = pf;
+ mv->ciip_flag = ciip_flag;
}
}
}
@@ -599,7 +603,19 @@ static void init_neighbour_context(NeighbourContext *ctx, const VVCLocalContext
static av_always_inline PredMode pred_flag_to_mode(PredFlag pred)
{
- return pred == PF_IBC ? MODE_IBC : (pred == PF_INTRA ? MODE_INTRA : MODE_INTER);
+ static const PredMode lut[] = {
+ MODE_INTRA, // PF_INTRA
+ MODE_INTER, // PF_L0
+ MODE_INTER, // PF_L1
+ MODE_INTER, // PF_BI
+ 0, // invalid
+ MODE_IBC, // PF_IBC
+ 0, // invalid
+ 0, // invalid
+ MODE_PLT, // PF_PLT
+ };
+
+ return lut[pred];
}
static int check_available(Neighbour *n, const VVCLocalContext *lc, const int check_mer)
diff --git a/libavcodec/vvc/mvs.h b/libavcodec/vvc/mvs.h
index b2242b2a4d..7150c0b8cf 100644
--- a/libavcodec/vvc/mvs.h
+++ b/libavcodec/vvc/mvs.h
@@ -43,6 +43,6 @@ void ff_vvc_update_hmvp(VVCLocalContext *lc, const MotionInfo *mi);
int ff_vvc_no_backward_pred_flag(const VVCLocalContext *lc);
MvField* ff_vvc_get_mvf(const VVCFrameContext *fc, const int x0, const int y0);
void ff_vvc_set_mvf(const VVCLocalContext *lc, const int x0, const int y0, const int w, const int h, const MvField *mvf);
-void ff_vvc_set_intra_mvf(const VVCLocalContext *lc, int dmvr);
+void ff_vvc_set_intra_mvf(const VVCLocalContext *lc, bool dmvr, PredFlag pf, bool ciip_flag);
#endif //AVCODEC_VVC_MVS_H
--
2.44.0.windows.1
More information about the ffmpeg-devel
mailing list