shithub: libvpx

Download patch

ref: 788d7f10d4e03b58b02c14b961200ccb3134c4f0
parent: 91dc8ce70d8071b114c907bf760d65bad83fe072
parent: 57679badf2970455117fb95e766d2ed202eb31bf
author: Deb Mukherjee <debargha@google.com>
date: Sun Oct 21 11:35:24 EDT 2012

Merge "Allow B_VL_PRED & B_LD_PRED modes with Superblocks" into experimental

--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -400,7 +400,6 @@
 #define ACTIVE_HT16 300
 #endif
 
-#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM16X16
 // convert MB_PREDICTION_MODE to B_PREDICTION_MODE
 static B_PREDICTION_MODE pred_mode_conv(MB_PREDICTION_MODE mode) {
   B_PREDICTION_MODE b_mode;
@@ -442,7 +441,6 @@
   }
   return b_mode;
 }
-#endif
 
 #if CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM16X16
 // transform mapping
--- a/vp8/common/findnearmv.h
+++ b/vp8/common/findnearmv.h
@@ -159,45 +159,34 @@
   if (!(b & 3)) {
     /* On L edge, get from MB to left of us */
     --cur_mb;
-    switch (cur_mb->mbmi.mode) {
-      case DC_PRED:
-        return B_DC_PRED;
-      case V_PRED:
-        return B_VE_PRED;
-      case H_PRED:
-        return B_HE_PRED;
-      case TM_PRED:
-        return B_TM_PRED;
-      case I8X8_PRED:
-      case B_PRED:
-        return (cur_mb->bmi + b + 3)->as_mode.first;
-      default:
-        return B_DC_PRED;
+
+    if (cur_mb->mbmi.mode < I8X8_PRED) {
+      return pred_mode_conv(cur_mb->mbmi.mode);
+    } else if (cur_mb->mbmi.mode == I8X8_PRED) {
+      return pred_mode_conv((cur_mb->bmi + 3 + b)->as_mode.first);
+    } else if (cur_mb->mbmi.mode == B_PRED) {
+      return ((cur_mb->bmi + 3 + b)->as_mode.first);
+    } else {
+      return B_DC_PRED;
     }
   }
   return (cur_mb->bmi + b - 1)->as_mode.first;
 }
 
