shithub: libvpx

Download patch

ref: 14208ab41e114f5779d106ae54a7cc8fd9d43820
parent: 181631ac16af6e58a11f228bb137d61e23ddc253
author: Jingning Han <jingning@google.com>
date: Thu Mar 14 04:28:44 EDT 2019

Refactor tile boundary condition for intra prediction

Explicitly compare the block location against tile coordinate to
decide if intra prediction boundary is available. No coding stats
will be changed by this refactoring.

Change-Id: I80b3a131366bb2c5f8ea53a139ed6e9b0b7ddb68

--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -165,6 +165,9 @@
   unsigned int max_blocks_wide;
   unsigned int max_blocks_high;
 
+  int mi_row;
+  int mi_col;
+
   const vpx_prob (*partition_probs)[PARTITION_TYPES - 1];
 
   /* Distance of MB away from frame edges */
--- a/vp9/common/vp9_reconintra.c
+++ b/vp9/common/vp9_reconintra.c
@@ -408,8 +408,8 @@
                              int aoff, int loff, int plane) {
   const int bw = (1 << bwl_in);
   const int txw = (1 << tx_size);
-  const int have_top = loff || (xd->above_mi != NULL);
-  const int have_left = aoff || (xd->left_mi != NULL);
+  const int have_top = loff || xd->mi_row > 0;
+  const int have_left = aoff || xd->mi_col > xd->tile.mi_col_start;
   const int have_right = (aoff + txw) < bw;
   const int x = aoff * 4;
   const int y = loff * 4;
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -815,6 +815,8 @@
   // TODO(slavarnway): Generate sb_type based on bwl and bhl, instead of
   // passing bsize from decode_partition().
   xd->mi[0]->sb_type = bsize;
+  xd->mi_row = mi_row;
+  xd->mi_col = mi_col;
   for (y = 0; y < y_mis; ++y)
     for (x = !y; x < x_mis; ++x) {
       xd->mi[y * cm->mi_stride + x] = xd->mi[0];
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -251,6 +251,8 @@
   const int idx_str = xd->mi_stride * mi_row + mi_col;
   xd->mi = cm->mi_grid_visible + idx_str;
   xd->mi[0] = cm->mi + idx_str;
+  xd->mi_row = mi_row;
+  xd->mi_col = mi_col;
   x->mbmi_ext = x->mbmi_ext_base + (mi_row * cm->mi_cols + mi_col);
 }
 
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -6015,6 +6015,8 @@
   xd->mb_to_right_edge = ((cm->mi_cols - 1 - mi_col) * MI_SIZE) * 8;
   xd->above_mi = (mi_row > 0) ? &mi_above : NULL;
   xd->left_mi = (mi_col > 0) ? &mi_left : NULL;
+  xd->mi_row = mi_row;
+  xd->mi_col = mi_col;
 
   // Intra prediction search
   for (mode = DC_PRED; mode <= TM_PRED; ++mode) {
@@ -6781,6 +6783,9 @@
   xd->mi = cm->mi_grid_visible;
   xd->mi[0] = cm->mi;
   xd->cur_buf = this_frame;
+
+  xd->tile.mi_row_start = 0;
+  xd->tile.mi_col_start = 0;
 
   // Get rd multiplier set up.
   rdmult = vp9_compute_rd_mult_based_on_qindex(cpi, tpl_frame->base_qindex);
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -851,6 +851,7 @@
 
   xd->mi = cm->mi_grid_visible + xd->mi_stride * (mb_row << 1) + mb_col_start;
   xd->mi[0] = cm->mi + xd->mi_stride * (mb_row << 1) + mb_col_start;
+  xd->tile = tile;
 
   for (i = 0; i < MAX_MB_PLANE; ++i) {
     p[i].coeff = ctx->coeff_pbuf[i][1];
@@ -915,6 +916,8 @@
     // are available.  Required by vp9_predict_intra_block().
     xd->above_mi = (mb_row != 0) ? &mi_above : NULL;
     xd->left_mi = ((mb_col << 1) > tile.mi_col_start) ? &mi_left : NULL;
+    xd->mi_row = mb_row << 1;
+    xd->mi_col = mb_col << 1;
 
     // Do intra 16x16 prediction.
     x->skip_encode = 0;