From: Jerome Jiang Date: Fri, 3 Feb 2017 01:51:01 +0000 (-0800) Subject: vp9: speed 8: Tune threshold of ac skip and partitioning. X-Git-Tag: v1.7.0~750 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa327a1ed4280bfa30953b2cb4c05c8a64b595a1;p=libvpx vp9: speed 8: Tune threshold of ac skip and partitioning. Threshold for partitioning only affects VGA and lower res. 0.07% quality regression is observed in borg tests on rtc_derf and 0.2% regression on rtc. 5.6% speed up for low res and 6.8% for VGA on Nexus 6. Change-Id: If85a2919b48c991de66059c90f32ed06980452be --- diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index c16901992..a62f4b44c 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -488,6 +488,8 @@ static void set_vbp_thresholds(VP9_COMP *cpi, int64_t thresholds[], int q) { else if (noise_level < kLow) threshold_base = (7 * threshold_base) >> 3; } + if (cpi->oxcf.speed >= 8 && cm->width <= 640 && cm->height <= 480) + threshold_base = (5 * threshold_base) >> 2; thresholds[0] = threshold_base; thresholds[2] = threshold_base << cpi->oxcf.speed; if (cm->width <= 352 && cm->height <= 288) { diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index c24633625..de1546aff 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -296,6 +296,18 @@ static void calculate_variance(int bw, int bh, TX_SIZE tx_size, } } +// Adjust the ac_thr according to speed, width, height and normalized sum +static int ac_thr_factor(const int speed, const int width, const int height, + const int norm_sum) { + if (speed >= 8 && norm_sum < 5) { + if (width <= 640 && height <= 480) + return 4; + else + return 2; + } + return 1; +} + static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd, int *out_rate_sum, int64_t *out_dist_sum, @@ -312,7 +324,7 @@ static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize, const uint32_t dc_quant = pd->dequant[0]; const uint32_t ac_quant = pd->dequant[1]; const int64_t dc_thr = dc_quant * dc_quant >> 6; - const int64_t ac_thr = ac_quant * ac_quant >> 6; + int64_t ac_thr = ac_quant * ac_quant >> 6; unsigned int var; int sum; int skip_dc = 0; @@ -341,6 +353,9 @@ static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize, *var_y = var; *sse_y = sse; + ac_thr *= ac_thr_factor(cpi->oxcf.speed, cpi->common.width, + cpi->common.height, abs(sum) >> (bw + bh)); + if (cpi->common.tx_mode == TX_MODE_SELECT) { if (sse > (var << 2)) tx_size = VPXMIN(max_txsize_lookup[bsize],