vp9: SVC: Modify conditon for setting downsample filter type.
authorMarco <marpan@google.com>
Mon, 8 May 2017 17:47:53 +0000 (10:47 -0700)
committerMarco <marpan@google.com>
Mon, 8 May 2017 21:13:49 +0000 (14:13 -0700)
Base the condition on the resolution of the spatial layer.
And remove restriction on scaling factor.

Change-Id: Iad00177ce364279d85661654bff00ce7f48a672e

vp9/encoder/vp9_svc_layercontext.c

index edd8e22..2f2997c 100644 (file)
@@ -651,15 +651,15 @@ int vp9_one_pass_cbr_svc_start_layer(VP9_COMP *const cpi) {
                        lc->scaling_factor_num, lc->scaling_factor_den, &width,
                        &height);
 
-  // For 3 spatial layers, on the lowest resolution layer: set the filtertype
-  // for downsampling source to 1, to get averaging filter.
-  if (cpi->svc.number_spatial_layers == 3)
-    cpi->svc.filtertype_downsample_source[0] = 1;
+  // For low resolutions: set the filtertype for downsampling source to 1,
+  // to get averaging filter.
+  if (width <= 320 && height <= 240)
+    cpi->svc.filtertype_downsample_source[cpi->svc.spatial_layer_id] = 1;
+
   // 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,
   // 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.
-  // Same condition applies to use of non-zero phase_scaler.
   if (cpi->svc.number_spatial_layers > 1) {
     int sl;
     for (sl = 0; sl < cpi->svc.number_spatial_layers - 1; ++sl) {
@@ -668,10 +668,7 @@ int vp9_one_pass_cbr_svc_start_layer(VP9_COMP *const cpi) {
       if ((lc->scaling_factor_num != lc->scaling_factor_den >> 1) &&
           !(lc->scaling_factor_num == lc->scaling_factor_den >> 2 && sl == 0 &&
             cpi->svc.number_spatial_layers == 3)) {
-        int sl2;
         cpi->svc.use_base_mv = 0;
-        for (sl2 = 0; sl2 < cpi->svc.number_spatial_layers - 1; ++sl2)
-          cpi->svc.filtertype_downsample_source[sl2] = 0;
         break;
       }
     }