vp9-rtc: Disable cyclic refresh under some conditions
authorMarco Paniconi <marpan@google.com>
Tue, 26 Mar 2019 17:45:22 +0000 (10:45 -0700)
committerMarco Paniconi <marpan@google.com>
Tue, 26 Mar 2019 18:01:30 +0000 (11:01 -0700)
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

vp9/encoder/vp9_aq_cyclicrefresh.c
vp9/encoder/vp9_speed_features.c

index b3b5460..adb12c1 100644 (file)
@@ -481,6 +481,7 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) {
   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 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) {
       (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;
   }
index 8366425..55bd106 100644 (file)
@@ -793,6 +793,10 @@ static void set_rt_speed_feature_framesize_independent(
     // 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) {