ref: 32eb8c795546015bdd77688d9a63e5e07d5f5f76
parent: 8b8606a7374026d561a2c9596df772b5854e3654
parent: 769cd78ff25c8461d37ef9b3e8901395114d9d8e
author: Paul Wilkins <paulwilkins@google.com>
date: Wed Apr 2 08:22:33 EDT 2014
Merge "Add speed feature for recode tolerance."
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -587,6 +587,13 @@
.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) {
// 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
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1002,28 +1002,14 @@
*frame_under_shoot_limit = 0;
*frame_over_shoot_limit = INT_MAX;
} else {
- if (cpi->common.frame_type == KEY_FRAME) {
- *frame_over_shoot_limit = this_frame_target * 9 / 8;
- *frame_under_shoot_limit = this_frame_target * 7 / 8;
- } else {
- if (cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame) {
- *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;
- }
- }
- }
+ int recode_tolerance =
+ (cpi->sf.recode_tolerance * this_frame_target) / 100;
+ *frame_over_shoot_limit = this_frame_target + recode_tolerance;
+ *frame_under_shoot_limit = this_frame_target - recode_tolerance;
+
// For very small rate targets where the fractional adjustment
- // (eg * 7/8) may be tiny make sure there is at least a minimum
- // range.
+ // may be tiny make sure there is at least a minimum range.
*frame_over_shoot_limit += 200;
*frame_under_shoot_limit -= 200;
if (*frame_under_shoot_limit < 0)
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -25,13 +25,6 @@
#define DISABLE_COMPOUND_SPLIT 0x18
#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,
VP9_COMMON *cm,
SPEED_FEATURES *sf,
@@ -44,7 +37,7 @@
if (speed >= 1) {
sf->use_square_partition_only = !frame_is_intra_only(cm);
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;
if (MIN(cm->width, cm->height) >= 720)
@@ -68,7 +61,7 @@
}
// Additions or changes from speed 1 for 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;
if (MIN(cm->width, cm->height) >= 720)
@@ -325,6 +318,9 @@
// This setting only takes effect when partition_search_type is set
// to FIXED_PARTITION.
sf->always_this_block_size = BLOCK_16X16;
+
+ // Recode loop tolerence %.
+ sf->recode_tolerance = 25;
switch (cpi->oxcf.mode) {
case MODE_BESTQUALITY:
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -301,6 +301,10 @@
// calculation in the rd coefficient costing loop.
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
// used in inter frames.
// TODO(aconverse): Fold this into one of the other many mode skips
--
⑨