Commit 645cb98e authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Cleaning up calc_active_worst_quality_one_pass_vbr().

Change-Id: Ibfccee5e35c235c02843e1c1fbd3c39034619cf5
parent bf4e4e36
...@@ -462,33 +462,25 @@ static int get_active_quality(int q, int gfu_boost, int low, int high, ...@@ -462,33 +462,25 @@ static int get_active_quality(int q, int gfu_boost, int low, int high,
} }
static int calc_active_worst_quality_one_pass_vbr(const VP9_COMP *cpi) { static int calc_active_worst_quality_one_pass_vbr(const VP9_COMP *cpi) {
const RATE_CONTROL *const rc = &cpi->rc;
const unsigned int curr_frame = cpi->common.current_video_frame;
int active_worst_quality; int active_worst_quality;
if (cpi->common.frame_type == KEY_FRAME) { if (cpi->common.frame_type == KEY_FRAME) {
if (cpi->common.current_video_frame == 0) { active_worst_quality = curr_frame == 0 ? rc->worst_quality
active_worst_quality = cpi->rc.worst_quality; : rc->last_q[KEY_FRAME] * 2;
} else {
// Choose active worst quality twice as large as the last q.
active_worst_quality = cpi->rc.last_q[KEY_FRAME] * 2;
}
} else if (!cpi->rc.is_src_frame_alt_ref &&
(cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
if (cpi->common.current_video_frame == 1) {
active_worst_quality = cpi->rc.last_q[KEY_FRAME] * 5 / 4;
} else {
// Choose active worst quality twice as large as the last q.
active_worst_quality = cpi->rc.last_q[INTER_FRAME];
}
} else { } else {
if (cpi->common.current_video_frame == 1) { if (!rc->is_src_frame_alt_ref &&
active_worst_quality = cpi->rc.last_q[KEY_FRAME] * 2; (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
active_worst_quality = curr_frame == 1 ? rc->last_q[KEY_FRAME] * 5 / 4
: rc->last_q[INTER_FRAME];
} else { } else {
// Choose active worst quality twice as large as the last q. active_worst_quality = curr_frame == 1 ? rc->last_q[KEY_FRAME] * 2
active_worst_quality = cpi->rc.last_q[INTER_FRAME] * 2; : rc->last_q[INTER_FRAME] * 2;
} }
} }
if (active_worst_quality > cpi->rc.worst_quality)
active_worst_quality = cpi->rc.worst_quality; return MIN(active_worst_quality, rc->worst_quality);
return active_worst_quality;
} }
// Adjust active_worst_quality level based on buffer level. // Adjust active_worst_quality level based on buffer level.
......
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