From 4729a6f3894de0ee10414835848c5e95cc2080d5 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Fri, 24 May 2013 15:21:01 -0700 Subject: [PATCH] further clean-ups on intra4x4 coding Removed one 4x4 prediction step that was unnessary in the rd loop. Removed a unused modecosts estimate from encoder side. Change-Id: I65221a52719d6876492996955ef04142d2752d86 --- vp9/common/vp9_reconintra.c | 2 +- vp9/encoder/vp9_block.h | 1 - vp9/encoder/vp9_encodemb.c | 7 ++++--- vp9/encoder/vp9_modecosts.c | 3 --- vp9/encoder/vp9_rdopt.c | 8 +------- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/vp9/common/vp9_reconintra.c b/vp9/common/vp9_reconintra.c index dd60a76c7..b1f327b43 100644 --- a/vp9/common/vp9_reconintra.c +++ b/vp9/common/vp9_reconintra.c @@ -402,7 +402,7 @@ void vp9_predict_intra_block(MACROBLOCKD *xd, (block_idx >> bwl) || xd->up_available; const int have_left = (block_idx & wmask) || xd->left_available; - const int have_right = ((block_idx & wmask) != wmask); + int have_right = ((block_idx & wmask) != wmask); const int txfm_block_size = 4 << tx_size; assert(bwl >= 0); diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h index 211eca4b4..0e9b6804c 100644 --- a/vp9/encoder/vp9_block.h +++ b/vp9/encoder/vp9_block.h @@ -117,7 +117,6 @@ struct macroblock { int mbmode_cost[2][MB_MODE_COUNT]; int intra_uv_mode_cost[2][MB_MODE_COUNT]; int bmode_costs[VP9_BINTRAMODES][VP9_BINTRAMODES][VP9_BINTRAMODES]; - int inter_bmode_costs[INTRA_MODE_COUNT]; int switchable_interp_costs[VP9_SWITCHABLE_FILTERS + 1] [VP9_SWITCHABLE_FILTERS]; diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index b7f60b127..87323f916 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -610,6 +610,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize, struct encode_b_args* const args = arg; MACROBLOCK* const x = args->x; MACROBLOCKD* const xd = &x->e_mbd; + MB_MODE_INFO* const mbmi = &xd->mode_info_context->mbmi; const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size / 2); const int bw = 4 << (b_width_log2(bsize) - xd->plane[plane].subsampling_x); const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane, @@ -634,9 +635,9 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize, TX_TYPE tx_type; int mode, b_mode; - mode = plane == 0? xd->mode_info_context->mbmi.mode: - xd->mode_info_context->mbmi.uv_mode; - if (bsize <= BLOCK_SIZE_SB8X8 && mode == I4X4_PRED && plane == 0) + mode = plane == 0? mbmi->mode: mbmi->uv_mode; + if (mbmi->sb_type < BLOCK_SIZE_SB8X8 && plane == 0 && + mbmi->ref_frame == INTRA_FRAME) b_mode = xd->mode_info_context->bmi[ib].as_mode.first; else b_mode = mode; diff --git a/vp9/encoder/vp9_modecosts.c b/vp9/encoder/vp9_modecosts.c index 171b44bf9..67658f575 100644 --- a/vp9/encoder/vp9_modecosts.c +++ b/vp9/encoder/vp9_modecosts.c @@ -17,7 +17,6 @@ void vp9_init_mode_costs(VP9_COMP *c) { VP9_COMMON *x = &c->common; - const vp9_tree_p T = vp9_bmode_tree; const vp9_tree_p KT = vp9_bmode_tree; int i, j; @@ -28,8 +27,6 @@ void vp9_init_mode_costs(VP9_COMP *c) { } } - vp9_cost_tokens((int *)c->mb.inter_bmode_costs, x->fc.bmode_prob, T); - // TODO(rbultje) separate tables for superblock costing? vp9_cost_tokens(c->mb.mbmode_cost[1], x->fc.sb_ymode_prob, vp9_sb_ymode_tree); diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 2eb3f9b29..f64bd97a6 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -611,7 +611,6 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib, int64_t this_rd; int ratey = 0; - xd->mode_info_context->bmi[ib].as_mode.first = mode; if (cm->frame_type == KEY_FRAME) rate = bmode_costs[mode]; else @@ -653,9 +652,6 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib, distortion += vp9_block_error(coeff, BLOCK_OFFSET(xd->plane[0].dqcoeff, block, 16), 16) >> 2; - vp9_intra4x4_predict(xd, block, BLOCK_SIZE_SB8X8, mode, - dst, xd->plane[0].dst.stride); - if (best_tx_type != DCT_DCT) vp9_short_iht4x4_add(BLOCK_OFFSET(xd->plane[0].dqcoeff, block, 16), dst, xd->plane[0].dst.stride, best_tx_type); @@ -731,7 +727,7 @@ static int64_t rd_pick_intra4x4mby_modes(VP9_COMP *cpi, MACROBLOCK *mb, vpx_memcpy(t_left, xd->plane[0].left_context, sizeof(t_left)); xd->mode_info_context->mbmi.mode = I4X4_PRED; - bmode_costs = mb->inter_bmode_costs; + bmode_costs = mb->mbmode_cost[cpi->common.frame_type]; for (idy = 0; idy < 2; idy += bh) { for (idx = 0; idx < 2; idx += bw) { @@ -2684,8 +2680,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, if (this_mode == I4X4_PRED) { int rate; - // Note the rate value returned here includes the cost of coding - // the I4X4_PRED mode : x->mbmode_cost[xd->frame_type][I4X4_PRED]; mbmi->txfm_size = TX_4X4; rd_pick_intra4x4mby_modes(cpi, x, &rate, &rate_y, &distortion_y, INT64_MAX);