Change the minimum bsize to 8x8 for 4K+ videos

For 4K resolution and above, going down to BLOCK_8X8 does not offer
coding gain. Disabling it improves coding quality, speeds up the encoder,
and allows reduction of memory usage.

Performance on 4K:
 SPD | AVG_PSNR | OVR_PSNR |  SSIM  |  SPD_UP
 *0  |  -0.050% |  -0.049% |-0.041% |    N/A
  1  |  -0.041% |  -0.046% |-0.037% | +1.560%

*Speed 0 result is only an approximate as full run takes too long to
finish.

BUG=aomedia:2453

STATS_CHANGED

Change-Id: I1ede32f0bb42fd31bfd64119eeff180ca295ebd6
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index d22c769..0ed6e09 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -113,6 +113,7 @@
   const AV1_COMMON *const cm = &cpi->common;
   const int is_720p_or_larger = AOMMIN(cm->width, cm->height) >= 720;
   const int is_480p_or_larger = AOMMIN(cm->width, cm->height) >= 480;
+  const int is_4k_or_larger = AOMMIN(cm->width, cm->height) >= 2160;
 
   if (is_480p_or_larger) {
     sf->use_square_partition_only_threshold = BLOCK_128X128;
@@ -125,6 +126,10 @@
     sf->auto_max_partition_based_on_simple_motion = DIRECT_PRED;
   }
 
+  if (is_4k_or_larger) {
+    sf->default_min_partition_size = BLOCK_8X8;
+  }
+
   // TODO(huisu@google.com): train models for 720P and above.
   if (!is_720p_or_larger) {
     sf->ml_partition_search_breakout_thresh[0] = 200;  // BLOCK_8X8
@@ -680,6 +685,15 @@
     cpi->find_fractional_mv_step = av1_return_max_sub_pixel_mv;
   else if (cpi->oxcf.motion_vector_unit_test == 2)
     cpi->find_fractional_mv_step = av1_return_min_sub_pixel_mv;
+
+  MACROBLOCK *const x = &cpi->td.mb;
+  AV1_COMMON *const cm = &cpi->common;
+  x->min_partition_size = AOMMAX(sf->default_min_partition_size,
+                                 dim_to_size(cpi->oxcf.min_partition_size));
+  x->max_partition_size = AOMMIN(sf->default_max_partition_size,
+                                 dim_to_size(cpi->oxcf.max_partition_size));
+  x->min_partition_size = AOMMIN(x->min_partition_size, cm->seq_params.sb_size);
+  x->max_partition_size = AOMMIN(x->max_partition_size, cm->seq_params.sb_size);
 }
 
 void av1_set_speed_features_framesize_independent(AV1_COMP *cpi, int speed) {