diff --git a/src/cu.h b/src/cu.h index a5e71dd9..089aefcf 100644 --- a/src/cu.h +++ b/src/cu.h @@ -138,7 +138,6 @@ typedef struct int16_t mvd[2][2]; // \brief Motion vector differences for L0 and L1 uint8_t mv_cand[2]; // \brief selected MV candidate uint8_t mv_ref[2]; // \brief Index of the encoder_control.ref array. - uint8_t mv_ref_coded[2]; // \brief Coded and corrected index of ref picture uint8_t mv_dir; // \brief Probably describes if mv_ref is L0, L1 or both (bi-pred) } inter; } cu_info_t; diff --git a/src/encoderstate.c b/src/encoderstate.c index 9a216bc8..d3a9b108 100644 --- a/src/encoderstate.c +++ b/src/encoderstate.c @@ -1153,7 +1153,7 @@ static void encode_inter_prediction_unit(encoder_state_t * const state, if (cur_cu->inter.mv_dir & (1 << ref_list_idx)) { if (ref_list[ref_list_idx] > 1) { // parseRefFrmIdx - int32_t ref_frame = cur_cu->inter.mv_ref_coded[ref_list_idx]; + int32_t ref_frame = state->global->refmap[cur_cu->inter.mv_ref[ref_list_idx]].idx; cabac->cur_ctx = &(cabac->ctx.cu_ref_pic_model[0]); CABAC_BIN(cabac, (ref_frame != 0), "ref_idx_lX"); diff --git a/src/search_inter.c b/src/search_inter.c index 1de883a1..1f776a14 100644 --- a/src/search_inter.c +++ b/src/search_inter.c @@ -1253,7 +1253,7 @@ static void search_pu_inter_ref(encoder_state_t * const state, if (temp_cost < *inter_cost) { // Map reference index to L0/L1 pictures cur_cu->inter.mv_dir = ref_list+1; - cur_cu->inter.mv_ref_coded[ref_list] = state->global->refmap[ref_idx].idx; + uint8_t mv_ref_coded = state->global->refmap[ref_idx].idx; cur_cu->merged = merged; cur_cu->merge_idx = merge_idx; @@ -1265,7 +1265,7 @@ static void search_pu_inter_ref(encoder_state_t * const state, cur_cu->inter.mv_cand[ref_list] = cu_mv_cand; *inter_cost = temp_cost; - *inter_bitcost = temp_bitcost + cur_cu->inter.mv_dir - 1 + cur_cu->inter.mv_ref_coded[ref_list]; + *inter_bitcost = temp_bitcost + cur_cu->inter.mv_dir - 1 + mv_ref_coded; } } @@ -1438,10 +1438,10 @@ static void search_pu_inter(encoder_state_t * const state, if (cost < *inter_cost) { cur_cu->inter.mv_dir = 3; - cur_cu->inter.mv_ref_coded[0] = state->global->refmap[merge_cand[i].ref[0]].idx; - cur_cu->inter.mv_ref_coded[1] = state->global->refmap[merge_cand[j].ref[1]].idx; - - + uint8_t mv_ref_coded[2] = { + state->global->refmap[merge_cand[i].ref[0]].idx, + state->global->refmap[merge_cand[j].ref[1]].idx + }; cur_cu->inter.mv_ref[0] = merge_cand[i].ref[0]; cur_cu->inter.mv_ref[1] = merge_cand[j].ref[1]; @@ -1493,7 +1493,7 @@ static void search_pu_inter(encoder_state_t * const state, cur_cu->inter.mv_cand[reflist] = cu_mv_cand; } *inter_cost = cost; - *inter_bitcost = bitcost[0] + bitcost[1] + cur_cu->inter.mv_dir - 1 + cur_cu->inter.mv_ref_coded[0] + cur_cu->inter.mv_ref_coded[1]; + *inter_bitcost = bitcost[0] + bitcost[1] + cur_cu->inter.mv_dir - 1 + mv_ref_coded[0] + mv_ref_coded[1]; } } }