Implement TMVP duplicate checking as in VTM 2.1

This commit is contained in:
Marko Viitanen 2018-09-28 11:50:36 +03:00
parent 3f9d1d12df
commit 027359c3c3

View file

@ -1406,7 +1406,22 @@ uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state,
}
}
if (mv_cand[candidates].dir != 0) candidates++;
if (mv_cand[candidates].dir != 0) {
bool add_tmvp = true;
// Check for duplicate entries
for (int i = 0; i < candidates; i++) {
if (mv_cand[i].dir == mv_cand[candidates].dir &&
(!(mv_cand[i].dir & 1) || (mv_cand[i].mv[0][0] == mv_cand[candidates].mv[0][0] &&
mv_cand[i].mv[0][1] == mv_cand[candidates].mv[0][1])) &&
(!(mv_cand[i].dir & 2) || (mv_cand[i].mv[1][0] == mv_cand[candidates].mv[1][0] &&
mv_cand[i].mv[1][1] == mv_cand[candidates].mv[1][1]))) {
add_tmvp = false;
break;
}
}
if(add_tmvp) candidates++;
}
}
if (candidates < MRG_MAX_NUM_CANDS && state->frame->slicetype == KVZ_SLICE_B) {