[inter] Remove MV rounding from kvz_inter_get_merge_cand() and add it to where merge cand are used

* Should be adapted to AMVR later
 * merge candidates match VTM at full precision
This commit is contained in:
Marko Viitanen 2021-11-18 10:05:45 +02:00
parent bf06538f33
commit 21d7d2e4ed
2 changed files with 8 additions and 8 deletions

View file

@ -1603,7 +1603,7 @@ uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state,
}
}
if (candidates == max_num_cands) goto return_with_precision_clamp;
if (candidates == max_num_cands) return candidates;
if (candidates != max_num_cands - 1) {
const uint32_t ctu_row = (y >> LOG2_LCU_WIDTH);
@ -1689,7 +1689,7 @@ uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state,
}
}
if (candidates == max_num_cands) goto return_with_precision_clamp;
if (candidates == max_num_cands) return candidates;
int num_ref = state->frame->ref->used_size;
@ -1724,11 +1724,5 @@ uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state,
candidates++;
}
return_with_precision_clamp:
for (int i = 0; i < candidates; i++) {
if(mv_cand[i].dir & 1) kvz_round_precision(INTERNAL_MV_PREC, 2, &mv_cand[i].mv[0][0], &mv_cand[i].mv[0][1]);
if (mv_cand[i].dir & 2) kvz_round_precision(INTERNAL_MV_PREC, 2, &mv_cand[i].mv[1][0], &mv_cand[i].mv[1][1]);
}
return candidates;
}

View file

@ -1660,6 +1660,12 @@ static void search_pu_inter(encoder_state_t * const state,
lcu
);
for (int i = 0; i < info.num_merge_cand; i++) {
// ToDo: Adapt to AMVR
if (info.merge_cand->dir & 1) kvz_round_precision(INTERNAL_MV_PREC, 2, &info.merge_cand[i].mv[0][0], &info.merge_cand[i].mv[0][1]);
if (info.merge_cand->dir & 2) kvz_round_precision(INTERNAL_MV_PREC, 2, &info.merge_cand[i].mv[1][0], &info.merge_cand[i].mv[1][1]);
}
// Default to candidate 0
CU_SET_MV_CAND(cur_cu, 0, 0);
CU_SET_MV_CAND(cur_cu, 1, 0);