[inter] Fix incorrect mv scaling in unipred and change more mv types to mv_t

This commit is contained in:
Marko Viitanen 2021-11-18 11:49:08 +02:00
parent 21d7d2e4ed
commit 5020f5f742
2 changed files with 10 additions and 15 deletions

View file

@ -366,7 +366,7 @@ static void inter_recon_unipred(const encoder_state_t * const state,
int32_t ypos, int32_t ypos,
int32_t width, int32_t width,
int32_t height, int32_t height,
const int16_t mv_param[2], const mv_t mv_param[2],
lcu_t *lcu, lcu_t *lcu,
hi_prec_buf_t *hi_prec_out, hi_prec_buf_t *hi_prec_out,
bool predict_luma, bool predict_luma,
@ -376,7 +376,7 @@ static void inter_recon_unipred(const encoder_state_t * const state,
const vector2d_t pu_in_tile = { xpos, ypos }; const vector2d_t pu_in_tile = { xpos, ypos };
const vector2d_t pu_in_lcu = { xpos % LCU_WIDTH, ypos % LCU_WIDTH }; const vector2d_t pu_in_lcu = { xpos % LCU_WIDTH, ypos % LCU_WIDTH };
const vector2d_t mv_in_pu = { mv_param_qpel[0] >> INTERNAL_MV_PREC, mv_param_qpel[1] >> INTERNAL_MV_PREC }; const vector2d_t mv_in_pu = { mv_param[0] >> INTERNAL_MV_PREC, mv_param[1] >> INTERNAL_MV_PREC };
const vector2d_t mv_in_frame = { const vector2d_t mv_in_frame = {
mv_in_pu.x + pu_in_tile.x + state->tile->offset_x, mv_in_pu.x + pu_in_tile.x + state->tile->offset_x,
mv_in_pu.y + pu_in_tile.y + state->tile->offset_y mv_in_pu.y + pu_in_tile.y + state->tile->offset_y
@ -497,7 +497,7 @@ void kvz_inter_recon_bipred(const encoder_state_t * const state,
int32_t ypos, int32_t ypos,
int32_t width, int32_t width,
int32_t height, int32_t height,
int16_t mv_param[2][2], mv_t mv_param[2][2],
lcu_t* lcu, lcu_t* lcu,
bool predict_luma, bool predict_luma,
bool predict_chroma) bool predict_chroma)
@ -506,11 +506,11 @@ void kvz_inter_recon_bipred(const encoder_state_t * const state,
kvz_pixel temp_lcu_u[LCU_WIDTH_C*LCU_WIDTH_C]; kvz_pixel temp_lcu_u[LCU_WIDTH_C*LCU_WIDTH_C];
kvz_pixel temp_lcu_v[LCU_WIDTH_C*LCU_WIDTH_C]; kvz_pixel temp_lcu_v[LCU_WIDTH_C*LCU_WIDTH_C];
const int hi_prec_luma_rec0 = mv_param[0][0] & 3 || mv_param[0][1] & 3; const int hi_prec_luma_rec0 = (mv_param[0][0]>>2) & 3 || (mv_param[0][1]>>2) & 3;
const int hi_prec_luma_rec1 = mv_param[1][0] & 3 || mv_param[1][1] & 3; const int hi_prec_luma_rec1 = (mv_param[1][0]>>2) & 3 || (mv_param[1][1]>>2) & 3;
const int hi_prec_chroma_rec0 = mv_param[0][0] & 7 || mv_param[0][1] & 7; const int hi_prec_chroma_rec0 = (mv_param[0][0]>>2) & 7 || (mv_param[0][1]>>2) & 7;
const int hi_prec_chroma_rec1 = mv_param[1][0] & 7 || mv_param[1][1] & 7; const int hi_prec_chroma_rec1 = (mv_param[1][0]>>2) & 7 || (mv_param[1][1]>>2) & 7;
hi_prec_buf_t* high_precision_rec0 = 0; hi_prec_buf_t* high_precision_rec0 = 0;
hi_prec_buf_t* high_precision_rec1 = 0; hi_prec_buf_t* high_precision_rec1 = 0;

View file

@ -60,7 +60,7 @@ typedef struct {
int32_t width; int32_t width;
int32_t height; int32_t height;
int16_t mv_cand[2][2]; mv_t mv_cand[2][2];
inter_merge_cand_t merge_cand[MRG_MAX_NUM_CANDS]; inter_merge_cand_t merge_cand[MRG_MAX_NUM_CANDS];
int32_t num_merge_cand; int32_t num_merge_cand;
@ -1660,12 +1660,6 @@ static void search_pu_inter(encoder_state_t * const state,
lcu 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 // Default to candidate 0
CU_SET_MV_CAND(cur_cu, 0, 0); CU_SET_MV_CAND(cur_cu, 0, 0);
CU_SET_MV_CAND(cur_cu, 1, 0); CU_SET_MV_CAND(cur_cu, 1, 0);
@ -1708,7 +1702,8 @@ static void search_pu_inter(encoder_state_t * const state,
{ {
continue; continue;
} }
if (cur_cu->inter.mv_dir & 1) kvz_change_precision(4, 2, &cur_cu->inter.mv[0][0], &cur_cu->inter.mv[0][1]);
if (cur_cu->inter.mv_dir & 2) kvz_change_precision(4, 2, &cur_cu->inter.mv[1][0], &cur_cu->inter.mv[1][1]);
kvz_inter_pred_pu(state, lcu, x_cu, y_cu, width_cu, true, false, i_pu); kvz_inter_pred_pu(state, lcu, x_cu, y_cu, width_cu, true, false, i_pu);
mrg_costs[num_rdo_cands] = kvz_satd_any_size(width, height, mrg_costs[num_rdo_cands] = kvz_satd_any_size(width, height,
lcu->rec.y + y_local * LCU_WIDTH + x_local, LCU_WIDTH, lcu->rec.y + y_local * LCU_WIDTH + x_local, LCU_WIDTH,