Fixed inter mv_ref propagation and merge candidate mv_ref matching

This commit is contained in:
Marko Viitanen 2014-02-17 11:13:12 +02:00
parent e6212110a1
commit cda60897e1
2 changed files with 8 additions and 9 deletions

View file

@ -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++) { 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] && 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][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; cur_cu->merged = 1;
break; break;
} }
} }
// Get MV candidates // Get MV candidates
inter_get_mv_cand(encoder, x_ctb, y_ctb, depth, mv_cand, cur_cu); inter_get_mv_cand(encoder, x_ctb, y_ctb, depth, mv_cand, cur_cu);

View file

@ -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[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[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_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; 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) { } 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][0] = b2->inter.mv[0];
mv_cand[candidates][1] = b2->inter.mv[1]; mv_cand[candidates][1] = b2->inter.mv[1];
b_candidates++; b_candidates++;
} }
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) { } else if (b1 && b1->type == CU_INTER) {
mv_cand[candidates][0] = b1->inter.mv[0]; mv_cand[candidates][0] = b1->inter.mv[0];
mv_cand[candidates][1] = b1->inter.mv[1]; mv_cand[candidates][1] = b1->inter.mv[1];
APPLY_MV_SCALING(b1, candidates); APPLY_MV_SCALING(b1, candidates);
candidates++; candidates++;
} else if(b2 && b2->type == CU_INTER) { } else if(b2 && b2->type == CU_INTER) {
mv_cand[candidates][0] = b2->inter.mv[0]; mv_cand[candidates][0] = b2->inter.mv[0];
mv_cand[candidates][1] = b2->inter.mv[1]; mv_cand[candidates][1] = b2->inter.mv[1];
APPLY_MV_SCALING(b2, candidates); APPLY_MV_SCALING(b2, candidates);
candidates++; candidates++;
} }
} }