ref: b4b5af6acddfec0bf28a79f74afb15de3dee6f66
parent: 8a927a1b7a6cad191e842fd51431a3a7d2fb0698
author: Jingning Han <[email protected]>
date: Mon Mar 30 07:09:29 EDT 2015
Use SATD based mode decision for block sizes below 16x16 This commit makes the encoder to select between SATD/variance as metric for mode decision. It also allows to account chroma component costs for mode decision as well. The overall encoding time increase as compared to variance based mode selection is about 15% for speed -6. The compression performance is on average 2.2% better than variance based approach, with about 5% compression performance gains for hard clips (e.g., jimredvga, nikas720p, and mmmoving) at lower bit-rate range. Change-Id: I4d04a31d36f4fcb3f5f491dacd6e7fe44cb9d815
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -639,13 +639,18 @@
i, j, 0);
// TODO(jingning): This needs further refactoring.
- block_yrd(cpi, x, &rate, &dist, &is_skippable, &this_sse, 0,
- bsize_tx, tx_size);
- x->skip_txfm[0] = is_skippable;
- if (is_skippable)
- rate = vp9_cost_bit(vp9_get_skip_prob(&cpi->common, xd), 1);
- else
- rate += vp9_cost_bit(vp9_get_skip_prob(&cpi->common, xd), 0);
+ if (plane_bsize <= BLOCK_16X16) {
+ block_yrd(cpi, x, &rate, &dist, &is_skippable, &this_sse, 0,
+ bsize_tx, tx_size);
+ x->skip_txfm[0] = is_skippable;
+ if (is_skippable)
+ rate = vp9_cost_bit(vp9_get_skip_prob(&cpi->common, xd), 1);
+ else
+ rate += vp9_cost_bit(vp9_get_skip_prob(&cpi->common, xd), 0);
+ } else {
+ unsigned int var_y, sse_y;
+ model_rd_for_sb_y(cpi, bsize_tx, x, xd, &rate, &dist, &var_y, &sse_y);
+ }
p->src.buf = src_buf_base;
pd->dst.buf = dst_buf_base;
@@ -1064,39 +1069,39 @@
vp9_get_switchable_rate(cpi, xd) : 0;
}
- // TODO(jingning): disable color operations temporarily.
- // chroma component rate-distortion cost modeling
-// if (x->color_sensitivity[0] || x->color_sensitivity[1]) {
-// int uv_rate = 0;
-// int64_t uv_dist = 0;
-// if (x->color_sensitivity[0])
-// vp9_build_inter_predictors_sbp(xd, mi_row, mi_col, bsize, 1);
-// if (x->color_sensitivity[1])
-// vp9_build_inter_predictors_sbp(xd, mi_row, mi_col, bsize, 2);
-// model_rd_for_sb_uv(cpi, bsize, x, xd, &uv_rate, &uv_dist,
-// &var_y, &sse_y);
-// this_rdc.rate += uv_rate;
-// this_rdc.dist += uv_dist;
-// }
-
- block_yrd(cpi, x, &this_rdc.rate, &this_rdc.dist, &is_skippable, &this_sse,
- 0, bsize, mbmi->tx_size);
- x->skip_txfm[0] = is_skippable;
- if (is_skippable) {
- this_rdc.rate = vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1);
- } else {
- if (RDCOST(x->rdmult, x->rddiv, this_rdc.rate, this_rdc.dist) <
- RDCOST(x->rdmult, x->rddiv, 0, this_sse)) {
- this_rdc.rate += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 0);
- } else {
+ if (bsize <= BLOCK_16X16) {
+ block_yrd(cpi, x, &this_rdc.rate, &this_rdc.dist, &is_skippable,
+ &this_sse, 0, bsize, mbmi->tx_size);
+ x->skip_txfm[0] = is_skippable;
+ if (is_skippable) {
this_rdc.rate = vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1);
- this_rdc.dist = this_sse;
+ } else {
+ if (RDCOST(x->rdmult, x->rddiv, this_rdc.rate, this_rdc.dist) <
+ RDCOST(x->rdmult, x->rddiv, 0, this_sse)) {
+ this_rdc.rate += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 0);
+ } else {
+ this_rdc.rate = vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1);
+ this_rdc.dist = this_sse;
+ }
}
+
+ if (cm->interp_filter == SWITCHABLE) {
+ if ((mbmi->mv[0].as_mv.row | mbmi->mv[0].as_mv.col) & 0x07)
+ this_rdc.rate += vp9_get_switchable_rate(cpi, xd);
+ }
}
- if (cm->interp_filter == SWITCHABLE) {
- if ((mbmi->mv[0].as_mv.row | mbmi->mv[0].as_mv.col) & 0x07)
- this_rdc.rate += vp9_get_switchable_rate(cpi, xd);
+ if (x->color_sensitivity[0] || x->color_sensitivity[1]) {
+ int uv_rate = 0;
+ int64_t uv_dist = 0;
+ if (x->color_sensitivity[0])
+ vp9_build_inter_predictors_sbp(xd, mi_row, mi_col, bsize, 1);
+ if (x->color_sensitivity[1])
+ vp9_build_inter_predictors_sbp(xd, mi_row, mi_col, bsize, 2);
+ model_rd_for_sb_uv(cpi, bsize, x, xd, &uv_rate, &uv_dist,
+ &var_y, &sse_y);
+ this_rdc.rate += uv_rate;
+ this_rdc.dist += uv_dist;
}
this_rdc.rate += rate_mv;