From 716c1d5ff512135577ba80d336f0c572c987db21 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 15 Feb 2017 09:18:34 -0800 Subject: Vp9: Speed 8 aq-mode=3: Reduce computation in estimating bits per mb. vp9_compute_qdelta_by_rate has almost 2% overhead in profiling on Nexus 6. Reduce the calling of that function in speed 8 by estimating the delta-q. Both rtc and rtc_derf show little/no change in avg psnr/ssim. Encoding speed is 2~3% faster on Nexus 6. Change-Id: If25933715783f31104a18a5092ea347b1221b5f5 --- vp9/encoder/vp9_aq_cyclicrefresh.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index ba6f1b2ea..0e8e11ca7 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -128,8 +128,7 @@ int vp9_cyclic_refresh_rc_bits_per_mb(const VP9_COMP *cpi, int i, CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; int bits_per_mb; int num8x8bl = cm->MBs << 2; - // Compute delta-q corresponding to qindex i. - int deltaq = compute_deltaq(cpi, i, cr->rate_ratio_qdelta); + int deltaq = 0; // Weight for segment prior to encoding: take the average of the target // number for the frame to be encoded and the actual from the previous frame. // Use the target if its less. @@ -142,6 +141,12 @@ int vp9_cyclic_refresh_rc_bits_per_mb(const VP9_COMP *cpi, int i, num8x8bl; if (weight_segment_target < 7 * weight_segment / 8) weight_segment = weight_segment_target; + // Compute delta-q corresponding to qindex i. + // Take a quick estimate for speed >=8, half of the max allowed deltaq. + if (cpi->oxcf.speed < 8) + deltaq = compute_deltaq(cpi, i, cr->rate_ratio_qdelta); + else + deltaq = -(cr->max_qdelta_perc * i) / 200; // Take segment weighted average for bits per mb. bits_per_mb = (int)((1.0 - weight_segment) * vp9_rc_bits_per_mb(cm->frame_type, i, -- cgit v1.2.3