History

avcodec/vvcdec: mvs, support subpicture

Nuo Mi committed 2 years ago

Commit 9bc3f3e1 parent adeb51c1 file · +21 −12Browse files

Unified · Split

libavcodec/vvc/vvc_mvs.c+21−12
@@ -200,10 +200,12 @@ static int derive_temporal_colocated_mvs(const VVCLocalContext *lc, MvField temp · 199 unmodified lines
200200 static int temporal_luma_motion_vector(const VVCLocalContext *lc,
201201 const int refIdxLx, Mv *mvLXCol, const int X, int check_center, int sb_flag)
202202 {
203− const VVCFrameContext *fc = lc->fc;
204− const VVCSPS *sps = fc->ps.sps;
205− const CodingUnit *cu = lc->cu;
206− int x, y, colPic, availableFlagLXCol = 0;
203+ const VVCFrameContext *fc = lc->fc;
204+ const VVCSPS *sps = fc->ps.sps;
205+ const VVCPPS *pps = fc->ps.pps;
206+ const CodingUnit *cu = lc->cu;
207+ const int subpic_idx = lc->sc->sh.r->curr_subpic_idx;
208+ int x, y, x_end, y_end, colPic, availableFlagLXCol = 0;
207209 int min_pu_width = fc->ps.pps->min_pu_width;
208210 VVCFrame *ref = fc->ref->collocated_ref;
209211 MvField *tab_mvf;
@@ -224,10 +226,12 @@ static int temporal_luma_motion_vector(const VVCLocalContext *lc, · 14 unmodified lines
224226 x = cu->x0 + cu->cb_width;
225227 y = cu->y0 + cu->cb_height;
226228
229+ x_end = pps->subpic_x[subpic_idx] + pps->subpic_width[subpic_idx];
230+ y_end = pps->subpic_y[subpic_idx] + pps->subpic_height[subpic_idx];
231+
227232 if (tab_mvf &&
228233 (cu->y0 >> sps->ctb_log2_size_y) == (y >> sps->ctb_log2_size_y) &&
229− y < fc->ps.pps->height &&
230− x < fc->ps.pps->width) {
234+ x < x_end && y < y_end) {
231235 x &= ~7;
232236 y &= ~7;
233237 temp_col = TAB_MVF(x, y);
@@ -991,13 +995,18 @@ static av_always_inline int compare_pf_ref_idx(const MvField *A, const struct Mv · 757 unmodified lines
991995 return 1;
992996 }
993997
994−static av_always_inline void sb_clip_location(const VVCFrameContext *fc,
998+static av_always_inline void sb_clip_location(const VVCLocalContext *lc,
995999 const int x_ctb, const int y_ctb, const Mv* temp_mv, int *x, int *y)
9961000 {
997− const VVCPPS *pps = fc->ps.pps;
998− const int ctb_log2_size = fc->ps.sps->ctb_log2_size_y;
999− *y = av_clip(*y + temp_mv->y, y_ctb, FFMIN(pps->height - 1, y_ctb + (1 << ctb_log2_size) - 1)) & ~7;
1000− *x = av_clip(*x + temp_mv->x, x_ctb, FFMIN(pps->width - 1, x_ctb + (1 << ctb_log2_size) + 3)) & ~7;
1001+ const VVCFrameContext *fc = lc->fc;
1002+ const VVCPPS *pps = fc->ps.pps;
1003+ const int ctb_log2_size = fc->ps.sps->ctb_log2_size_y;
1004+ const int subpic_idx = lc->sc->sh.r->curr_subpic_idx;
1005+ const int x_end = pps->subpic_x[subpic_idx] + pps->subpic_width[subpic_idx];
1006+ const int y_end = pps->subpic_y[subpic_idx] + pps->subpic_height[subpic_idx];
1007+
1008+ *x = av_clip(*x + temp_mv->x, x_ctb, FFMIN(x_end - 1, x_ctb + (1 << ctb_log2_size) + 3)) & ~7;
1009+ *y = av_clip(*y + temp_mv->y, y_ctb, FFMIN(y_end - 1, y_ctb + (1 << ctb_log2_size) - 1)) & ~7;
10011010 }
10021011
10031012 static void sb_temproal_luma_motion(const VVCLocalContext *lc,
@@ -1015,7 +1024,7 @@ static void sb_temproal_luma_motion(const VVCLocalContext *lc, · 11 unmodified lines
10151024 int colPic = ref->poc;
10161025 int X = 0;
10171026
1018− sb_clip_location(fc, x_ctb, y_ctb, temp_mv, &x, &y);
1027+ sb_clip_location(lc, x_ctb, y_ctb, temp_mv, &x, &y);
10191028
10201029 temp_col = TAB_MVF(x, y);
10211030 mvLXCol = mv + 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t