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
589 ctx->lc = lc;589 ctx->lc = lc;
590}590}
591 591
592static int check_available(Neighbour *n, const VVCLocalContext *lc, const int is_mvp)592static int check_available(Neighbour *n, const VVCLocalContext *lc, const int check_mer)
593{593{
594 const VVCFrameContext *fc = lc->fc;594 const VVCFrameContext *fc = lc->fc;
595 const VVCSPS *sps = fc->ps.sps;595 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
601 n->checked = 1;601 n->checked = 1;
602 n->available = !sps->r->sps_entropy_coding_sync_enabled_flag || ((n->x >> sps->ctb_log2_size_y) <= (cu->x0 >> sps->ctb_log2_size_y));602 n->available = !sps->r->sps_entropy_coding_sync_enabled_flag || ((n->x >> sps->ctb_log2_size_y) <= (cu->x0 >> sps->ctb_log2_size_y));
603 n->available &= TAB_MVF(n->x, n->y).pred_flag != PF_INTRA;603 n->available &= TAB_MVF(n->x, n->y).pred_flag != PF_INTRA;
604 if (!is_mvp)604 if (check_mer)
605 n->available &= !is_same_mer(fc, n->x, n->y, cu->x0, cu->y0);605 n->available &= !is_same_mer(fc, n->x, n->y, cu->x0, cu->y0);
606 }606 }
607 return n->available;607 return n->available;
@@ -620,10 +620,9 @@ static const MvField *mv_merge_candidate(const VVCLocalContext *lc, const int x_ · 12 unmodified lines
620static const MvField* mv_merge_from_nb(NeighbourContext *ctx, const NeighbourIdx nb)620static const MvField* mv_merge_from_nb(NeighbourContext *ctx, const NeighbourIdx nb)
621{621{
622 const VVCLocalContext *lc = ctx->lc;622 const VVCLocalContext *lc = ctx->lc;
623 const int is_mvp = 0;
624 Neighbour *n = &ctx->neighbours[nb];623 Neighbour *n = &ctx->neighbours[nb];
625 624
626 if (check_available(n, lc, is_mvp))625 if (check_available(n, lc, 1))
627 return mv_merge_candidate(lc, n->x, n->y);626 return mv_merge_candidate(lc, n->x, n->y);
628 return 0;627 return 0;
629}628}
@@ -943,10 +942,9 @@ static int affine_merge_candidate(const VVCLocalContext *lc, const int x_cand, c · 313 unmodified lines
943static int affine_merge_from_nbs(NeighbourContext *ctx, const NeighbourIdx *nbs, const int num_nbs, MotionInfo* cand)942static int affine_merge_from_nbs(NeighbourContext *ctx, const NeighbourIdx *nbs, const int num_nbs, MotionInfo* cand)
944{943{
945 const VVCLocalContext *lc = ctx->lc;944 const VVCLocalContext *lc = ctx->lc;
946 const int is_mvp = 0;
947 for (int i = 0; i < num_nbs; i++) {945 for (int i = 0; i < num_nbs; i++) {
948 Neighbour *n = &ctx->neighbours[nbs[i]];946 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))
950 return 1;948 return 1;
951 }949 }
952 return 0;950 return 0;
@@ -961,7 +959,7 @@ static const MvField* derive_corner_mvf(NeighbourContext *ctx, const NeighbourId · 8 unmodified lines
961 const int min_pu_width = fc->ps.pps->min_pu_width;959 const int min_pu_width = fc->ps.pps->min_pu_width;
962 for (int i = 0; i < num_neighbour; i++) {960 for (int i = 0; i < num_neighbour; i++) {
963 Neighbour *n = &ctx->neighbours[neighbour[i]];961 Neighbour *n = &ctx->neighbours[neighbour[i]];
964 if (check_available(n, ctx->lc, 0)) {962 if (check_available(n, ctx->lc, 1)) {
965 return &TAB_MVF(n->x, n->y);963 return &TAB_MVF(n->x, n->y);
966 }964 }
967 }965 }
@@ -1461,12 +1459,11 @@ static int mvp_from_nbs(NeighbourContext *ctx, · 493 unmodified lines
1461 Mv *cps, const int num_cps)1459 Mv *cps, const int num_cps)
1462{1460{
1463 const VVCLocalContext *lc = ctx->lc;1461 const VVCLocalContext *lc = ctx->lc;
1464 const int is_mvp = 1;
1465 int available = 0;1462 int available = 0;
1466 1463
1467 for (int i = 0; i < num_nbs; i++) {1464 for (int i = 0; i < num_nbs; i++) {
1468 Neighbour *n = &ctx->neighbours[nbs[i]];1465 Neighbour *n = &ctx->neighbours[nbs[i]];
1469 if (check_available(n, lc, is_mvp)) {1466 if (check_available(n, lc, 0)) {
1470 if (num_cps > 1)1467 if (num_cps > 1)
1471 available = affine_mvp_candidate(lc, n->x, n->y, lx, ref_idx, cps, num_cps);1468 available = affine_mvp_candidate(lc, n->x, n->y, lx, ref_idx, cps, num_cps);
1472 else1469 else
@@ -1601,12 +1598,11 @@ static int affine_mvp_constructed_cp(NeighbourContext *ctx, · 128 unmodified lines
1601 const MvField *tab_mvf = fc->tab.mvf;1598 const MvField *tab_mvf = fc->tab.mvf;
1602 const int min_pu_width = fc->ps.pps->min_pu_width;1599 const int min_pu_width = fc->ps.pps->min_pu_width;
1603 const RefPicList* rpl = lc->sc->rpl;1600 const RefPicList* rpl = lc->sc->rpl;
1604 const int is_mvp = 1;
1605 int available = 0;1601 int available = 0;
1606 1602
1607 for (int i = 0; i < num_neighbour; i++) {1603 for (int i = 0; i < num_neighbour; i++) {
1608 Neighbour *n = &ctx->neighbours[neighbour[i]];1604 Neighbour *n = &ctx->neighbours[neighbour[i]];
1609 if (check_available(n, ctx->lc, is_mvp)) {1605 if (check_available(n, ctx->lc, 0)) {
1610 const PredFlag maskx = lx + 1;1606 const PredFlag maskx = lx + 1;
1611 const MvField* mvf = &TAB_MVF(n->x, n->y);1607 const MvField* mvf = &TAB_MVF(n->x, n->y);
1612 const int poc = rpl[lx].list[ref_idx];1608 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