Merge "Enable skipping reference frame check in rd loop"

This commit is contained in:
Jingning Han 2014-01-10 16:00:56 -08:00 committed by Gerrit Code Review
commit 4f969ccc1b
3 changed files with 29 additions and 21 deletions

View File

@ -1923,9 +1923,6 @@ static void encode_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
vp9_zero(cpi->mb.pred_mv);
if (cpi->sf.reference_masking)
rd_pick_reference_frame(cpi, tile, mi_row, mi_col);
if (cpi->sf.use_lastframe_partitioning ||
cpi->sf.use_one_partition_size_always ) {
const int idx_str = cm->mode_info_stride * mi_row + mi_col;

View File

@ -789,6 +789,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->use_rd_breakout = 1;
sf->adaptive_motion_search = 1;
sf->adaptive_pred_filter_type = 2;
sf->reference_masking = 1;
sf->auto_mv_step_size = 1;
sf->disable_filter_search_var_thresh = 50;
@ -825,6 +826,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->use_rd_breakout = 1;
sf->adaptive_motion_search = 1;
sf->adaptive_pred_filter_type = 2;
sf->reference_masking = 1;
sf->auto_mv_step_size = 1;
sf->disable_filter_search_var_thresh = 100;
@ -859,6 +861,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->use_rd_breakout = 1;
sf->adaptive_motion_search = 1;
sf->adaptive_pred_filter_type = 2;
sf->reference_masking = 1;
sf->auto_mv_step_size = 1;
sf->disable_filter_search_var_thresh = 200;

View File

@ -3175,7 +3175,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
*returnrate = INT_MAX;
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
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]) {
setup_buffer_inter(cpi, x, tile, get_ref_frame_idx(cpi, ref_frame),
@ -3186,6 +3186,18 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
frame_mv[ZEROMV][ref_frame].as_int = 0;
}
cpi->ref_frame_mask = 0;
for (ref_frame = LAST_FRAME;
ref_frame <= ALTREF_FRAME && cpi->sf.reference_masking; ++ref_frame) {
int i;
for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) {
if ((x->pred_mv_sad[ref_frame] >> 2) > x->pred_mv_sad[i]) {
cpi->ref_frame_mask |= (1 << ref_frame);
break;
}
}
}
for (mode_index = 0; mode_index < MAX_MODES; ++mode_index) {
int mode_excluded = 0;
int64_t this_rd = INT64_MAX;
@ -3235,8 +3247,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
// Skip if the current reference frame has been masked off
if (cpi->sf.reference_masking && !cpi->set_ref_frame_mask &&
(cpi->ref_frame_mask & (1 << ref_frame)))
if (cpi->ref_frame_mask & (1 << ref_frame) && this_mode != NEWMV)
continue;
// Test best rd so far against threshold for trying this mode.
@ -3641,11 +3652,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
}
// If we are using reference masking and the set mask flag is set then
// create the reference frame mask.
if (cpi->sf.reference_masking && cpi->set_ref_frame_mask)
cpi->ref_frame_mask = ~(1 << vp9_mode_order[best_mode_index].ref_frame[0]);
// Flag all modes that have a distortion thats > 2x the best we found at
// this level.
for (mode_index = 0; mode_index < MB_MODE_COUNT; ++mode_index) {
@ -3806,6 +3812,18 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
frame_mv[ZEROMV][ref_frame].as_int = 0;
}
cpi->ref_frame_mask = 0;
for (ref_frame = LAST_FRAME;
ref_frame <= ALTREF_FRAME && cpi->sf.reference_masking; ++ref_frame) {
int i;
for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) {
if ((x->pred_mv_sad[ref_frame] >> 1) > x->pred_mv_sad[i]) {
cpi->ref_frame_mask |= (1 << ref_frame);
break;
}
}
}
for (mode_index = 0; mode_index < MAX_REFS; ++mode_index) {
int mode_excluded = 0;
int64_t this_rd = INT64_MAX;
@ -3853,11 +3871,6 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
continue;
}
// Skip if the current reference frame has been masked off
if (cpi->sf.reference_masking && !cpi->set_ref_frame_mask &&
(cpi->ref_frame_mask & (1 << ref_frame)))
continue;
// Test best rd so far against threshold for trying this mode.
if ((best_rd <
((int64_t)cpi->rd_thresh_sub8x8[segment_id][bsize][mode_index] *
@ -4367,11 +4380,6 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
}
}
// If we are using reference masking and the set mask flag is set then
// create the reference frame mask.
if (cpi->sf.reference_masking && cpi->set_ref_frame_mask)
cpi->ref_frame_mask = ~(1 << vp9_ref_order[best_mode_index].ref_frame[0]);
if (best_rd == INT64_MAX && bsize < BLOCK_8X8) {
*returnrate = INT_MAX;
*returndistortion = INT_MAX;