diff options
Diffstat (limited to 'vp9/encoder/vp9_rdopt.c')
-rw-r--r-- | vp9/encoder/vp9_rdopt.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 5fc3b7c05..2c54bf5d3 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -3013,42 +3013,31 @@ static void rd_variance_adjustment(VP9_COMP *cpi, MACROBLOCK *x, unsigned int absvar_diff = 0; unsigned int var_factor = 0; unsigned int adj_max; + const int bw = num_8x8_blocks_wide_lookup[bsize]; + const int bh = num_8x8_blocks_high_lookup[bsize]; vp9e_tune_content content_type = cpi->oxcf.content; if (*this_rd == INT64_MAX) return; #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - if (source_variance > 100) { - rec_variance = vp9_high_get_sby_perpixel_variance(cpi, &xd->plane[0].dst, - bsize, xd->bd); - src_variance = source_variance; - } else { - rec_variance = - vp9_high_get_sby_variance(cpi, &xd->plane[0].dst, bsize, xd->bd); - src_variance = - vp9_high_get_sby_variance(cpi, &x->plane[0].src, bsize, xd->bd); - } - } else { - if (source_variance > 100) { - rec_variance = - vp9_get_sby_perpixel_variance(cpi, &xd->plane[0].dst, bsize); - src_variance = source_variance; - } else { - rec_variance = vp9_get_sby_variance(cpi, &xd->plane[0].dst, bsize); - src_variance = vp9_get_sby_variance(cpi, &x->plane[0].src, bsize); - } - } -#else - if (source_variance > 100) { - rec_variance = vp9_get_sby_perpixel_variance(cpi, &xd->plane[0].dst, bsize); - src_variance = source_variance; + rec_variance = + vp9_high_get_sby_variance(cpi, &xd->plane[0].dst, bsize, xd->bd); + src_variance = + vp9_high_get_sby_variance(cpi, &x->plane[0].src, bsize, xd->bd); } else { rec_variance = vp9_get_sby_variance(cpi, &xd->plane[0].dst, bsize); src_variance = vp9_get_sby_variance(cpi, &x->plane[0].src, bsize); } +#else + rec_variance = vp9_get_sby_variance(cpi, &xd->plane[0].dst, bsize); + src_variance = vp9_get_sby_variance(cpi, &x->plane[0].src, bsize); #endif // CONFIG_VP9_HIGHBITDEPTH + // Scale based on area in 8x8 blocks + rec_variance /= (bw * bh); + src_variance /= (bw * bh); + // Lower of source (raw per pixel value) and recon variance. Note that // if the source per pixel is 0 then the recon value here will not be per // pixel (see above) so will likely be much larger. |