shithub: libvpx

Download patch

ref: c09e95fc7da1c91db3cef34dc61010ab33443eea
parent: cf728f89137a73b148a9e577697f209303604a9c
author: Marco Paniconi <[email protected]>
date: Tue Mar 26 06:45:22 EDT 2019

vp9-rtc: Disable cyclic refresh under some conditions

cyclic refresh does not work for speeds <= 4, so disable
it for this case. And dynamically disable it when
average_qp is close to MAXQ (only for non-svc), to improve
quality/rate control at very low bitrates.

Change-Id: I447be43aef0fbb80f4a30d81e11658b58744eae5

--- a/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.c
@@ -481,6 +481,7 @@
   int thresh_low_motion = 20;
   int qp_thresh = VPXMIN((cpi->oxcf.content == VP9E_CONTENT_SCREEN) ? 35 : 20,
                          rc->best_quality << 1);
+  int qp_max_thresh = 117 * MAXQ >> 7;
   cr->apply_cyclic_refresh = 1;
   if (frame_is_intra_only(cm) || cpi->svc.temporal_layer_id > 0 ||
       is_lossless_requested(&cpi->oxcf) ||
@@ -488,7 +489,9 @@
       (cpi->use_svc &&
        cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame) ||
       (!cpi->use_svc && rc->avg_frame_low_motion < thresh_low_motion &&
-       rc->frames_since_key > 40)) {
+       rc->frames_since_key > 40) ||
+      (!cpi->use_svc && rc->avg_frame_qindex[INTER_FRAME] > qp_max_thresh &&
+       rc->frames_since_key > 20)) {
     cr->apply_cyclic_refresh = 0;
     return;
   }
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -793,6 +793,10 @@
     // small step_param for all spatial layers.
     sf->mv.fullpel_search_step_param = 2;
   }
+  // TODO(marpan): There is regression for aq-mode=3 speed <= 4, force it
+  // off for now.
+  if (speed <= 4 && cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
+    cpi->oxcf.aq_mode = 0;
 }
 
 void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi, int speed) {