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
200static int temporal_luma_motion_vector(const VVCLocalContext *lc,200static int temporal_luma_motion_vector(const VVCLocalContext *lc,
201 const int refIdxLx, Mv *mvLXCol, const int X, int check_center, int sb_flag)201 const int refIdxLx, Mv *mvLXCol, const int X, int check_center, int sb_flag)
202{202{
203 const VVCFrameContext *fc = lc->fc;203 const VVCFrameContext *fc = lc->fc;
204 const VVCSPS *sps = fc->ps.sps;204 const VVCSPS *sps = fc->ps.sps;
205 const CodingUnit *cu = lc->cu;205 const VVCPPS *pps = fc->ps.pps;
206 int x, y, colPic, availableFlagLXCol = 0;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;
207 int min_pu_width = fc->ps.pps->min_pu_width;209 int min_pu_width = fc->ps.pps->min_pu_width;
208 VVCFrame *ref = fc->ref->collocated_ref;210 VVCFrame *ref = fc->ref->collocated_ref;
209 MvField *tab_mvf;211 MvField *tab_mvf;
@@ -224,10 +226,12 @@ static int temporal_luma_motion_vector(const VVCLocalContext *lc, · 14 unmodified lines
224 x = cu->x0 + cu->cb_width;226 x = cu->x0 + cu->cb_width;
225 y = cu->y0 + cu->cb_height;227 y = cu->y0 + cu->cb_height;
226 228
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
227 if (tab_mvf &&232 if (tab_mvf &&
228 (cu->y0 >> sps->ctb_log2_size_y) == (y >> sps->ctb_log2_size_y) &&233 (cu->y0 >> sps->ctb_log2_size_y) == (y >> sps->ctb_log2_size_y) &&
229 y < fc->ps.pps->height &&234 x < x_end && y < y_end) {
230 x < fc->ps.pps->width) {
231 x &= ~7;235 x &= ~7;
232 y &= ~7;236 y &= ~7;
233 temp_col = TAB_MVF(x, y);237 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
991 return 1;995 return 1;
992}996}
993 997
994static av_always_inline void sb_clip_location(const VVCFrameContext *fc,998static av_always_inline void sb_clip_location(const VVCLocalContext *lc,
995 const int x_ctb, const int y_ctb, const Mv* temp_mv, int *x, int *y)999 const int x_ctb, const int y_ctb, const Mv* temp_mv, int *x, int *y)
996{1000{
997 const VVCPPS *pps = fc->ps.pps;1001 const VVCFrameContext *fc = lc->fc;
998 const int ctb_log2_size = fc->ps.sps->ctb_log2_size_y;1002 const VVCPPS *pps = fc->ps.pps;
999 *y = av_clip(*y + temp_mv->y, y_ctb, FFMIN(pps->height - 1, y_ctb + (1 << ctb_log2_size) - 1)) & ~7;1003 const int ctb_log2_size = fc->ps.sps->ctb_log2_size_y;
1000 *x = av_clip(*x + temp_mv->x, x_ctb, FFMIN(pps->width - 1, x_ctb + (1 << ctb_log2_size) + 3)) & ~7;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;
1001}1010}
1002 1011
1003static void sb_temproal_luma_motion(const VVCLocalContext *lc,1012static void sb_temproal_luma_motion(const VVCLocalContext *lc,
@@ -1015,7 +1024,7 @@ static void sb_temproal_luma_motion(const VVCLocalContext *lc, · 11 unmodified lines
1015 int colPic = ref->poc;1024 int colPic = ref->poc;
1016 int X = 0;1025 int X = 0;
1017 1026
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);
1019 1028
1020 temp_col = TAB_MVF(x, y);1029 temp_col = TAB_MVF(x, y);
1021 mvLXCol = mv + 0;1030 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