Commit 4729a6f3 authored by Jingning Han's avatar Jingning Han
Browse files

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
parent 245a1155
......@@ -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);
......
......@@ -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];
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment