Commit 769cd78f authored by Paul Wilkins's avatar Paul Wilkins
Browse files

Add speed feature for recode tolerance.

The new tolerance is a little higher than before (especially
for kf/gf/arf) so this change gives an encode speed up
for some clips up for speeds 0-2.

Change-Id: I63f7d6c9cc11c7f58742f41e250dcd3eab1741eb
parent 88690475
...@@ -587,6 +587,13 @@ static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer( ...@@ -587,6 +587,13 @@ static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer(
.buf; .buf;
} }
// Intra only frames, golden frames (except alt ref overlays) and
// alt ref frames tend to be coded at a higher than ambient quality
static INLINE int vp9_frame_is_boosted(const VP9_COMP *cpi) {
return frame_is_intra_only(&cpi->common) || cpi->refresh_alt_ref_frame ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref);
}
static INLINE int get_token_alloc(int mb_rows, int mb_cols) { static INLINE int get_token_alloc(int mb_rows, int mb_cols) {
// TODO(JBB): make this work for alpha channel and double check we can't // TODO(JBB): make this work for alpha channel and double check we can't
// exceed this token count if we have a 32x32 transform crossing a boundary // exceed this token count if we have a 32x32 transform crossing a boundary
......
...@@ -1005,28 +1005,14 @@ void vp9_rc_compute_frame_size_bounds(const VP9_COMP *cpi, ...@@ -1005,28 +1005,14 @@ void vp9_rc_compute_frame_size_bounds(const VP9_COMP *cpi,
*frame_under_shoot_limit = 0; *frame_under_shoot_limit = 0;
*frame_over_shoot_limit = INT_MAX; *frame_over_shoot_limit = INT_MAX;
} else { } else {
if (cpi->common.frame_type == KEY_FRAME) { int recode_tolerance =
*frame_over_shoot_limit = this_frame_target * 9 / 8; (cpi->sf.recode_tolerance * this_frame_target) / 100;
*frame_under_shoot_limit = this_frame_target * 7 / 8;
} else { *frame_over_shoot_limit = this_frame_target + recode_tolerance;
if (cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame) { *frame_under_shoot_limit = this_frame_target - recode_tolerance;
*frame_over_shoot_limit = this_frame_target * 9 / 8;
*frame_under_shoot_limit = this_frame_target * 7 / 8;
} else {
// Strong overshoot limit for constrained quality
if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) {
*frame_over_shoot_limit = this_frame_target * 11 / 8;
*frame_under_shoot_limit = this_frame_target * 2 / 8;
} else {
*frame_over_shoot_limit = this_frame_target * 11 / 8;
*frame_under_shoot_limit = this_frame_target * 5 / 8;
}
}
}
// For very small rate targets where the fractional adjustment // For very small rate targets where the fractional adjustment
// (eg * 7/8) may be tiny make sure there is at least a minimum // may be tiny make sure there is at least a minimum range.
// range.
*frame_over_shoot_limit += 200; *frame_over_shoot_limit += 200;
*frame_under_shoot_limit -= 200; *frame_under_shoot_limit -= 200;
if (*frame_under_shoot_limit < 0) if (*frame_under_shoot_limit < 0)
......
...@@ -25,13 +25,6 @@ ...@@ -25,13 +25,6 @@
#define DISABLE_COMPOUND_SPLIT 0x18 #define DISABLE_COMPOUND_SPLIT 0x18
#define LAST_AND_INTRA_SPLIT_ONLY 0x1E #define LAST_AND_INTRA_SPLIT_ONLY 0x1E
// Intra only frames, golden frames (except alt ref overlays) and
// alt ref frames tend to be coded at a higher than ambient quality
static INLINE int frame_is_boosted(const VP9_COMP *cpi) {
return frame_is_intra_only(&cpi->common) || cpi->refresh_alt_ref_frame ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref);
}
static void set_good_speed_feature(VP9_COMP *cpi, static void set_good_speed_feature(VP9_COMP *cpi,
VP9_COMMON *cm, VP9_COMMON *cm,
SPEED_FEATURES *sf, SPEED_FEATURES *sf,
...@@ -44,7 +37,7 @@ static void set_good_speed_feature(VP9_COMP *cpi, ...@@ -44,7 +37,7 @@ static void set_good_speed_feature(VP9_COMP *cpi,
if (speed >= 1) { if (speed >= 1) {
sf->use_square_partition_only = !frame_is_intra_only(cm); sf->use_square_partition_only = !frame_is_intra_only(cm);
sf->less_rectangular_check = 1; sf->less_rectangular_check = 1;
sf->tx_size_search_method = frame_is_boosted(cpi) sf->tx_size_search_method = vp9_frame_is_boosted(cpi)
? USE_FULL_RD : USE_LARGESTALL; ? USE_FULL_RD : USE_LARGESTALL;
if (MIN(cm->width, cm->height) >= 720) if (MIN(cm->width, cm->height) >= 720)
...@@ -68,7 +61,7 @@ static void set_good_speed_feature(VP9_COMP *cpi, ...@@ -68,7 +61,7 @@ static void set_good_speed_feature(VP9_COMP *cpi,
} }
// Additions or changes from speed 1 for speed >= 2. // Additions or changes from speed 1 for speed >= 2.
if (speed >= 2) { if (speed >= 2) {
sf->tx_size_search_method = frame_is_boosted(cpi) sf->tx_size_search_method = vp9_frame_is_boosted(cpi)
? USE_FULL_RD : USE_LARGESTALL; ? USE_FULL_RD : USE_LARGESTALL;
if (MIN(cm->width, cm->height) >= 720) if (MIN(cm->width, cm->height) >= 720)
...@@ -326,6 +319,9 @@ void vp9_set_speed_features(VP9_COMP *cpi) { ...@@ -326,6 +319,9 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
// to FIXED_PARTITION. // to FIXED_PARTITION.
sf->always_this_block_size = BLOCK_16X16; sf->always_this_block_size = BLOCK_16X16;
// Recode loop tolerence %.
sf->recode_tolerance = 25;
switch (cpi->oxcf.mode) { switch (cpi->oxcf.mode) {
case MODE_BESTQUALITY: case MODE_BESTQUALITY:
case MODE_SECONDPASS_BEST: // This is the best quality mode. case MODE_SECONDPASS_BEST: // This is the best quality mode.
......
...@@ -301,6 +301,10 @@ typedef struct { ...@@ -301,6 +301,10 @@ typedef struct {
// calculation in the rd coefficient costing loop. // calculation in the rd coefficient costing loop.
int use_fast_coef_costing; int use_fast_coef_costing;
// This feature controls the tolerence vs target used in deciding whether to
// recode a frame. It has no meaning if recode is disabled.
int recode_tolerance;
// This variable controls the maximum block size where intra blocks can be // This variable controls the maximum block size where intra blocks can be
// used in inter frames. // used in inter frames.
// TODO(aconverse): Fold this into one of the other many mode skips // TODO(aconverse): Fold this into one of the other many mode skips
......
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