Don't clobber |allow_screen_content_tools|.

Screen content tools can be forced on or inferred by color counting.
This prevents the inferred status of the tools from getting clobbered
when controls are evaluated.

BUG=aomedia:656

This also fixes the build with --disable-palette --enable-intrabc

Change-Id: If815a1eff2f9419117477f14cda143dd669c87c6
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 540d154..adcfeb4 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5082,16 +5082,22 @@
   av1_zero(rdc->coef_counts);
   av1_zero(rdc->comp_pred_diff);
 
+#if CONFIG_PALETTE || CONFIG_INTRABC
+  if (frame_is_intra_only(cm)) {
 #if CONFIG_PALETTE
-  if (cpi->auto_tune_content && frame_is_intra_only(cm)) {
-    cm->allow_screen_content_tools = is_screen_content(
-        cpi->source->y_buffer,
+    cm->allow_screen_content_tools =
+        cpi->oxcf.content == AOM_CONTENT_SCREEN ||
+        is_screen_content(cpi->source->y_buffer,
 #if CONFIG_HIGHBITDEPTH
-        cpi->source->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
+                          cpi->source->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
 #endif  // CONFIG_HIGHBITDEPTH
-        cpi->source->y_stride, cpi->source->y_width, cpi->source->y_height);
-  }
+                          cpi->source->y_stride, cpi->source->y_width,
+                          cpi->source->y_height);
+#else
+    cm->allow_screen_content_tools = cpi->oxcf.content == AOM_CONTENT_SCREEN;
 #endif  // CONFIG_PALETTE
+  }
+#endif  // CONFIG_PALETTE || CONFIG_INTRABC
 
 #if CONFIG_GLOBAL_MOTION
   av1_zero(rdc->global_motion_used);
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index cd4adbe..4fe992c 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -2197,17 +2197,12 @@
           : REFRESH_FRAME_CONTEXT_BACKWARD;
   cm->reset_frame_context = RESET_FRAME_CONTEXT_NONE;
 
-#if CONFIG_PALETTE || CONFIG_INTRABC
-  if (frame_is_intra_only(cm)) {
-    cm->allow_screen_content_tools = (cpi->oxcf.content == AOM_CONTENT_SCREEN);
-    // Automatically decide if screen content tools should be enabled.
-    cpi->auto_tune_content = (cpi->oxcf.content == AOM_CONTENT_DEFAULT);
-  }
-  if (x->palette_buffer == 0) {
+#if CONFIG_PALETTE
+  if (x->palette_buffer == NULL) {
     CHECK_MEM_ERROR(cm, x->palette_buffer,
                     aom_memalign(16, sizeof(*x->palette_buffer)));
   }
-#endif  // CONFIG_PALETTE || CONFIG_INTRABC
+#endif  // CONFIG_PALETTE
 #if CONFIG_EXT_INTER
   set_compound_tools(cm);
 #endif  // CONFIG_EXT_INTER
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 87f2ea3..c7bef26 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -655,12 +655,6 @@
 #if CONFIG_SPEED_REFS
   int sb_scanning_pass_idx;
 #endif  // CONFIG_SPEED_REFS
-
-#if CONFIG_PALETTE || CONFIG_INTRABC
-  // Specify if encoder does automatic classification of source video as
-  // screen content or not.
-  int auto_tune_content;
-#endif  // CONFIG_PALETTE || CONFIG_INTRABC
 } AV1_COMP;
 
 void av1_initialize_enc(void);