From: Jingning Han Date: Fri, 31 Oct 2014 15:55:28 +0000 (-0700) Subject: Merge "Refactor vp9_update_rd_thresh_fact" X-Git-Tag: v1.4.0~547 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61966b1d10821cd4e1f6e0368aef46d827be162e;p=libvpx Merge "Refactor vp9_update_rd_thresh_fact" --- 61966b1d10821cd4e1f6e0368aef46d827be162e diff --cc vp9/encoder/vp9_rd.c index 13e317d6d,fa8482ff6..2f19d2942 --- a/vp9/encoder/vp9_rd.c +++ b/vp9/encoder/vp9_rd.c @@@ -594,21 -594,26 +594,20 @@@ void vp9_set_rd_speed_thresholds_sub8x8 const SPEED_FEATURES *const sf = &cpi->sf; RD_OPT *const rd = &cpi->rd; int i; - - for (i = 0; i < MAX_REFS; ++i) - rd->thresh_mult_sub8x8[i] = cpi->oxcf.mode == BEST ? -500 : 0; - - rd->thresh_mult_sub8x8[THR_LAST] += 2500; - rd->thresh_mult_sub8x8[THR_GOLD] += 2500; - rd->thresh_mult_sub8x8[THR_ALTR] += 2500; - rd->thresh_mult_sub8x8[THR_INTRA] += 2500; - rd->thresh_mult_sub8x8[THR_COMP_LA] += 4500; - rd->thresh_mult_sub8x8[THR_COMP_GA] += 4500; - - // Check for masked out split cases. - for (i = 0; i < MAX_REFS; ++i) - if (sf->disable_split_mask & (1 << i)) - rd->thresh_mult_sub8x8[i] = INT_MAX; + static const int thresh_mult[2][MAX_REFS] = + {{2500, 2500, 2500, 4500, 4500, 2500}, + {2000, 2000, 2000, 4000, 4000, 2000}}; + + for (i = 0; i < MAX_REFS; ++i) { + rd->thresh_mult_sub8x8[i] = + (sf->disable_split_mask & (1 << i)) ? + INT_MAX : thresh_mult[cpi->oxcf.mode == BEST][i]; + } } - // TODO(jingning) Refactor this function. Use targeted smaller struct as inputs. - void vp9_update_rd_thresh_fact(VP9_COMP *cpi, TileDataEnc *tile_data, + void vp9_update_rd_thresh_fact(int (*factor_buf)[MAX_MODES], int rd_thresh, int bsize, int best_mode_index) { - if (cpi->sf.adaptive_rd_thresh > 0) { + if (rd_thresh > 0) { const int top_mode = bsize < BLOCK_8X8 ? MAX_REFS : MAX_MODES; int mode; for (mode = 0; mode < top_mode; ++mode) {