svc: Fix seg fault caused by odd frame size on top SL av1_set_size_literal will set initial_dimensions to 0 when odd width/height is rounded, which will cause all frame buffers to be set to NULL when setup_frame_size is called in encode_strategy. In fact, av1_set_size_literal will be called again in by av1_set_frame_size in encode_strategy. Bug: webm:1717 Change-Id: I0e17989afcaa0c0db8b2282b3fd526626cb7e9c0
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index e0ab38b..66d684b 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -292,7 +292,7 @@ av1_calculate_tile_rows(seq_params, mi_params->mi_rows, tiles); } -static void update_frame_size(AV1_COMP *cpi) { +void update_frame_size(AV1_COMP *cpi) { AV1_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h index 69d3a27..dd39f1c 100644 --- a/av1/encoder/encoder.h +++ b/av1/encoder/encoder.h
@@ -2854,6 +2854,8 @@ void av1_set_screen_content_options(struct AV1_COMP *cpi, FeatureFlags *features); +void update_frame_size(AV1_COMP *cpi); + // TODO(jingning): Move these functions as primitive members for the new cpi // class. static INLINE void stack_push(int *stack, int *stack_size, int item) {
diff --git a/av1/encoder/svc_layercontext.c b/av1/encoder/svc_layercontext.c index 9f09a4d..d12cb14 100644 --- a/av1/encoder/svc_layercontext.c +++ b/av1/encoder/svc_layercontext.c
@@ -351,7 +351,10 @@ // Use Eightap_smooth for low resolutions. if (width * height <= 320 * 240) svc->downsample_filter_type[svc->spatial_layer_id] = EIGHTTAP_SMOOTH; - av1_set_size_literal(cpi, width, height); + + cpi->common.width = width; + cpi->common.height = height; + update_frame_size(cpi); } void av1_svc_set_mt_per_spatial_layer(AV1_COMP *const cpi) {