From cb16652598961ec949000b42bb2de7af3e4763c1 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 31 Jan 2018 15:15:40 -0800 Subject: [PATCH] vp9-svc: Add condition on allocation for scaled_temp. 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 85c880bb0..e70137da2 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -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, -- 2.40.0