Commit 51b6e73a authored by Jingning Han's avatar Jingning Han

Make sb intra rd search consistent with encoding

This commit makes operations of the superblock intra coding rate
distortion optimization consistent with those used in the encoding
process. Given the test prediction mode and transform size, the rd
optimizer encodes and reconstructs each transformed block of the
superblock consecutively, then computes the total rate-distortion
costs accosicated with the current superblock to select the coding

It achieves coding performance gains:
derf 0.353%
yt   1.111%

Change-Id: I0da2eb7a71361dfb8c1384927fc536b0c2790d07
parent 9068bce4
......@@ -549,7 +549,11 @@ static void super_block_yrd_for_txfm(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize, TX_SIZE tx_size) {
MACROBLOCKD *const xd = &x->e_mbd;
xd->mode_info_context->mbmi.txfm_size = tx_size;
vp9_xform_quant_sby(cm, x, bsize);
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
vp9_encode_intra_block_y(cm, x, bsize);
vp9_xform_quant_sby(cm, x, bsize);
*distortion = block_error_sby(x, bsize, tx_size == TX_32X32 ? 0 : 2);
*rate = rdcost_plane(cm, x, 0, bsize, tx_size);
......@@ -565,7 +569,8 @@ static void super_block_yrd(VP9_COMP *cpi,
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
vp9_subtract_sby(x, bs);
if (mbmi->ref_frame > INTRA_FRAME)
vp9_subtract_sby(x, bs);
if (cpi->speed > 4) {
if (bs >= BLOCK_SIZE_SB32X32) {
......@@ -829,7 +834,6 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
bmode_costs = x->y_mode_costs[A][L];
x->e_mbd.mode_info_context->mbmi.mode = mode;
vp9_build_intra_predictors_sby_s(&x->e_mbd, bsize);
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion, &s,
bsize, local_txfm_cache);
......@@ -2406,6 +2410,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
ctx->skip = 0;
xd->mode_info_context->mbmi.mode = DC_PRED;
xd->mode_info_context->mbmi.ref_frame = INTRA_FRAME;
err = rd_pick_intra_sby_mode(cpi, x, &rate_y, &rate_y_tokenonly,
&dist_y, &y_skip, bsize, txfm_cache);
mode = xd->mode_info_context->mbmi.mode;
......@@ -2736,7 +2741,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
txfm_cache[i] = txfm_cache[ONLY_4X4];
} else if (ref_frame == INTRA_FRAME) {
TX_SIZE uv_tx;
vp9_build_intra_predictors_sby_s(xd, bsize);
super_block_yrd(cpi, x, &rate_y, &distortion_y, &skippable,
bsize, txfm_cache);
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