Drop field inter.mv_ref_coded from cu_info_t.

Storing inter.mv_ref_coded in cu_info_t is unnecessary since it can be
computed from refmap and inter.mv_ref.
This commit is contained in:
Arttu Ylä-Outinen 2016-05-02 12:29:51 +09:00
parent 4be5c8f349
commit ebb10763f1
3 changed files with 8 additions and 9 deletions

View file

@ -138,7 +138,6 @@ typedef struct
int16_t mvd[2][2]; // \brief Motion vector differences for L0 and L1 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_cand[2]; // \brief selected MV candidate
uint8_t mv_ref[2]; // \brief Index of the encoder_control.ref array. 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) uint8_t mv_dir; // \brief Probably describes if mv_ref is L0, L1 or both (bi-pred)
} inter; } inter;
} cu_info_t; } cu_info_t;

View file

@ -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 (cur_cu->inter.mv_dir & (1 << ref_list_idx)) {
if (ref_list[ref_list_idx] > 1) { if (ref_list[ref_list_idx] > 1) {
// parseRefFrmIdx // 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->cur_ctx = &(cabac->ctx.cu_ref_pic_model[0]);
CABAC_BIN(cabac, (ref_frame != 0), "ref_idx_lX"); CABAC_BIN(cabac, (ref_frame != 0), "ref_idx_lX");

View file

@ -1253,7 +1253,7 @@ static void search_pu_inter_ref(encoder_state_t * const state,
if (temp_cost < *inter_cost) { if (temp_cost < *inter_cost) {
// Map reference index to L0/L1 pictures // Map reference index to L0/L1 pictures
cur_cu->inter.mv_dir = ref_list+1; 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->merged = merged;
cur_cu->merge_idx = merge_idx; 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; cur_cu->inter.mv_cand[ref_list] = cu_mv_cand;
*inter_cost = temp_cost; *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) { if (cost < *inter_cost) {
cur_cu->inter.mv_dir = 3; cur_cu->inter.mv_dir = 3;
cur_cu->inter.mv_ref_coded[0] = state->global->refmap[merge_cand[i].ref[0]].idx; uint8_t mv_ref_coded[2] = {
cur_cu->inter.mv_ref_coded[1] = state->global->refmap[merge_cand[j].ref[1]].idx; 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[0] = merge_cand[i].ref[0];
cur_cu->inter.mv_ref[1] = merge_cand[j].ref[1]; 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; cur_cu->inter.mv_cand[reflist] = cu_mv_cand;
} }
*inter_cost = cost; *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];
} }
} }
} }