ref: 32006aadd80843fadb20b888f98db0b4f66c746c
parent: b89eef8f8277d0e7142da7c4799ebf296cea8fa2
author: Dmitry Kovalev <[email protected]>
date: Mon Aug 12 13:42:14 EDT 2013
Using is_inter_block() instead of repetitive code. Change-Id: If0b04c476c34fb8c102c9f750d7fe5669a86a532
--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -130,6 +130,9 @@
const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
+ const int left_intra = !is_inter_block(left_mbmi);
+ const int above_intra = !is_inter_block(above_mbmi);
+
// Note:
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
@@ -138,13 +141,10 @@
const int var_ref_idx = !fix_ref_idx;
if (above_in_image && left_in_image) { // both edges available
- if (above_mbmi->ref_frame[0] == INTRA_FRAME &&
- left_mbmi->ref_frame[0] == INTRA_FRAME) { // intra/intra (2)
+ if (above_intra && left_intra) { // intra/intra (2)
pred_context = 2;
- } else if (above_mbmi->ref_frame[0] == INTRA_FRAME ||
- left_mbmi->ref_frame[0] == INTRA_FRAME) { // intra/inter
- const MB_MODE_INFO *edge_mbmi = above_mbmi->ref_frame[0] == INTRA_FRAME ?
- left_mbmi : above_mbmi;
+ } 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)
pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]);
@@ -208,18 +208,18 @@
const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
+ const int left_intra = !is_inter_block(left_mbmi);
+ const int above_intra = !is_inter_block(above_mbmi);
+
// Note:
// The mode info data structure has a one element border above and to the
// 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[0] == INTRA_FRAME &&
- left_mbmi->ref_frame[0] == INTRA_FRAME) {
+ if (above_intra && left_intra) {
pred_context = 2;
- } else if (above_mbmi->ref_frame[0] == INTRA_FRAME ||
- left_mbmi->ref_frame[0] == INTRA_FRAME) {
- const MB_MODE_INFO *edge_mbmi = above_mbmi->ref_frame[0] == INTRA_FRAME ?
- left_mbmi : above_mbmi;
+ } else if (above_intra || left_intra) {
+ const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
if (edge_mbmi->ref_frame[1] <= INTRA_FRAME)
pred_context = 4 * (edge_mbmi->ref_frame[0] == LAST_FRAME);
@@ -273,6 +273,8 @@
const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
+ const int left_intra = !is_inter_block(left_mbmi);
+ const int above_intra = !is_inter_block(above_mbmi);
// Note:
// The mode info data structure has a one element border above and to the
@@ -279,13 +281,10 @@
// 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[0] == INTRA_FRAME &&
- left_mbmi->ref_frame[0] == INTRA_FRAME) {
+ if (above_intra && left_intra) {
pred_context = 2;
- } else if (above_mbmi->ref_frame[0] == INTRA_FRAME ||
- left_mbmi->ref_frame[0] == INTRA_FRAME) {
- const MB_MODE_INFO *edge_mbmi = above_mbmi->ref_frame[0] == INTRA_FRAME ?
- left_mbmi : above_mbmi;
+ } else if (above_intra || left_intra) {
+ const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
if (edge_mbmi->ref_frame[1] <= INTRA_FRAME) {
if (edge_mbmi->ref_frame[0] == LAST_FRAME)