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