]> granicus.if.org Git - libvpx/commitdiff
vp9-svc: Add condition on allocation for scaled_temp.
authorMarco <marpan@google.com>
Wed, 31 Jan 2018 23:15:40 +0000 (15:15 -0800)
committerMarco <marpan@google.com>
Wed, 31 Jan 2018 23:19:27 +0000 (15:19 -0800)
scaled_temp frame is used as an intermediate buffer for
2 stage down-sampling: two stages of 1/2 down-sampling
for a target of 1/4x1/4. This is used in 3 layer SVC
to avoid duplicate frame downsampling (on middle layer).

As this allocation is only needed/used when the
number_spatial_layers > 2, add this condition to avoid
unneeded allocation for 1 and 2 spatial SVC.

Change-Id: If342466644f685c1ea3ca5344b581793e5136c09

vp9/encoder/vp9_encoder.c

index 85c880bb052e04ff3329c1291e60a7fd16871f4f..e70137da2ade72726a197e37d3997d1b0e685a16 100644 (file)
@@ -1121,8 +1121,9 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) {
 
   // For 1 pass cbr: allocate scaled_frame that may be used as an intermediate
   // buffer for a 2 stage down-sampling: two stages of 1:2 down-sampling for a
-  // target of 1/4x1/4.
-  if (is_one_pass_cbr_svc(cpi) && !cpi->svc.scaled_temp_is_alloc) {
+  // target of 1/4x1/4. number_spatial_layers must be greater than 2.
+  if (is_one_pass_cbr_svc(cpi) && !cpi->svc.scaled_temp_is_alloc &&
+      cpi->svc.number_spatial_layers > 2) {
     cpi->svc.scaled_temp_is_alloc = 1;
     if (vpx_realloc_frame_buffer(
             &cpi->svc.scaled_temp, cm->width >> 1, cm->height >> 1,