Commit 656166ea authored by Jingning Han's avatar Jingning Han Committed by Gerrit Code Review
Browse files

Merge "Remove avoid_frame_with_high_error from RD loop"

parents 9e18cf70 393a8cce
......@@ -62,9 +62,6 @@ typedef struct {
// Bit flag for each mode whether it has high error in comparison to others.
unsigned int modes_with_high_error;
// Bit flag for each ref frame whether it has high error compared to others.
unsigned int frames_with_high_error;
} PICK_MODE_CONTEXT;
struct macroblock_plane {
......
......@@ -788,7 +788,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->use_lp32x32fdct = 0;
sf->adaptive_motion_search = 0;
sf->adaptive_pred_filter_type = 0;
sf->use_avoid_tested_higherror = 0;
sf->reference_masking = 0;
sf->use_one_partition_size_always = 0;
sf->less_rectangular_check = 0;
......@@ -834,7 +833,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
#else
sf->static_segmentation = 0;
#endif
sf->use_avoid_tested_higherror = 1;
sf->adaptive_rd_thresh = 1;
sf->recode_loop = (speed < 1);
......
......@@ -252,7 +252,6 @@ typedef struct {
LAST_FRAME_PARTITION_METHOD use_lastframe_partitioning;
TX_SIZE_SEARCH_METHOD tx_size_search_method;
int use_lp32x32fdct;
int use_avoid_tested_higherror;
int use_one_partition_size_always;
int less_rectangular_check;
int use_square_partition_only;
......
......@@ -3144,7 +3144,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS];
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
MB_MODE_INFO best_mbmode = { 0 };
int j;
int mode_index, best_mode_index = 0;
unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES];
vp9_prob comp_mode_p;
......@@ -3157,10 +3156,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
int64_t dist_uv[TX_SIZES];
int skip_uv[TX_SIZES];
MB_PREDICTION_MODE mode_uv[TX_SIZES];
unsigned int ref_frame_mask = 0;
unsigned int mode_mask = 0;
int64_t mode_distortions[MB_MODE_COUNT] = {-1};
int64_t frame_distortions[MAX_REF_FRAMES] = {-1};
int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q);
const int bws = num_8x8_blocks_wide_lookup[bsize] / 2;
const int bhs = num_8x8_blocks_high_lookup[bsize] / 2;
......@@ -3169,7 +3165,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH;
// Everywhere the flag is set the error is much higher than its neighbors.
ctx->frames_with_high_error = 0;
ctx->modes_with_high_error = 0;
estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp,
......@@ -3188,39 +3183,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
*returnrate = INT_MAX;
// Create a mask set to 1 for each reference frame used by a smaller
// resolution.
if (cpi->sf.use_avoid_tested_higherror) {
switch (block_size) {
case BLOCK_64X64:
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
ref_frame_mask |= x->mb_context[i][j].frames_with_high_error;
mode_mask |= x->mb_context[i][j].modes_with_high_error;
}
}
for (i = 0; i < 4; i++) {
ref_frame_mask |= x->sb32_context[i].frames_with_high_error;
mode_mask |= x->sb32_context[i].modes_with_high_error;
}
break;
case BLOCK_32X32:
for (i = 0; i < 4; i++) {
ref_frame_mask |=
x->mb_context[x->sb_index][i].frames_with_high_error;
mode_mask |= x->mb_context[x->sb_index][i].modes_with_high_error;
}
break;
default:
// Until we handle all block sizes set it to present;
ref_frame_mask = 0;
mode_mask = 0;
break;
}
ref_frame_mask = ~ref_frame_mask;
mode_mask = ~mode_mask;
}
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
x->pred_mv_sad[ref_frame] = INT_MAX;
if (cpi->ref_frame_flags & flag_list[ref_frame]) {
......@@ -3303,19 +3265,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (x->fast_ms > 2 && ref_frame != x->subblock_ref)
continue;
if (cpi->sf.use_avoid_tested_higherror && bsize >= BLOCK_8X8) {
if (!(ref_frame_mask & (1 << ref_frame))) {
continue;
}
if (!(mode_mask & (1 << this_mode))) {
continue;
}
if (second_ref_frame != NONE
&& !(ref_frame_mask & (1 << second_ref_frame))) {
continue;
}
}
mbmi->ref_frame[0] = ref_frame;
mbmi->ref_frame[1] = second_ref_frame;
......@@ -3564,10 +3513,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
|| distortion2 < mode_distortions[this_mode]) {
mode_distortions[this_mode] = distortion2;
}
if (frame_distortions[ref_frame] == -1
|| distortion2 < frame_distortions[ref_frame]) {
frame_distortions[ref_frame] = distortion2;
}
// Did this mode help.. i.e. is it the new best mode
if (this_rd < best_rd || x->skip) {
......@@ -3720,14 +3665,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
}
// Flag all ref frames that have a distortion thats > 2x the best we found at
// this level.
for (ref_frame = INTRA_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
if (frame_distortions[ref_frame] > 2 * *returndistortion) {
ctx->frames_with_high_error |= (1 << ref_frame);
}
}
assert((cm->mcomp_filter_type == SWITCHABLE) ||
(cm->mcomp_filter_type == best_mbmode.interp_filter) ||
!is_inter_block(&best_mbmode));
......
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