rtc: Adjust low Q condition for disabling cyclic refresh

The current logic disabled cyclic refresh when avg Q went
below threshold, where threshold was MIN(20/35, rc->best_quality * 2).
This does not allow for disabling when application uses
a larger min-q (e.g., 10, where rc->best_quality=40).

Change the threshold to always disable when avg Q is close
to rc->best_quality, since delta-q not needed there.
This also decreases encoded bitrate for low/static content
when Q settles down to best_quality.

For some screen clips with min-q=10 at high bitrate
(with no key frames or scene changes), this can give
~5-10% speedup with negligible loss in quality.

Change-Id: Ie6ff08fc1eab089eeee66b291d5c6942d6e7d2a3
diff --git a/av1/encoder/aq_cyclicrefresh.c b/av1/encoder/aq_cyclicrefresh.c
index 9d1d224..be4b938 100644
--- a/av1/encoder/aq_cyclicrefresh.c
+++ b/av1/encoder/aq_cyclicrefresh.c
@@ -399,10 +399,8 @@
   int target_refresh = 0;
   double weight_segment_target = 0;
   double weight_segment = 0;
-  int qp_thresh = AOMMIN(20, rc->best_quality << 1);
-  if (cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN)
-    qp_thresh = AOMMIN(35, rc->best_quality << 1);
-  int qp_max_thresh = 118 * MAXQ >> 7;
+  const int qp_thresh = AOMMAX(16, rc->best_quality + 4);
+  const int qp_max_thresh = 118 * MAXQ >> 7;
   const int scene_change_detected = is_scene_change_detected(cpi);
   const int is_screen_content =
       (cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN);