History

vp9-svc: Fix to setting frame size for dynamic resize

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.

Marco Paniconi committed 6 years ago

Commit cd0aca91 parent f0ccdb14 files · +15 −7Browse files

Unified · Split

4 files
  1. vp9/encoder/vp9_encoder.c +11 −7
  2. vp9/encoder/vp9_ratectrl.c +2 −0
  3. vp9/encoder/vp9_svc_layercontext.c +1 −0
  4. vp9/encoder/vp9_svc_layercontext.h +1 −0
vp9/encoder/vp9_encoder.c+11−7
@@ -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);
vp9/encoder/vp9_ratectrl.c+2−0
@@ -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
vp9/encoder/vp9_svc_layercontext.c+1−0
@@ -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;
vp9/encoder/vp9_svc_layercontext.h+1−0
@@ -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
203struct VP9_COMP;204struct VP9_COMP;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t