From 6eb2cacf0d24a216c183fd0c5e34cdf98df5d9bd Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Tue, 25 Mar 2014 14:27:45 -0700 Subject: [PATCH] Added a speed feature "allow_skip_recode" This commit added a speed feature to make the logic of calculating skip_recode on a block level more explicit. This also enable the feature to be enabled at speed 5 where the previous logic is too conservative, help gain back the lost speed for --rt(-5). Change-Id: Ieb37ca3e85c2e7bda343486edf13d5f5395f2233 --- vp9/encoder/vp9_encodeframe.c | 8 +++----- vp9/encoder/vp9_onyx_if.c | 11 ++++++++--- vp9/encoder/vp9_onyx_int.h | 3 +++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 100162883..5837313c0 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -3454,11 +3454,9 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled, const int mi_height = num_8x8_blocks_high_lookup[bsize]; x->skip_recode = !x->select_txfm_size && mbmi->sb_type >= BLOCK_8X8 && - (cpi->oxcf.aq_mode != COMPLEXITY_AQ && - cpi->oxcf.aq_mode != CYCLIC_REFRESH_AQ) && - !cpi->sf.use_nonrd_pick_mode && - !cpi->sf.use_uv_intra_rd_estimate && - !cpi->sf.skip_encode_sb; + cpi->oxcf.aq_mode != COMPLEXITY_AQ && + cpi->oxcf.aq_mode != CYCLIC_REFRESH_AQ && + cpi->sf.allow_skip_recode; x->skip_optimize = ctx->is_coded; ctx->is_coded = 1; diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 4564c4b88..253c45515 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -574,6 +574,7 @@ static void set_good_speed_feature(VP9_COMMON *cm, int i; sf->adaptive_rd_thresh = 1; sf->recode_loop = ((speed < 1) ? ALLOW_RECODE : ALLOW_RECODE_KFMAXBW); + sf->allow_skip_recode = 1; if (speed == 1) { sf->use_square_partition_only = !frame_is_intra_only(cm); sf->less_rectangular_check = 1; @@ -585,7 +586,6 @@ static void set_good_speed_feature(VP9_COMMON *cm, DISABLE_ALL_SPLIT : DISABLE_ALL_INTER_SPLIT; else sf->disable_split_mask = DISABLE_COMPOUND_SPLIT; - sf->use_rd_breakout = 1; sf->adaptive_motion_search = 1; sf->adaptive_pred_interp_filter = 1; @@ -617,7 +617,6 @@ static void set_good_speed_feature(VP9_COMMON *cm, sf->adaptive_pred_interp_filter = 2; sf->reference_masking = 1; sf->auto_mv_step_size = 1; - sf->disable_filter_search_var_thresh = 50; sf->comp_inter_joint_search_thresh = BLOCK_SIZES; @@ -663,9 +662,9 @@ static void set_good_speed_feature(VP9_COMMON *cm, sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; sf->adjust_partitioning_from_last_frame = 1; sf->last_partitioning_redo_frequency = 3; - sf->use_uv_intra_rd_estimate = 1; sf->skip_encode_sb = 1; + sf->allow_skip_recode = 0; sf->use_lp32x32fdct = 1; sf->subpel_iters_per_step = 1; sf->use_fast_coef_updates = 2; @@ -703,6 +702,7 @@ static void set_good_speed_feature(VP9_COMMON *cm, sf->use_uv_intra_rd_estimate = 1; sf->skip_encode_sb = 1; + sf->allow_skip_recode = 0; sf->use_lp32x32fdct = 1; sf->subpel_iters_per_step = 1; sf->use_fast_coef_updates = 2; @@ -741,6 +741,7 @@ static void set_good_speed_feature(VP9_COMMON *cm, sf->use_fast_coef_costing = 1; sf->adaptive_rd_thresh = 4; sf->mode_skip_start = 6; + sf->allow_skip_recode = 1; } } @@ -833,6 +834,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm, sf->adaptive_rd_thresh = 4; sf->mode_skip_start = 6; sf->encode_breakout_thresh = 400; + sf->allow_skip_recode = 0; } if (speed >= 4) { sf->optimize_coefficients = 0; @@ -863,6 +865,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm, sf->disable_inter_mode_mask[BLOCK_64X32] = ~(1 << INTER_OFFSET(NEARESTMV)); sf->disable_inter_mode_mask[BLOCK_64X64] = ~(1 << INTER_OFFSET(NEARESTMV)); sf->max_intra_bsize = BLOCK_32X32; + sf->allow_skip_recode = 1; } if (speed >= 6) { sf->max_partition_size = BLOCK_32X32; @@ -872,6 +875,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm, sf->partition_search_type = REFERENCE_PARTITION; sf->use_nonrd_pick_mode = 1; sf->search_method = FAST_DIAMOND; + sf->allow_skip_recode = 0; } if (speed >= 7) { sf->partition_search_type = VAR_BASED_FIXED_PARTITION; @@ -938,6 +942,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) { sf->use_rd_breakout = 0; sf->skip_encode_sb = 0; sf->use_uv_intra_rd_estimate = 0; + sf->allow_skip_recode = 0; sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE; sf->use_fast_coef_updates = 0; sf->use_fast_coef_costing = 0; diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index 022a63f91..6d8235c01 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -284,6 +284,9 @@ typedef struct { // blocks and the q is less than a threshold. int skip_encode_sb; int skip_encode_frame; + // Speed feature to allow or disallow skipping of recode at block + // level within a frame. + int allow_skip_recode; // This variable allows us to reuse the last frames partition choices // (64x64 v 32x32 etc) for this frame. It can be set to only use the last