For svc with dynamic resize (only for single_layer_svc mode), add flag to indicate resized width/height has already been set, otherwise on the resized/trigger frame (resize_pending=1), the wrong resolution may be set if oxcf->width/height is different than layer width/height in single_layer_svc mode.
Unified · Split
| @@ -3749,13 +3749,17 @@ static void set_frame_size(VP9_COMP *cpi) { · 3748 unmodified lines | |||
| 3749 | 3749 | ||
| 3750 | if (oxcf->pass == 0 && oxcf->rc_mode == VPX_CBR && | 3750 | if (oxcf->pass == 0 && oxcf->rc_mode == VPX_CBR && |
| 3751 | oxcf->resize_mode == RESIZE_DYNAMIC && cpi->resize_pending != 0) { | 3751 | oxcf->resize_mode == RESIZE_DYNAMIC && cpi->resize_pending != 0) { |
| 3752 | oxcf->scaled_frame_width = | 3752 | // For SVC scaled width/height will have been set (svc->resize_set=1) |
| 3753 | (oxcf->width * cpi->resize_scale_num) / cpi->resize_scale_den; | 3753 | // in get_svc_params based on the layer width/height. |
| 3754 | oxcf->scaled_frame_height = | 3754 | if (!cpi->use_svc || !cpi->svc.resize_set) { |
| 3755 | (oxcf->height * cpi->resize_scale_num) / cpi->resize_scale_den; | 3755 | oxcf->scaled_frame_width = |
| 3756 | // There has been a change in frame size. | 3756 | (oxcf->width * cpi->resize_scale_num) / cpi->resize_scale_den; |
| 3757 | vp9_set_size_literal(cpi, oxcf->scaled_frame_width, | 3757 | oxcf->scaled_frame_height = |
| 3758 | oxcf->scaled_frame_height); | 3758 | (oxcf->height * cpi->resize_scale_num) / cpi->resize_scale_den; |
| 3759 | // There has been a change in frame size. | ||
| 3760 | vp9_set_size_literal(cpi, oxcf->scaled_frame_width, | ||
| 3761 | oxcf->scaled_frame_height); | ||
| 3762 | } | ||
| 3759 | 3763 | ||
| 3760 | // TODO(agrange) Scale cpi->max_mv_magnitude if frame-size has changed. | 3764 | // TODO(agrange) Scale cpi->max_mv_magnitude if frame-size has changed. |
| 3761 | set_mv_search_params(cpi); | 3765 | set_mv_search_params(cpi); |
| @@ -2402,9 +2402,11 @@ void vp9_rc_get_svc_params(VP9_COMP *cpi) { · 2401 unmodified lines | |||
| 2402 | lc->scaling_factor_num_resize, | 2402 | lc->scaling_factor_num_resize, |
| 2403 | lc->scaling_factor_den_resize, &width, &height); | 2403 | lc->scaling_factor_den_resize, &width, &height); |
| 2404 | vp9_set_size_literal(cpi, width, height); | 2404 | vp9_set_size_literal(cpi, width, height); |
| 2405 | svc->resize_set = 1; | ||
| 2405 | } | 2406 | } |
| 2406 | } else { | 2407 | } else { |
| 2407 | cpi->resize_pending = 0; | 2408 | cpi->resize_pending = 0; |
| 2409 | svc->resize_set = 0; | ||
| 2408 | } | 2410 | } |
| 2409 | } | 2411 | } |
| 2410 | 2412 | ||
| @@ -56,6 +56,7 @@ void vp9_init_layer_context(VP9_COMP *const cpi) { · 55 unmodified lines | |||
| 56 | svc->num_encoded_top_layer = 0; | 56 | svc->num_encoded_top_layer = 0; |
| 57 | svc->simulcast_mode = 0; | 57 | svc->simulcast_mode = 0; |
| 58 | svc->single_layer_svc = 0; | 58 | svc->single_layer_svc = 0; |
| 59 | svc->resize_set = 0; | ||
| 59 | 60 | ||
| 60 | for (i = 0; i < REF_FRAMES; ++i) { | 61 | for (i = 0; i < REF_FRAMES; ++i) { |
| 61 | svc->fb_idx_spatial_layer_id[i] = 0xff; | 62 | svc->fb_idx_spatial_layer_id[i] = 0xff; |
| @@ -198,6 +198,7 @@ typedef struct SVC { · 197 unmodified lines | |||
| 198 | 198 | ||
| 199 | // Flag to indicate SVC is dynamically switched to a single layer. | 199 | // Flag to indicate SVC is dynamically switched to a single layer. |
| 200 | int single_layer_svc; | 200 | int single_layer_svc; |
| 201 | int resize_set; | ||
| 201 | } SVC; | 202 | } SVC; |
| 202 | 203 | ||
| 203 | struct VP9_COMP; | 204 | struct VP9_COMP; |