rtc: Adjust threshold for zero_sad in scene detection

Make it more robust to avoid artifact observed
in issue below, which happens with light change.

Bug: b:444408285
Change-Id: I31232ddaa87a9e03b46b6032fe886ed4256ce61f
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 571411d..5c67b2d 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -3307,11 +3307,13 @@
   // between current and previous frame value(s). Use minimum threshold
   // for cases where there is small change from content that is completely
   // static.
+  const int thresh_zero_sad_samples =
+      avg_sad > 8 * min_thresh ? 3 * (num_samples >> 2) : num_samples >> 1;
   if (!light_change &&
       avg_sad >
           AOMMAX(min_thresh, (unsigned int)(rc->avg_source_sad * thresh)) &&
       rc->frames_since_key > 1 + cpi->svc.number_spatial_layers &&
-      num_zero_temp_sad < 3 * (num_samples >> 2))
+      num_zero_temp_sad < thresh_zero_sad_samples)
     rc->high_source_sad = 1;
   else
     rc->high_source_sad = 0;