From e717d22b633c8df8af8654f517f53187a4ae5244 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Fri, 7 Nov 2014 17:50:55 -0800 Subject: [PATCH] Use reconstructed pixels for intra prediction This commit makes the speed -6 and above use the reconstructed boundary pixels for precise intra prediction. This allows more intra prediction modes to be tested in the non-RD coding process. Enabling horizontal and vertical intra prediction modes can improve the speed -6 compression performance for rtc set by 0.331%. Change-Id: I3a99f9d12c6af54de2bdbf28c76eab8e0905f744 --- vp9/encoder/vp9_pickmode.c | 56 ++++++++++++++++++-------------- vp9/encoder/vp9_speed_features.c | 1 + 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index f53c07894..af6732844 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -441,7 +441,8 @@ static void estimate_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, vp9_predict_intra_block(xd, block >> (2 * tx_size), b_width_log2_lookup[plane_bsize], tx_size, args->mode, - p->src.buf, src_stride, + x->skip_encode ? p->src.buf : pd->dst.buf, + x->skip_encode ? src_stride : dst_stride, pd->dst.buf, dst_stride, i, j, 0); // This procedure assumes zero offset from p->src.buf and pd->dst.buf. @@ -780,25 +781,6 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, assert(best_rdc.rdcost < INT64_MAX); } - // If best prediction is not in dst buf, then copy the prediction block from - // temp buf to dst buf. - if (best_pred != NULL && reuse_inter_pred && - best_pred->data != orig_dst.buf) { - pd->dst = orig_dst; -#if CONFIG_VP9_HIGHBITDEPTH - if (cm->use_highbitdepth) { - vp9_highbd_convolve_copy(best_pred->data, bw, pd->dst.buf, pd->dst.stride, - NULL, 0, NULL, 0, bw, bh, xd->bd); - } else { - vp9_convolve_copy(best_pred->data, bw, pd->dst.buf, pd->dst.stride, - NULL, 0, NULL, 0, bw, bh); - } -#else - vp9_convolve_copy(best_pred->data, bw, pd->dst.buf, pd->dst.stride, NULL, 0, - NULL, 0, bw, bh); -#endif // CONFIG_VP9_HIGHBITDEPTH - } - mbmi->mode = best_mode; mbmi->interp_filter = best_pred_filter; mbmi->tx_size = best_tx_size; @@ -817,11 +799,18 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, MIN(max_txsize_lookup[bsize], tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); - if (reuse_inter_pred) { - pd->dst.buf = tmp[0].data; - pd->dst.stride = bw; + if (best_pred != NULL && reuse_inter_pred && + best_pred->data == orig_dst.buf) { + this_mode_pred = &tmp[get_pred_buffer(tmp, 3)]; + vp9_convolve_copy(best_pred->data, best_pred->stride, + this_mode_pred->data, this_mode_pred->stride, + NULL, 0, NULL, 0, bw, bh); + best_pred = this_mode_pred; } + pd->dst = orig_dst; + // Change the limit of this loop to add other intra prediction + // mode tests. for (this_mode = DC_PRED; this_mode <= DC_PRED; ++this_mode) { const TX_SIZE saved_tx_size = mbmi->tx_size; args.mode = this_mode; @@ -849,8 +838,25 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, x->skip_txfm[0] = skip_txfm; } } - if (reuse_inter_pred) - pd->dst = orig_dst; + } + + pd->dst = orig_dst; + if (reuse_inter_pred && best_pred->data != orig_dst.buf && + is_inter_mode(mbmi->mode)) { +#if CONFIG_VP9_HIGHBITDEPTH + if (cm->use_highbitdepth) + vp9_highbd_convolve_copy(best_pred->data, best_pred->stride, + pd->dst.buf, pd->dst.stride, NULL, 0, + NULL, 0, bw, bh, xd->bd); + else + vp9_convolve_copy(best_pred->data, best_pred->stride, + pd->dst.buf, pd->dst.stride, NULL, 0, + NULL, 0, bw, bh); +#else + vp9_convolve_copy(best_pred->data, best_pred->stride, + pd->dst.buf, pd->dst.stride, NULL, 0, + NULL, 0, bw, bh); +#endif } if (is_inter_block(mbmi)) diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index 7a1b0cc1f..f9165c7c7 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c @@ -292,6 +292,7 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, sf->mv.search_method = NSTEP; sf->tx_size_search_method = is_keyframe ? USE_LARGESTALL : USE_TX_8X8; sf->mv.reduce_first_step_size = 1; + sf->skip_encode_sb = 0; } if (speed >= 7) { -- 2.40.0