ref: dc42f343ae4365d68a096498ecdd8a960414905a
parent: bf7a02a4cf0ed7f34c92fc3f974d94487cf44c02
author: paulwilkins <[email protected]>
date: Fri Aug 26 07:43:47 EDT 2016
Add ALLOW_RECODE_FIRST speed mode. This patch is to address concerns that changes to allow recodes on the first frame in each ARF group do not give a good enough speed quality trade off for speed 2. Though the average impact on encode speed is 1-2%, for some hard clips it is > 5% rise. For speed 1 this is less an issue and for Speed 0 the previous patch actually improves speed. Change-Id: Ie1bcefdbfdf846d3f4428590173f621465dffe3a
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2418,8 +2418,9 @@
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 || two_pass_first_group_inter(cpi)) &&
- (cpi->sf.recode_loop == ALLOW_RECODE_KFARFGF))) {
+ (two_pass_first_group_inter(cpi) &&
+ (cpi->sf.recode_loop == ALLOW_RECODE_FIRST)) ||
+ (frame_is_kfgfarf && (cpi->sf.recode_loop >= ALLOW_RECODE_KFARFGF))) {
if (frame_is_kfgfarf && (oxcf->resize_mode == RESIZE_DYNAMIC) &&
scale_down(cpi, q)) {
// Code this group at a lower resolution.
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -169,7 +169,6 @@
sf->mode_skip_start = 10;
sf->adaptive_pred_interp_filter = 1;
- sf->recode_loop = ALLOW_RECODE_KFARFGF;
sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
@@ -179,6 +178,7 @@
}
if (speed >= 2) {
+ sf->recode_loop = ALLOW_RECODE_KFARFGF;
sf->tx_size_search_method =
frame_is_boosted(cpi) ? USE_FULL_RD : USE_LARGESTALL;
@@ -528,7 +528,7 @@
// best quality defaults
sf->frame_parameter_update = 1;
sf->mv.search_method = NSTEP;
- sf->recode_loop = ALLOW_RECODE_KFARFGF;
+ sf->recode_loop = ALLOW_RECODE_FIRST;
sf->mv.subpel_search_method = SUBPEL_TREE;
sf->mv.subpel_iters_per_step = 2;
sf->mv.subpel_force_stop = 0;
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -67,8 +67,10 @@
ALLOW_RECODE_KFMAXBW = 1,
// Allow recode only for KF/ARF/GF frames.
ALLOW_RECODE_KFARFGF = 2,
+ // Allow recode for ARF/GF/KF and first normal frame in each group.
+ ALLOW_RECODE_FIRST = 3,
// Allow recode for all frames based on bitrate constraints.
- ALLOW_RECODE = 3,
+ ALLOW_RECODE = 4,
} RECODE_LOOP_TYPE;
typedef enum {