shithub: libvpx

Download patch

ref: 8105ce6dce6d897c60e31f6811909f076995b867
parent: dc70fbe42d26d30db354abe6dfe27139be4f5157
parent: 32006aadd80843fadb20b888f98db0b4f66c746c
author: Dmitry Kovalev <[email protected]>
date: Tue Aug 13 06:00:01 EDT 2013

Merge "Using is_inter_block() instead of repetitive code."

--- 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)