Tweak screen content tools detection algorithm

Improve the screen content tools decision algorithms to catch some
corner cases. For ugc1080p testset, the coding efficiency gain vs. speed
trade-off are as follows, and no degradations on other testsets.

	 ssim  psnr1411	vmaf   vmaf_neg uvqone	encoding_spdup
speed=0	-0.798	-0.79	-0.72	-0.868	-1	-3.989
speed=1	-0.985	-0.998	-0.986	-1.106	-0.891	-2.768
speed=2	-1.224	-1.156	-1.123	-1.218	-1.146	-1.681
speed=3	-0.803	-0.737	-0.66	-0.762	-0.953	-0.505
speed=4	-0.838	-0.785	-0.785	-0.889	-1.762	-0.001

STATS_CHANGED

Change-Id: Id076ec753931d6c9a343c3a349be06f8fb974278
diff --git a/av1/encoder/encoder_utils.c b/av1/encoder/encoder_utils.c
index 47d6921..7e1db0c 100644
--- a/av1/encoder/encoder_utils.c
+++ b/av1/encoder/encoder_utils.c
@@ -1157,11 +1157,16 @@
   const int psnr_diff_is_large = (psnr_diff > STRICT_PSNR_DIFF_THRESH);
   const int ratio_is_large =
       ((palette_ratio >= 0.0001) && ((psnr_diff / palette_ratio) > 4));
-  const int is_sc_encoding_much_better = (psnr_diff_is_large || ratio_is_large);
+  const int ratio_is_large_2 = ((psnr_diff > 0.1) && (palette_ratio >= 0.05) &&
+                                ((psnr_diff / palette_ratio) > 2));
+  const int is_sc_encoding_much_better =
+      (psnr_diff_is_large || ratio_is_large || ratio_is_large_2);
+
   if (is_sc_encoding_much_better) {
     // Use screen content tools, if we get coding gain.
     features->allow_screen_content_tools = 1;
-    features->allow_intrabc = cpi->intrabc_used;
+    features->allow_intrabc =
+        (allow_intrabc_orig_decision || cpi->intrabc_used);
     cpi->use_screen_content_tools = 1;
     cpi->is_screen_content_type = 1;
   } else {