diff options
Diffstat (limited to 'vp9/encoder/vp9_pickmode.c')
-rw-r--r-- | vp9/encoder/vp9_pickmode.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 28f12916e..1943fdb28 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -453,7 +453,7 @@ static void estimate_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, } static const THR_MODES mode_idx[MAX_REF_FRAMES][4] = { - {THR_DC, THR_H_PRED, THR_V_PRED}, + {THR_DC, THR_H_PRED, THR_V_PRED, THR_TM}, {THR_NEARESTMV, THR_NEARMV, THR_ZEROMV, THR_NEWMV}, {THR_NEARESTG, THR_NEARG, THR_ZEROG, THR_NEWG}, {THR_NEARESTA, THR_NEARA, THR_ZEROA, THR_NEWA}, @@ -517,8 +517,9 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, PRED_BUFFER *best_pred = NULL; PRED_BUFFER *this_mode_pred = NULL; const int pixels_in_block = bh * bw; + int reuse_inter_pred = cpi->sf.reuse_inter_pred_sby && ctx->pred_pixel_ready; - if (cpi->sf.reuse_inter_pred_sby) { + if (reuse_inter_pred) { int i; for (i = 0; i < 3; i++) { #if CONFIG_VP9_HIGHBITDEPTH @@ -605,6 +606,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) { int rate_mv = 0; int mode_rd_thresh; + int mode_index = mode_idx[ref_frame][INTER_OFFSET(this_mode)]; if (const_motion[ref_frame] && this_mode == NEARMV) continue; @@ -612,10 +614,9 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode))) continue; - mode_rd_thresh = - rd_threshes[mode_idx[ref_frame][INTER_OFFSET(this_mode)]]; + mode_rd_thresh = rd_threshes[mode_index]; if (rd_less_than_thresh(best_rdc.rdcost, mode_rd_thresh, - rd_thresh_freq_fact[this_mode])) + rd_thresh_freq_fact[mode_index])) continue; if (this_mode == NEWMV) { @@ -641,7 +642,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, // Search for the best prediction filter type, when the resulting // motion vector is at sub-pixel accuracy level for luma component, i.e., // the last three bits are all zeros. - if (cpi->sf.reuse_inter_pred_sby) { + if (reuse_inter_pred) { if (!this_mode_pred) { this_mode_pred = &tmp[3]; } else { @@ -679,7 +680,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, best_cost = cost; skip_txfm = x->skip_txfm[0]; - if (cpi->sf.reuse_inter_pred_sby) { + if (reuse_inter_pred) { if (this_mode_pred != current_pred) { free_pred_buffer(this_mode_pred); this_mode_pred = current_pred; @@ -694,7 +695,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, } } - if (cpi->sf.reuse_inter_pred_sby && this_mode_pred != current_pred) + if (reuse_inter_pred && this_mode_pred != current_pred) free_pred_buffer(current_pred); mbmi->interp_filter = best_filter; @@ -746,13 +747,12 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, best_ref_frame = ref_frame; skip_txfm = x->skip_txfm[0]; - if (cpi->sf.reuse_inter_pred_sby) { + if (reuse_inter_pred) { free_pred_buffer(best_pred); - best_pred = this_mode_pred; } } else { - if (cpi->sf.reuse_inter_pred_sby) + if (reuse_inter_pred) free_pred_buffer(this_mode_pred); } @@ -766,7 +766,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, // If best prediction is not in dst buf, then copy the prediction block from // temp buf to dst buf. - if (best_pred != NULL && cpi->sf.reuse_inter_pred_sby && + if (best_pred != NULL && reuse_inter_pred && best_pred->data != orig_dst.buf) { pd->dst = orig_dst; #if CONFIG_VP9_HIGHBITDEPTH @@ -801,7 +801,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, MIN(max_txsize_lookup[bsize], tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); - if (cpi->sf.reuse_inter_pred_sby) { + if (reuse_inter_pred) { pd->dst.buf = tmp[0].data; pd->dst.stride = bw; } @@ -833,16 +833,18 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, x->skip_txfm[0] = skip_txfm; } } - if (cpi->sf.reuse_inter_pred_sby) + if (reuse_inter_pred) pd->dst = orig_dst; } if (is_inter_block(mbmi)) - vp9_update_rd_thresh_fact(cpi, tile_data, bsize, - mode_idx[ref_frame][INTER_OFFSET(mbmi->mode)]); + vp9_update_rd_thresh_fact(tile_data->thresh_freq_fact, + cpi->sf.adaptive_rd_thresh, bsize, + mode_idx[best_ref_frame][INTER_OFFSET(mbmi->mode)]); else - vp9_update_rd_thresh_fact(cpi, tile_data, bsize, - mode_idx[ref_frame][mbmi->mode]); + vp9_update_rd_thresh_fact(tile_data->thresh_freq_fact, + cpi->sf.adaptive_rd_thresh, bsize, + mode_idx[INTRA_FRAME][mbmi->mode]); *rd_cost = best_rdc; } |