Using existing functions instead of raw expressions.
Change-Id: Ifa50b04bac1a6ff2abef989073cbf1f37a89eb50
This commit is contained in:
parent
e6c435b506
commit
480dd8ffbe
@ -880,7 +880,7 @@ int vp9_post_proc_frame(struct VP9Common *oci,
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mi->mbmi.mode >= NEARESTMV) {
|
||||
} else if (is_inter_mode(mi->mbmi.mode)) {
|
||||
MV *mv = &mi->mbmi.mv.as_mv;
|
||||
const int lx0 = x0 + 8;
|
||||
const int ly0 = y0 + 8;
|
||||
|
@ -90,25 +90,24 @@ unsigned char vp9_get_pred_context_comp_inter_inter(const VP9_COMMON *cm,
|
||||
// left of the entries correpsonding to real macroblocks.
|
||||
// The prediction flags in these dummy entries are initialised to 0.
|
||||
if (above_in_image && left_in_image) { // both edges available
|
||||
if (above_mbmi->ref_frame[1] <= INTRA_FRAME &&
|
||||
left_mbmi->ref_frame[1] <= INTRA_FRAME)
|
||||
if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi))
|
||||
// neither edge uses comp pred (0/1)
|
||||
pred_context = (above_mbmi->ref_frame[0] == cm->comp_fixed_ref) ^
|
||||
(left_mbmi->ref_frame[0] == cm->comp_fixed_ref);
|
||||
else if (above_mbmi->ref_frame[1] <= INTRA_FRAME)
|
||||
else if (!has_second_ref(above_mbmi))
|
||||
// one of two edges uses comp pred (2/3)
|
||||
pred_context = 2 + (above_mbmi->ref_frame[0] == cm->comp_fixed_ref ||
|
||||
above_mbmi->ref_frame[0] == INTRA_FRAME);
|
||||
else if (left_mbmi->ref_frame[1] <= INTRA_FRAME)
|
||||
!is_inter_block(above_mbmi));
|
||||
else if (!has_second_ref(left_mbmi))
|
||||
// one of two edges uses comp pred (2/3)
|
||||
pred_context = 2 + (left_mbmi->ref_frame[0] == cm->comp_fixed_ref ||
|
||||
left_mbmi->ref_frame[0] == INTRA_FRAME);
|
||||
!is_inter_block(left_mbmi));
|
||||
else // both edges use comp pred (4)
|
||||
pred_context = 4;
|
||||
} else if (above_in_image || left_in_image) { // one edge available
|
||||
const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi;
|
||||
|
||||
if (edge_mbmi->ref_frame[1] <= INTRA_FRAME)
|
||||
if (!has_second_ref(edge_mbmi))
|
||||
// edge does not use comp pred (0/1)
|
||||
pred_context = edge_mbmi->ref_frame[0] == cm->comp_fixed_ref;
|
||||
else
|
||||
@ -146,14 +145,14 @@ unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
|
||||
} else if (above_intra || left_intra) { // intra/inter
|
||||
const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
|
||||
|
||||
if (edge_mbmi->ref_frame[1] <= INTRA_FRAME) // single pred (1/3)
|
||||
if (!has_second_ref(edge_mbmi)) // single pred (1/3)
|
||||
pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]);
|
||||
else // comp pred (1/3)
|
||||
pred_context = 1 + 2 * (edge_mbmi->ref_frame[var_ref_idx]
|
||||
!= cm->comp_var_ref[1]);
|
||||
} else { // inter/inter
|
||||
int l_sg = left_mbmi->ref_frame[1] <= INTRA_FRAME;
|
||||
int a_sg = above_mbmi->ref_frame[1] <= INTRA_FRAME;
|
||||
const int l_sg = !has_second_ref(left_mbmi);
|
||||
const int a_sg = !has_second_ref(above_mbmi);
|
||||
MV_REFERENCE_FRAME vrfa = a_sg ? above_mbmi->ref_frame[0]
|
||||
: above_mbmi->ref_frame[var_ref_idx];
|
||||
MV_REFERENCE_FRAME vrfl = l_sg ? left_mbmi->ref_frame[0]
|
||||
@ -187,13 +186,15 @@ unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
|
||||
} else if (above_in_image || left_in_image) { // one edge available
|
||||
const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi;
|
||||
|
||||
if (edge_mbmi->ref_frame[0] == INTRA_FRAME)
|
||||
if (!is_inter_block(edge_mbmi)) {
|
||||
pred_context = 2;
|
||||
else if (edge_mbmi->ref_frame[1] > INTRA_FRAME)
|
||||
pred_context = 4 * (edge_mbmi->ref_frame[var_ref_idx]
|
||||
} else {
|
||||
if (has_second_ref(edge_mbmi))
|
||||
pred_context = 4 * (edge_mbmi->ref_frame[var_ref_idx]
|
||||
!= cm->comp_var_ref[1]);
|
||||
else
|
||||
pred_context = 3 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]);
|
||||
else
|
||||
pred_context = 3 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]);
|
||||
}
|
||||
} else { // no edges available (2)
|
||||
pred_context = 2;
|
||||
}
|
||||
|
@ -445,25 +445,25 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
|
||||
int_mv nearest, nearby, best_mv;
|
||||
int_mv nearest_second, nearby_second, best_mv_second;
|
||||
uint8_t inter_mode_ctx;
|
||||
MV_REFERENCE_FRAME ref0, ref1;
|
||||
MV_REFERENCE_FRAME ref0;
|
||||
int is_compound;
|
||||
|
||||
mbmi->uv_mode = DC_PRED;
|
||||
read_ref_frames(pbi, r, mbmi->segment_id, mbmi->ref_frame);
|
||||
ref0 = mbmi->ref_frame[0];
|
||||
ref1 = mbmi->ref_frame[1];
|
||||
is_compound = ref1 > INTRA_FRAME;
|
||||
is_compound = has_second_ref(mbmi);
|
||||
|
||||
vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context,
|
||||
ref0, mbmi->ref_mvs[ref0], mi_row, mi_col);
|
||||
|
||||
inter_mode_ctx = mbmi->mode_context[ref0];
|
||||
|
||||
if (vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP))
|
||||
if (vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
|
||||
mbmi->mode = ZEROMV;
|
||||
else if (bsize >= BLOCK_8X8)
|
||||
mbmi->mode = read_inter_mode(cm, r, inter_mode_ctx);
|
||||
|
||||
mbmi->uv_mode = DC_PRED;
|
||||
} else {
|
||||
if (bsize >= BLOCK_8X8)
|
||||
mbmi->mode = read_inter_mode(cm, r, inter_mode_ctx);
|
||||
}
|
||||
|
||||
// nearest, nearby
|
||||
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
|
||||
@ -471,11 +471,8 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
|
||||
best_mv.as_int = mbmi->ref_mvs[ref0][0].as_int;
|
||||
}
|
||||
|
||||
mbmi->interp_filter = cm->mcomp_filter_type == SWITCHABLE
|
||||
? read_switchable_filter_type(pbi, r)
|
||||
: cm->mcomp_filter_type;
|
||||
|
||||
if (is_compound) {
|
||||
const MV_REFERENCE_FRAME ref1 = mbmi->ref_frame[1];
|
||||
vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context,
|
||||
ref1, mbmi->ref_mvs[ref1], mi_row, mi_col);
|
||||
|
||||
@ -486,6 +483,10 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
|
||||
}
|
||||
}
|
||||
|
||||
mbmi->interp_filter = cm->mcomp_filter_type == SWITCHABLE
|
||||
? read_switchable_filter_type(pbi, r)
|
||||
: cm->mcomp_filter_type;
|
||||
|
||||
if (bsize < BLOCK_8X8) {
|
||||
const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; // 1 or 2
|
||||
const int num_4x4_h = num_4x4_blocks_high_lookup[bsize]; // 1 or 2
|
||||
|
Loading…
x
Reference in New Issue
Block a user