-static B_PREDICTION_MODE above_block_mode(const MODE_INFO
-                                          *cur_mb, int b, int mi_stride) {
+static B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
+                                          int b, int mi_stride) {
   if (!(b >> 2)) {
     /* On top edge, get from MB above us */
     cur_mb -= mi_stride;
 
-    switch (cur_mb->mbmi.mode) {
-      case DC_PRED:
-        return B_DC_PRED;
-      case V_PRED:
-        return B_VE_PRED;
-      case H_PRED:
-        return B_HE_PRED;
-      case TM_PRED:
-        return B_TM_PRED;
-      case I8X8_PRED:
-      case B_PRED:
-        return (cur_mb->bmi + b + 12)->as_mode.first;
-      default:
-        return B_DC_PRED;
+    if (cur_mb->mbmi.mode < I8X8_PRED) {
+      return pred_mode_conv(cur_mb->mbmi.mode);
+    } else if (cur_mb->mbmi.mode == I8X8_PRED) {
+      return pred_mode_conv((cur_mb->bmi + 12 + b)->as_mode.first);
+    } else if (cur_mb->mbmi.mode == B_PRED) {
+      return ((cur_mb->bmi + 12 + b)->as_mode.first);
+    } else {
+      return B_DC_PRED;
     }
   }
 
--- a/vp8/common/reconintra4x4.c
+++ b/vp8/common/reconintra4x4.c
@@ -298,18 +298,19 @@
 void vp8_intra_prediction_down_copy(MACROBLOCKD *xd) {
   unsigned char *above_right = *(xd->block[0].base_dst) + xd->block[0].dst -
                                xd->block[0].dst_stride + 16;
+  unsigned int *src_ptr = (unsigned int *)
+      (above_right - (xd->mb_index == 3 ? 16 * xd->block[0].dst_stride : 0));
 
-  unsigned int *src_ptr = (unsigned int *)above_right;
-  unsigned int *dst_ptr0 =
-    (unsigned int *)(above_right + 4 * xd->block[0].dst_stride);
+  unsigned int *dst_ptr0 = (unsigned int *)above_right;
   unsigned int *dst_ptr1 =
-    (unsigned int *)(above_right + 8 * xd->block[0].dst_stride);
+    (unsigned int *)(above_right + 4 * xd->block[0].dst_stride);
   unsigned int *dst_ptr2 =
+    (unsigned int *)(above_right + 8 * xd->block[0].dst_stride);
+  unsigned int *dst_ptr3 =
     (unsigned int *)(above_right + 12 * xd->block[0].dst_stride);
 
   *dst_ptr0 = *src_ptr;
   *dst_ptr1 = *src_ptr;
   *dst_ptr2 = *src_ptr;
+  *dst_ptr3 = *src_ptr;
 }
-
-
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -296,13 +296,6 @@
       if (mode != B_PRED) {
         vp8_build_intra_predictors_mby(xd);
       }
-#if 0
-      // Intra-modes requiring recon data from top-right
-      // MB have been temporarily disabled.
-      else {
-        vp8_intra_prediction_down_copy(xd);
-      }
-#endif
     }
   } else {
 #if CONFIG_SUPERBLOCKS
@@ -371,6 +364,7 @@
                                               b->dst_stride);
     }
   } else if (mode == B_PRED) {
+    vp8_intra_prediction_down_copy(xd);
     for (i = 0; i < 16; i++) {
       BLOCKD *b = &xd->block[i];
       int b_mode = xd->mode_info_context->bmi[i].as_mode.first;
@@ -595,6 +589,8 @@
       int dy = row_delta[i];
       int dx = col_delta[i];
       int offset_extended = dy * xd->mode_info_stride + dx;
+
+      xd->mb_index = i;
 
       mi = xd->mode_info_context;
       if ((mb_row >= pc->mb_rows) || (mb_col >= pc->mb_cols)) {
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -1945,10 +1945,12 @@
   if (mbmi->mode == I8X8_PRED) {
     vp8_encode_intra8x8mby(IF_RTCD(&cpi->rtcd), x);
     vp8_encode_intra8x8mbuv(IF_RTCD(&cpi->rtcd), x);
-  } else if (mbmi->mode == B_PRED)
+  } else if (mbmi->mode == B_PRED) {
+    vp8_intra_prediction_down_copy(&x->e_mbd);
     vp8_encode_intra4x4mby(IF_RTCD(&cpi->rtcd), x);
-  else
+  } else {
     vp8_encode_intra16x16mby(IF_RTCD(&cpi->rtcd), x);
+  }
 
   if (mbmi->mode != I8X8_PRED) {
     vp8_encode_intra16x16mbuv(IF_RTCD(&cpi->rtcd), x);
@@ -2049,6 +2051,7 @@
 
   if (mbmi->ref_frame == INTRA_FRAME) {
     if (mbmi->mode == B_PRED) {
+      vp8_intra_prediction_down_copy(xd);
       vp8_encode_intra16x16mbuv(IF_RTCD(&cpi->rtcd), x);
       vp8_encode_intra4x4mby(IF_RTCD(&cpi->rtcd), x);
     } else if (mbmi->mode == I8X8_PRED) {
--- a/vp8/encoder/encodeintra.c
+++ b/vp8/encoder/encodeintra.c
@@ -218,7 +218,7 @@
     vp8_subtract_4b_c(be, b, 16);
 
 #if CONFIG_HYBRIDTRANSFORM8X8
-    tx_type = get_tx_type(xd, &xd->block[idx]);
+    tx_type = get_tx_type(xd, xd->block + idx);
     if (tx_type != DCT_DCT) {
       vp8_fht_c(be->src_diff, (x->block + idx)->coeff, 32,
                 tx_type, 8);
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -1175,11 +1175,6 @@
       int64_t this_rd;
       int ratey;
 
-      // TODO Temporarily ignore modes that need the above-right data. SB
-      // encoding means this data is not available for the bottom right MB
-      // Do we need to do this for mode2 also?
-      if (mode == B_LD_PRED || mode == B_VL_PRED)
-        continue;
       b->bmi.as_mode.first = mode;
       rate = bmode_costs[mode];
 
@@ -1293,11 +1288,10 @@
     tl = (ENTROPY_CONTEXT *)&t_left;
   }
 
-  // TODO(agrange)
-  // vp8_intra_prediction_down_copy(xd);
-
   xd->mode_info_context->mbmi.mode = B_PRED;
   bmode_costs = mb->inter_bmode_costs;
+
+  vp8_intra_prediction_down_copy(xd);
 
   for (i = 0; i < 16; i++) {
     MODE_INFO *const mic = xd->mode_info_context;
--