diff --git a/src/inter.c b/src/inter.c index db27bc21..d275ec02 100644 --- a/src/inter.c +++ b/src/inter.c @@ -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; } diff --git a/src/search_inter.c b/src/search_inter.c index 9f6bc4b4..fad20a0d 100644 --- a/src/search_inter.c +++ b/src/search_inter.c @@ -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);