Fix to resize logic for 1 pass mode.
Proper use/update of resize_state and resize_pending to constrain the total amount of downsizing to be at most one scale down, for now. Change-Id: Id18fc32499f2fbdbec16728dcdc9e4eac09098f0
This commit is contained in:
parent
fa94dbda81
commit
dc7da005d7
@ -3061,17 +3061,17 @@ static void set_frame_size(VP9_COMP *cpi) {
|
||||
oxcf->rc_mode == VPX_CBR &&
|
||||
!cpi->use_svc &&
|
||||
oxcf->resize_mode == RESIZE_DYNAMIC) {
|
||||
if (cpi->resize_state == 1) {
|
||||
if (cpi->resize_pending == 1) {
|
||||
oxcf->scaled_frame_width =
|
||||
(cm->width * cpi->resize_scale_num) / cpi->resize_scale_den;
|
||||
oxcf->scaled_frame_height =
|
||||
(cm->height * cpi->resize_scale_num) /cpi->resize_scale_den;
|
||||
} else if (cpi->resize_state == -1) {
|
||||
} else if (cpi->resize_pending == -1) {
|
||||
// Go back up to original size.
|
||||
oxcf->scaled_frame_width = oxcf->width;
|
||||
oxcf->scaled_frame_height = oxcf->height;
|
||||
}
|
||||
if (cpi->resize_state != 0) {
|
||||
if (cpi->resize_pending != 0) {
|
||||
// There has been a change in frame size.
|
||||
vp9_set_size_literal(cpi,
|
||||
oxcf->scaled_frame_width,
|
||||
|
@ -1355,9 +1355,11 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
|
||||
}
|
||||
|
||||
// Trigger the resizing of the next frame if it is scaled.
|
||||
cpi->resize_pending =
|
||||
rc->next_frame_size_selector != rc->frame_size_selector;
|
||||
rc->frame_size_selector = rc->next_frame_size_selector;
|
||||
if (oxcf->pass != 0) {
|
||||
cpi->resize_pending =
|
||||
rc->next_frame_size_selector != rc->frame_size_selector;
|
||||
rc->frame_size_selector = rc->next_frame_size_selector;
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_rc_postencode_update_drop_frame(VP9_COMP *cpi) {
|
||||
@ -1632,9 +1634,9 @@ void vp9_rc_get_one_pass_cbr_params(VP9_COMP *cpi) {
|
||||
|
||||
vp9_rc_set_frame_target(cpi, target);
|
||||
if (cpi->oxcf.resize_mode == RESIZE_DYNAMIC)
|
||||
cpi->resize_state = vp9_resize_one_pass_cbr(cpi);
|
||||
cpi->resize_pending = vp9_resize_one_pass_cbr(cpi);
|
||||
else
|
||||
cpi->resize_state = 0;
|
||||
cpi->resize_pending = 0;
|
||||
}
|
||||
|
||||
int vp9_compute_qdelta(const RATE_CONTROL *rc, double qstart, double qtarget,
|
||||
@ -1826,9 +1828,11 @@ int vp9_resize_one_pass_cbr(VP9_COMP *cpi) {
|
||||
if (cpi->resize_state == 0 &&
|
||||
cpi->resize_buffer_underflow > (cpi->resize_count >> 3)) {
|
||||
resize_now = 1;
|
||||
cpi->resize_state = 1;
|
||||
} else if (cpi->resize_state == 1 &&
|
||||
avg_qp < 40 * cpi->rc.worst_quality / 100) {
|
||||
resize_now = -1;
|
||||
cpi->resize_state = 0;
|
||||
}
|
||||
// Reset for next window measurement.
|
||||
cpi->resize_avg_qp = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user