ref: cb16652598961ec949000b42bb2de7af3e4763c1
parent: 2c950e131cc180c8d8babbc89f24fc29eb542273
author: Marco <[email protected]>
date: Wed Jan 31 10:15:40 EST 2018
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
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -1121,8 +1121,9 @@
// 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,