shithub: libvpx

Download patch

ref: 5ac63d15dc57eeeb06824a80d02e4c784bc1d343
parent: 4d8958d8dddb9104e006bc806a2607bd4ee71708
author: Marco Paniconi <[email protected]>
date: Fri Mar 2 05:47:04 EST 2018

vp9-svc: Disable partition_reuse unless 2x2 scale.

For SVC, if any of the layer scale ratios are not
2x2, then disable the partiton_reuse, which assumes
2x2 scaling between layers.

Change-Id: I8b3163de0826052bbb1bfe03554a074c89510558

--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -608,8 +608,8 @@
     // For SVC: enable use of lower resolution partition for higher resolution,
     // only for 3 spatial layers and when config/top resolution is above VGA.
     // Enable only for non-base temporal layer frames.
-    if (cpi->use_svc && cpi->svc.number_spatial_layers == 3 &&
-        cpi->svc.temporal_layer_id > 0 &&
+    if (cpi->use_svc && cpi->svc.use_partition_reuse &&
+        cpi->svc.number_spatial_layers == 3 && cpi->svc.temporal_layer_id > 0 &&
         cpi->oxcf.width * cpi->oxcf.height > 640 * 480)
       sf->svc_use_lowres_part = 1;
   }
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -33,6 +33,7 @@
   svc->rc_drop_superframe = 0;
   svc->force_zero_mode_spatial_ref = 0;
   svc->use_base_mv = 0;
+  svc->use_partition_reuse = 0;
   svc->scaled_temp_is_alloc = 0;
   svc->scaled_one_half = 0;
   svc->current_superframe = 0;
@@ -611,7 +612,10 @@
   int width = 0, height = 0;
   LAYER_CONTEXT *lc = NULL;
   cpi->svc.skip_enhancement_layer = 0;
-  if (cpi->svc.number_spatial_layers > 1) cpi->svc.use_base_mv = 1;
+  if (cpi->svc.number_spatial_layers > 1) {
+    cpi->svc.use_base_mv = 1;
+    cpi->svc.use_partition_reuse = 1;
+  }
   cpi->svc.force_zero_mode_spatial_ref = 1;
   cpi->svc.mi_stride[cpi->svc.spatial_layer_id] = cpi->common.mi_stride;
 
@@ -675,8 +679,9 @@
   if (lc->scaling_factor_num > (3 * lc->scaling_factor_den) >> 2)
     cpi->svc.downsample_filter_phase[cpi->svc.spatial_layer_id] = 0;
 
-  // The usage of use_base_mv assumes down-scale of 2x2. For now, turn off use
-  // of base motion vectors if spatial scale factors for any layers are not 2,
+  // The usage of use_base_mv or partition_reuse assumes down-scale of 2x2.
+  // For now, turn off use of base motion vectors and partition reuse if the
+  // spatial scale factors for any layers are not 2,
   // keep the case of 3 spatial layers with scale factor of 4x4 for base layer.
   // TODO(marpan): Fix this to allow for use_base_mv for scale factors != 2.
   if (cpi->svc.number_spatial_layers > 1) {
@@ -688,6 +693,7 @@
           !(lc->scaling_factor_num == lc->scaling_factor_den >> 2 && sl == 0 &&
             cpi->svc.number_spatial_layers == 3)) {
         cpi->svc.use_base_mv = 0;
+        cpi->svc.use_partition_reuse = 0;
         break;
       }
     }
--- a/vp9/encoder/vp9_svc_layercontext.h
+++ b/vp9/encoder/vp9_svc_layercontext.h
@@ -89,6 +89,7 @@
   int current_superframe;
   int non_reference_frame;
   int use_base_mv;
+  int use_partition_reuse;
   // Used to control the downscaling filter for source scaling, for 1 pass CBR.
   // downsample_filter_phase: = 0 will do sub-sampling (no weighted average),
   // = 8 will center the target pixel and get a symmetric averaging filter.