Force recode for bad rate misses.

Adds a second threshold for recodes even on frames where
recode is normally disabled if there is a big rate miss.

Change-Id: Ifd4a34707da55ec15eb7cfb87de4644b8d76deb2
This commit is contained in:
Paul Wilkins
2016-03-15 12:54:52 -07:00
parent ee35f4dede
commit 9d8ead125d

View File

@@ -2722,6 +2722,13 @@ static int scale_down(VP9_COMP *cpi, int q) {
return scale;
}
static int big_rate_miss(VP9_COMP *cpi, int high_limit, int low_limit) {
const RATE_CONTROL *const rc = &cpi->rc;
return (rc->projected_frame_size > ((high_limit * 3) / 2)) ||
(rc->projected_frame_size < (low_limit / 2));
}
// Function to test for conditions that indicate we should loop
// back and recode a frame.
static int recode_loop_test(VP9_COMP *cpi,
@@ -2733,6 +2740,7 @@ static int recode_loop_test(VP9_COMP *cpi,
int force_recode = 0;
if ((rc->projected_frame_size >= rc->max_frame_bandwidth) ||
big_rate_miss(cpi, high_limit, low_limit) ||
(cpi->sf.recode_loop == ALLOW_RECODE) ||
(frame_is_kfgfarf &&
(cpi->sf.recode_loop == ALLOW_RECODE_KFARFGF))) {