From eba298e63553c099cad73ff0c4c3d95e419aefcf Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Tue, 10 Mar 2015 09:17:25 +0200 Subject: [PATCH] Added cu->inter.mv_ref_coded variable --- src/cu.h | 1 + src/encoderstate.c | 2 +- src/inter.c | 1 + src/search.c | 12 ++++++------ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/cu.h b/src/cu.h index 5cacbf91..82b638fa 100644 --- a/src/cu.h +++ b/src/cu.h @@ -63,6 +63,7 @@ typedef struct int16_t mvd[2]; uint8_t mv_cand; // \brief selected MV candidate uint8_t mv_ref; // \brief Index of the encoder_control.ref array. + uint8_t mv_ref_coded; // \brief Coded and corrected index of ref picture uint8_t mv_dir; // \brief Probably describes if mv_ref is forward, backward or both. Might not be needed? int8_t mode; } cu_info_inter; diff --git a/src/encoderstate.c b/src/encoderstate.c index 154dfbb5..4a445583 100644 --- a/src/encoderstate.c +++ b/src/encoderstate.c @@ -1198,7 +1198,7 @@ void encode_coding_tree(encoder_state * const encoder_state, if (cur_cu->inter.mv_dir & (1 << ref_list_idx)) { if (ref_list[ref_list_idx] != 1) { //encoder_state->ref_idx_num[uiRefListIdx] != 1)//NumRefIdx != 1) // parseRefFrmIdx - int32_t ref_frame = cur_cu->inter.mv_ref; + int32_t ref_frame = cur_cu->inter.mv_ref_coded; cabac->cur_ctx = &(cabac->ctx.cu_ref_pic_model[0]); CABAC_BIN(cabac, (ref_frame != 0), "ref_frame_flag"); diff --git a/src/inter.c b/src/inter.c index 2642374a..c5c5813e 100644 --- a/src/inter.c +++ b/src/inter.c @@ -60,6 +60,7 @@ void inter_set_block(videoframe* frame, uint32_t x_cu, uint32_t y_cu, uint8_t de cu->inter.mv[1] = cur_cu->inter.mv[1]; cu->inter.mv_dir = cur_cu->inter.mv_dir; cu->inter.mv_ref = cur_cu->inter.mv_ref; + cu->inter.mv_ref_coded = cur_cu->inter.mv_ref_coded; cu->tr_depth = tr_depth; } } diff --git a/src/search.c b/src/search.c index 9be39d19..6469f286 100644 --- a/src/search.c +++ b/src/search.c @@ -702,17 +702,17 @@ static int search_cu_inter(const encoder_state * const encoder_state, int x, int int j, ref_list[2] = { 0, 0 }; for (j = 0; j < encoder_state->global->ref->used_size; j++) { if (encoder_state->global->ref->images[j]->poc < encoder_state->global->poc) { - ref_list[0]++; if (ref_idx == j) { - cur_cu->inter.mv_dir = 1; - cur_cu->inter.mv_ref = ref_list[0]; + cur_cu->inter.mv_dir = 1; + cur_cu->inter.mv_ref_coded = ref_list[0]; } - } else { - ref_list[1]++; + ref_list[0]++; + } else { if (ref_idx == j) { cur_cu->inter.mv_dir = 2; - cur_cu->inter.mv_ref = ref_list[1]; + cur_cu->inter.mv_ref_coded = ref_list[1]; } + ref_list[1]++; } } cur_cu->merged = merged;