Disable upsampled references for best and realtime quality deadline

- For resolution > 1080p, this CL also disables upsampled
  references for best and realtime quality deadline besides
  good quality deadline.
  The following CL only disabled the good quality deadline:
  https://chromium-review.googlesource.com/#/c/405761/

- The issue was found by a segmentation fault happened in 4K
  --best mode encoding test. Current CL fixes the encoder
  segmentation fault temporarily.

- Another bug is filed:
  https://bugs.chromium.org/p/aomedia/issues/detail?id=108
  to track down the segmentation fault.

BUG=aomedia:107

Change-Id: I6f4bf14762b8e92d7b501d752167414cf37a6b26
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 98c31b7..20ea5e9 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -69,11 +69,6 @@
                                                        int speed) {
   AV1_COMMON *const cm = &cpi->common;
 
-  // Limit memory usage for high resolutions
-  if (AOMMIN(cm->width, cm->height) > 1080) {
-    sf->use_upsampled_references = 0;
-  }
-
   if (speed >= 1) {
     if (AOMMIN(cm->width, cm->height) >= 720) {
       sf->disable_split_mask =
@@ -456,9 +451,15 @@
 void av1_set_speed_features_framesize_dependent(AV1_COMP *cpi) {
   SPEED_FEATURES *const sf = &cpi->sf;
   const AV1EncoderConfig *const oxcf = &cpi->oxcf;
+  AV1_COMMON *const cm = &cpi->common;
   RD_OPT *const rd = &cpi->rd;
   int i;
 
+  // Limit memory usage for high resolutions
+  if (AOMMIN(cm->width, cm->height) > 1080) {
+    sf->use_upsampled_references = 0;
+  }
+
   if (oxcf->mode == REALTIME) {
     set_rt_speed_feature_framesize_dependent(cpi, sf, oxcf->speed);
   } else if (oxcf->mode == GOOD) {