Commit eaf1ffd8 authored by Marco's avatar Marco Committed by Gerrit Code Review

Merge "Fix to resize logic for 1 pass mode."

parents 2f66fdd3 dc7da005
......@@ -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,
......@@ -1827,9 +1829,11 @@ int vp9_resize_one_pass_cbr(VP9_COMP *cpi) {
if (cpi->resize_state == 0 &&
cpi->resize_buffer_underflow > (cpi->resize_count >> 2)) {
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment