Cleaning up vp9_get_pred_context_single_ref_p1().

Change-Id: I279343b474d7ff41afcf8f1493b6fbf716b51823
This commit is contained in:
Dmitry Kovalev 2014-02-05 11:48:01 -08:00
parent a536237228
commit 724fefb4cf

View File

@ -218,27 +218,25 @@ int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
} else { // inter/inter
const int above_has_second = has_second_ref(above_mbmi);
const int left_has_second = has_second_ref(left_mbmi);
const MV_REFERENCE_FRAME above0 = above_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME above1 = above_mbmi->ref_frame[1];
const MV_REFERENCE_FRAME left0 = left_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME left1 = left_mbmi->ref_frame[1];
if (above_has_second && left_has_second) {
pred_context = 1 + (above_mbmi->ref_frame[0] == LAST_FRAME ||
above_mbmi->ref_frame[1] == LAST_FRAME ||
left_mbmi->ref_frame[0] == LAST_FRAME ||
left_mbmi->ref_frame[1] == LAST_FRAME);
pred_context = 1 + (above0 == LAST_FRAME || above1 == LAST_FRAME ||
left0 == LAST_FRAME || left1 == LAST_FRAME);
} else if (above_has_second || left_has_second) {
const MV_REFERENCE_FRAME rfs = !above_has_second ?
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME crf1 = above_has_second ?
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME crf2 = above_has_second ?
above_mbmi->ref_frame[1] : left_mbmi->ref_frame[1];
const MV_REFERENCE_FRAME rfs = !above_has_second ? above0 : left0;
const MV_REFERENCE_FRAME crf1 = above_has_second ? above0 : left0;
const MV_REFERENCE_FRAME crf2 = above_has_second ? above1 : left1;
if (rfs == LAST_FRAME)
pred_context = 3 + (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
else
pred_context = (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
} else {
pred_context = 2 * (above_mbmi->ref_frame[0] == LAST_FRAME) +
2 * (left_mbmi->ref_frame[0] == LAST_FRAME);
pred_context = 2 * (above0 == LAST_FRAME) + 2 * (left0 == LAST_FRAME);
}
}
} else if (has_above || has_left) { // one edge available