From: Jingning Han Date: Thu, 14 Mar 2019 15:28:44 +0000 (-0700) Subject: Refactor tile boundary condition for intra prediction X-Git-Tag: v1.8.1~187^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14208ab41e114f5779d106ae54a7cc8fd9d43820;p=libvpx 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 --- diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index e07a9f2d3..93fe46619 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -165,6 +165,9 @@ typedef struct macroblockd { 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 */ diff --git a/vp9/common/vp9_reconintra.c b/vp9/common/vp9_reconintra.c index 3e5ed616d..7d3eec1c5 100644 --- a/vp9/common/vp9_reconintra.c +++ b/vp9/common/vp9_reconintra.c @@ -408,8 +408,8 @@ void vp9_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, TX_SIZE tx_size, 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; diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index c75c3d9a4..8873c3c17 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -815,6 +815,8 @@ static MODE_INFO *set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd, // 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]; diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 8449474d4..96926d79b 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -251,6 +251,8 @@ static INLINE void set_mode_info_offsets(VP9_COMMON *const cm, 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); } diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 3c9ae1bb1..99b651d56 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -6015,6 +6015,8 @@ static void mode_estimation(VP9_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd, 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) { @@ -6782,6 +6784,9 @@ static void mc_flow_dispenser(VP9_COMP *cpi, GF_PICTURE *gf_picture, 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); set_error_per_bit(&cpi->td.mb, rdmult); diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 620d21f5a..11c607cc6 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -851,6 +851,7 @@ void vp9_first_pass_encode_tile_mb_row(VP9_COMP *cpi, ThreadData *td, 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 @@ void vp9_first_pass_encode_tile_mb_row(VP9_COMP *cpi, ThreadData *td, // 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;