ref: 480dd8ffbe6a89bd65088de350c7a962a1415494
parent: e6c435b506fbcabacabbe1535d60ebcbfd5c2c11
author: Dmitry Kovalev <[email protected]>
date: Fri Aug 23 13:26:53 EDT 2013
Using existing functions instead of raw expressions. Change-Id: Ifa50b04bac1a6ff2abef989073cbf1f37a89eb50
--- a/vp9/common/vp9_postproc.c
+++ b/vp9/common/vp9_postproc.c
@@ -880,7 +880,7 @@
}
}
}
- } 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;
--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -90,25 +90,24 @@
// 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 @@
} 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 @@
} 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;
}
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -445,13 +445,13 @@
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);
@@ -458,13 +458,13 @@
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);
+ } else {
+ if (bsize >= BLOCK_8X8)
+ mbmi->mode = read_inter_mode(cm, r, inter_mode_ctx);
+ }
- mbmi->uv_mode = DC_PRED;
-
// nearest, nearby
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref0], &nearest, &nearby);
@@ -471,11 +471,8 @@
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);
@@ -485,6 +482,10 @@
best_mv_second.as_int = mbmi->ref_mvs[ref1][0].as_int;
}
}
+
+ 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