History

avcodec/vvcdec: refact, rename !is_mvp to check_mer

For IBC, we'll utilize the check_available function. However, neither MVP nor merge mode need to check the motion estimation region. Let's rename it to avoid confusion.

Nuo Mi committed 2 years ago

Commit 422e8a81 parent 1ffeeb81 file · +7 −11Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/vvc/vvc_mvs.c+7−11
@@ -589,7 +589,7 @@ static void init_neighbour_context(NeighbourContext *ctx, const VVCLocalContext · 588 unmodified lines
589589 ctx->lc = lc;
590590 }
591591
592−static int check_available(Neighbour *n, const VVCLocalContext *lc, const int is_mvp)
592+static int check_available(Neighbour *n, const VVCLocalContext *lc, const int check_mer)
593593 {
594594 const VVCFrameContext *fc = lc->fc;
595595 const VVCSPS *sps = fc->ps.sps;
@@ -601,7 +601,7 @@ static int check_available(Neighbour *n, const VVCLocalContext *lc, const int is · 5 unmodified lines
601601 n->checked = 1;
602602 n->available = !sps->r->sps_entropy_coding_sync_enabled_flag || ((n->x >> sps->ctb_log2_size_y) <= (cu->x0 >> sps->ctb_log2_size_y));
603603 n->available &= TAB_MVF(n->x, n->y).pred_flag != PF_INTRA;
604− if (!is_mvp)
604+ if (check_mer)
605605 n->available &= !is_same_mer(fc, n->x, n->y, cu->x0, cu->y0);
606606 }
607607 return n->available;
@@ -620,10 +620,9 @@ static const MvField *mv_merge_candidate(const VVCLocalContext *lc, const int x_ · 12 unmodified lines
620620 static const MvField* mv_merge_from_nb(NeighbourContext *ctx, const NeighbourIdx nb)
621621 {
622622 const VVCLocalContext *lc = ctx->lc;
623− const int is_mvp = 0;
624623 Neighbour *n = &ctx->neighbours[nb];
625624
626− if (check_available(n, lc, is_mvp))
625+ if (check_available(n, lc, 1))
627626 return mv_merge_candidate(lc, n->x, n->y);
628627 return 0;
629628 }
@@ -943,10 +942,9 @@ static int affine_merge_candidate(const VVCLocalContext *lc, const int x_cand, c · 313 unmodified lines
943942 static int affine_merge_from_nbs(NeighbourContext *ctx, const NeighbourIdx *nbs, const int num_nbs, MotionInfo* cand)
944943 {
945944 const VVCLocalContext *lc = ctx->lc;
946− const int is_mvp = 0;
947945 for (int i = 0; i < num_nbs; i++) {
948946 Neighbour *n = &ctx->neighbours[nbs[i]];
949− if (check_available(n, lc, is_mvp) && affine_merge_candidate(lc, n->x, n->y, cand))
947+ if (check_available(n, lc, 1) && affine_merge_candidate(lc, n->x, n->y, cand))
950948 return 1;
951949 }
952950 return 0;
@@ -961,7 +959,7 @@ static const MvField* derive_corner_mvf(NeighbourContext *ctx, const NeighbourId · 8 unmodified lines
961959 const int min_pu_width = fc->ps.pps->min_pu_width;
962960 for (int i = 0; i < num_neighbour; i++) {
963961 Neighbour *n = &ctx->neighbours[neighbour[i]];
964− if (check_available(n, ctx->lc, 0)) {
962+ if (check_available(n, ctx->lc, 1)) {
965963 return &TAB_MVF(n->x, n->y);
966964 }
967965 }
@@ -1461,12 +1459,11 @@ static int mvp_from_nbs(NeighbourContext *ctx, · 493 unmodified lines
14611459 Mv *cps, const int num_cps)
14621460 {
14631461 const VVCLocalContext *lc = ctx->lc;
1464− const int is_mvp = 1;
14651462 int available = 0;
14661463
14671464 for (int i = 0; i < num_nbs; i++) {
14681465 Neighbour *n = &ctx->neighbours[nbs[i]];
1469− if (check_available(n, lc, is_mvp)) {
1466+ if (check_available(n, lc, 0)) {
14701467 if (num_cps > 1)
14711468 available = affine_mvp_candidate(lc, n->x, n->y, lx, ref_idx, cps, num_cps);
14721469 else
@@ -1601,12 +1598,11 @@ static int affine_mvp_constructed_cp(NeighbourContext *ctx, · 128 unmodified lines
16011598 const MvField *tab_mvf = fc->tab.mvf;
16021599 const int min_pu_width = fc->ps.pps->min_pu_width;
16031600 const RefPicList* rpl = lc->sc->rpl;
1604− const int is_mvp = 1;
16051601 int available = 0;
16061602
16071603 for (int i = 0; i < num_neighbour; i++) {
16081604 Neighbour *n = &ctx->neighbours[neighbour[i]];
1609− if (check_available(n, ctx->lc, is_mvp)) {
1605+ if (check_available(n, ctx->lc, 0)) {
16101606 const PredFlag maskx = lx + 1;
16111607 const MvField* mvf = &TAB_MVF(n->x, n->y);
16121608 const int poc = rpl[lx].list[ref_idx];

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