Commit 94649bc0 authored by Jim Bankoski's avatar Jim Bankoski
Browse files

set up a speed 1

slightly worse results for faster encodes

Change-Id: Ic5b38fcde7a2e334c4724e125b558bcb97783af6
parent 7f7d1357
......@@ -290,7 +290,6 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
} else {
cpi->rd_threshes[i] = INT_MAX;
}
cpi->rd_baseline_thresh[i] = cpi->rd_threshes[i];
}
} else {
......@@ -302,7 +301,6 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
} else {
cpi->rd_threshes[i] = INT_MAX;
}
cpi->rd_baseline_thresh[i] = cpi->rd_threshes[i];
}
}
......@@ -4319,6 +4317,7 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
yv12_mb[mbmi->ref_frame].y_height != cm->mb_rows * 16) &&
this_mode != ZEROMV)
continue;
if (mbmi->second_ref_frame > 0 &&
(yv12_mb[mbmi->second_ref_frame].y_width != cm->mb_cols * 16 ||
yv12_mb[mbmi->second_ref_frame].y_height != cm->mb_rows * 16) &&
......@@ -5204,6 +5203,7 @@ static int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
int64_t best_pred_diff[NB_PREDICTION_TYPES];
int64_t best_pred_rd[NB_PREDICTION_TYPES];
MB_MODE_INFO best_mbmode;
int j;
int mode_index, best_mode_index = 0;
unsigned int ref_costs[MAX_REF_FRAMES];
#if CONFIG_COMP_INTERINTRA_PRED
......@@ -5225,6 +5225,8 @@ static int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
int dist_uv_16x16 = 0, uv_skip_16x16 = 0;
MB_PREDICTION_MODE mode_uv_16x16 = NEARESTMV;
struct scale_factors scale_factor[4];
unsigned int ref_frame_mask = 0;
unsigned int mode_mask = 0;
xd->mode_info_context->mbmi.segment_id = segment_id;
estimate_ref_frame_costs(cpi, segment_id, ref_costs);
......@@ -5235,58 +5237,87 @@ static int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
for (i = 0; i < NB_TXFM_MODES; i++)
best_txfm_rd[i] = INT64_MAX;
// Create a mask set to 1 for each frame used by a smaller resolution.p
if (cpi->Speed > 0) {
switch (block_size) {
case BLOCK_64X64:
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
ref_frame_mask |= (1 << x->mb_context[i][j].mic.mbmi.ref_frame);
mode_mask |= (1 << x->mb_context[i][j].mic.mbmi.mode);
}
}
for (i = 0; i < 4; i++) {
ref_frame_mask |= (1 << x->sb32_context[i].mic.mbmi.ref_frame);
mode_mask |= (1 << x->sb32_context[i].mic.mbmi.mode);
}
break;
case BLOCK_32X32:
for (i = 0; i < 4; i++) {
ref_frame_mask |= (1
<< x->mb_context[xd->sb_index][i].mic.mbmi.ref_frame);
mode_mask |= (1 << x->mb_context[xd->sb_index][i].mic.mbmi.mode);
}
break;
}
}
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
if (cpi->ref_frame_flags & flag_list[ref_frame]) {
setup_buffer_inter(cpi, x, idx_list[ref_frame], ref_frame, block_size,
mb_row, mb_col, frame_mv[NEARESTMV],
frame_mv[NEARMV], frame_mdcounts,
yv12_mb, scale_factor);
mb_row, mb_col, frame_mv[NEARESTMV], frame_mv[NEARMV],
frame_mdcounts, yv12_mb, scale_factor);
}
frame_mv[NEWMV][ref_frame].as_int = INVALID_MV;
frame_mv[ZEROMV][ref_frame].as_int = 0;
}
if (block_size == BLOCK_64X64) {
mbmi->mode = DC_PRED;
if (cm->txfm_mode == ONLY_4X4 || cm->txfm_mode == TX_MODE_SELECT) {
mbmi->txfm_size = TX_4X4;
rd_pick_intra_sb64uv_mode(cpi, x, &rate_uv_4x4, &rate_uv_tokenonly_4x4,
// Disallow intra if none of the smaller prediction sizes used intra and
// speed > 0 ;
if (cpi->Speed == 0
|| ( cpi->Speed > 0 && (ref_frame_mask & (1 << INTRA_FRAME)))) {
if (block_size == BLOCK_64X64) {
mbmi->mode = DC_PRED;
if (cm->txfm_mode == ONLY_4X4 || cm->txfm_mode == TX_MODE_SELECT) {
mbmi->txfm_size = TX_4X4;
rd_pick_intra_sb64uv_mode(cpi, x, &rate_uv_4x4, &rate_uv_tokenonly_4x4,
&dist_uv_4x4, &uv_skip_4x4);
mode_uv_4x4 = mbmi->uv_mode;
}
if (cm->txfm_mode != ONLY_4X4) {
mbmi->txfm_size = TX_8X8;
rd_pick_intra_sb64uv_mode(cpi, x, &rate_uv_8x8, &rate_uv_tokenonly_8x8,
&dist_uv_8x8, &uv_skip_8x8);
mode_uv_8x8 = mbmi->uv_mode;
}
if (cm->txfm_mode >= ALLOW_32X32) {
mbmi->txfm_size = TX_32X32;
rd_pick_intra_sb64uv_mode(cpi, x, &rate_uv_16x16,
&rate_uv_tokenonly_16x16, &dist_uv_16x16,
&uv_skip_16x16);
mode_uv_16x16 = mbmi->uv_mode;
}
} else {
assert(block_size == BLOCK_32X32);
mbmi->mode = DC_PRED;
if (cm->txfm_mode == ONLY_4X4 || cm->txfm_mode == TX_MODE_SELECT) {
mbmi->txfm_size = TX_4X4;
rd_pick_intra_sbuv_mode(cpi, x, &rate_uv_4x4, &rate_uv_tokenonly_4x4,
&dist_uv_4x4, &uv_skip_4x4);
mode_uv_4x4 = mbmi->uv_mode;
}
if (cm->txfm_mode != ONLY_4X4) {
mbmi->txfm_size = TX_8X8;
rd_pick_intra_sb64uv_mode(cpi, x, &rate_uv_8x8, &rate_uv_tokenonly_8x8,
mode_uv_4x4 = mbmi->uv_mode;
}
if (cm->txfm_mode != ONLY_4X4) {
mbmi->txfm_size = TX_8X8;
rd_pick_intra_sbuv_mode(cpi, x, &rate_uv_8x8, &rate_uv_tokenonly_8x8,
&dist_uv_8x8, &uv_skip_8x8);
mode_uv_8x8 = mbmi->uv_mode;
}
if (cm->txfm_mode >= ALLOW_32X32) {
mbmi->txfm_size = TX_32X32;
rd_pick_intra_sb64uv_mode(cpi, x, &rate_uv_16x16,
&rate_uv_tokenonly_16x16,
&dist_uv_16x16, &uv_skip_16x16);
mode_uv_16x16 = mbmi->uv_mode;
}
} else {
assert(block_size == BLOCK_32X32);
mbmi->mode = DC_PRED;
if (cm->txfm_mode == ONLY_4X4 || cm->txfm_mode == TX_MODE_SELECT) {
mbmi->txfm_size = TX_4X4;
rd_pick_intra_sbuv_mode(cpi, x, &rate_uv_4x4, &rate_uv_tokenonly_4x4,
&dist_uv_4x4, &uv_skip_4x4);
mode_uv_4x4 = mbmi->uv_mode;
}
if (cm->txfm_mode != ONLY_4X4) {
mbmi->txfm_size = TX_8X8;
rd_pick_intra_sbuv_mode(cpi, x, &rate_uv_8x8, &rate_uv_tokenonly_8x8,
&dist_uv_8x8, &uv_skip_8x8);
mode_uv_8x8 = mbmi->uv_mode;
}
if (cm->txfm_mode >= ALLOW_32X32) {
mbmi->txfm_size = TX_32X32;
rd_pick_intra_sbuv_mode(cpi, x, &rate_uv_16x16, &rate_uv_tokenonly_16x16,
&dist_uv_16x16, &uv_skip_16x16);
mode_uv_16x16 = mbmi->uv_mode;
mode_uv_8x8 = mbmi->uv_mode;
}
if (cm->txfm_mode >= ALLOW_32X32) {
mbmi->txfm_size = TX_32X32;
rd_pick_intra_sbuv_mode(cpi, x, &rate_uv_16x16,
&rate_uv_tokenonly_16x16, &dist_uv_16x16,
&uv_skip_16x16);
mode_uv_16x16 = mbmi->uv_mode;
}
}
}
......@@ -5313,10 +5344,21 @@ static int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
x->skip = 0;
this_mode = vp9_mode_order[mode_index].mode;
ref_frame = vp9_mode_order[mode_index].ref_frame;
if (!(ref_frame == INTRA_FRAME ||
(cpi->ref_frame_flags & flag_list[ref_frame]))) {
if (!(ref_frame == INTRA_FRAME
|| (cpi->ref_frame_flags & flag_list[ref_frame]))) {
continue;
}
if (cpi->Speed > 0) {
if (!(ref_frame_mask & (1 << ref_frame))) {
continue;
}
if (vp9_mode_order[mode_index].second_ref_frame != NONE
&& !(ref_frame_mask
& (1 << vp9_mode_order[mode_index].second_ref_frame))) {
continue;
}
}
mbmi->ref_frame = ref_frame;
mbmi->second_ref_frame = vp9_mode_order[mode_index].second_ref_frame;
set_scale_factors(xd, mbmi->ref_frame, mbmi->second_ref_frame,
......
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