diff --git a/src/encoder.c b/src/encoder.c index 50aeb932..b2055dce 100644 --- a/src/encoder.c +++ b/src/encoder.c @@ -2702,7 +2702,7 @@ void encode_block_residual(encoder_control *encoder, } else { int16_t mv_cand[2][2]; - + // Search for merge mode candidate int16_t merge_cand[MRG_MAX_NUM_CANDS][3]; // Get list of candidates @@ -2711,13 +2711,12 @@ void encode_block_residual(encoder_control *encoder, for(cur_cu->merge_idx = 0; cur_cu->merge_idx < num_cand; cur_cu->merge_idx++) { if(merge_cand[cur_cu->merge_idx][0] == cur_cu->inter.mv[0] && merge_cand[cur_cu->merge_idx][1] == cur_cu->inter.mv[1] && - merge_cand[cur_cu->merge_idx][3] == cur_cu->inter.mv[3]) { + merge_cand[cur_cu->merge_idx][3] == cur_cu->inter.mv_ref) { cur_cu->merged = 1; break; } } - - + // Get MV candidates inter_get_mv_cand(encoder, x_ctb, y_ctb, depth, mv_cand, cur_cu); diff --git a/src/inter.c b/src/inter.c index 4cc14c4d..2db47ab2 100644 --- a/src/inter.c +++ b/src/inter.c @@ -58,6 +58,7 @@ void inter_set_block(picture* pic, uint32_t x_cu, uint32_t y_cu, uint8_t depth, pic->cu_array[MAX_DEPTH][cu_pos + x].inter.mv[0] = cur_cu->inter.mv[0]; pic->cu_array[MAX_DEPTH][cu_pos + x].inter.mv[1] = cur_cu->inter.mv[1]; pic->cu_array[MAX_DEPTH][cu_pos + x].inter.mv_dir = cur_cu->inter.mv_dir; + pic->cu_array[MAX_DEPTH][cu_pos + x].inter.mv_ref = cur_cu->inter.mv_ref; pic->cu_array[MAX_DEPTH][cu_pos + x].tr_depth = tr_depth; } } @@ -358,7 +359,7 @@ void inter_get_mv_cand(encoder_control *encoder, int32_t x_cu, int32_t y_cu, int } else if(b2 && b2->type == CU_INTER && b2->inter.mv_ref == cur_cu->inter.mv_ref) { mv_cand[candidates][0] = b2->inter.mv[0]; mv_cand[candidates][1] = b2->inter.mv[1]; - b_candidates++; + b_candidates++; } candidates += b_candidates; @@ -372,14 +373,13 @@ void inter_get_mv_cand(encoder_control *encoder, int32_t x_cu, int32_t y_cu, int } else if (b1 && b1->type == CU_INTER) { mv_cand[candidates][0] = b1->inter.mv[0]; mv_cand[candidates][1] = b1->inter.mv[1]; - APPLY_MV_SCALING(b1, candidates); + APPLY_MV_SCALING(b1, candidates); candidates++; - } else if(b2 && b2->type == CU_INTER) { mv_cand[candidates][0] = b2->inter.mv[0]; mv_cand[candidates][1] = b2->inter.mv[1]; - APPLY_MV_SCALING(b2, candidates); - candidates++; + APPLY_MV_SCALING(b2, candidates); + candidates++; } }