rtc-screen: Adjust conditions for cdf-update-mode=2

cdf-update-mode=2 (selective mode) disables the cdf update
for speedup. Default for RTC is cdf-update-mode=1 (update
on every frames). So this change does not change any
default behavior for RTC.

Modify the current logic for selective mode to get
some bdrate gain with litte speed loss.
Increase the #frames (from 10 to 30) after key or scene change
for enable update, to allow for better quality ramp-up.
Beyond that: allow for udpate after 8 frames of disabling but
only when frame_source_sad is above 0.

Stats for speed 10 screen with cdf-update-mode=2:
avg_psnr/ovr_psnr/ssim,  encoding_speedup
-2.43/-2.36/-2.34, -0.5

Stats for comparison with cdf-update-mode=1:
cdf-update-mode=2 vs 1 before this change:
avg_psnr/ovr_psnr/ssim,  encoding_speedup
5.89/5.22/5.30, 4.3

cdf-update-mode=2 vs 1 after this change
avg_psnr/ovr_psnr/ssim,  encoding_speedup
3.52/2.86/3.03, 3.7

The stats above discard the static clip, since
the behavior/plot for that clip has completely changed
since: https://aomedia-review.googlesource.com/c/aom/+/162662
After x ~200-300 frames encoding bitrate will go down to ~0.
With the current patch it will take somewhat longer to settle
down to ~0 bitrate.

Change-Id: I26109d4c920bc0662f643310bcf4f968f7c5842b
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 51c1d4b..7163d91 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -3343,12 +3343,13 @@
   if (cpi->svc.number_spatial_layers == 1 &&
       cpi->svc.number_temporal_layers == 1) {
     // Don't disable on intra_only, scene change (high_source_sad = 1),
-    // or resized frame. To avoid quality loss for now, force enable at
-    // every 8 frames.
+    // or resized frame. To avoid quality loss force enable at
+    // for ~30 frames after key or scene/slide change, and
+    // after 8 frames since last update if frame_source_sad > 0.
     if (frame_is_intra_only(cm) || is_frame_resize_pending(cpi) ||
-        rc->high_source_sad || rc->frames_since_key < 10 ||
-        cpi->cyclic_refresh->counter_encode_maxq_scene_change < 10 ||
-        cm->current_frame.frame_number % 8 == 0)
+        rc->high_source_sad || rc->frames_since_key < 30 ||
+        cpi->cyclic_refresh->counter_encode_maxq_scene_change < 30 ||
+        (cpi->frames_since_last_update > 8 && cpi->rc.frame_source_sad > 0))
       return 0;
     else
       return 1;