From b6a41802c410969113c17856238afd88f462c507 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Wed, 13 Aug 2014 10:43:43 -0700 Subject: Simplify select_tx_mode() The function is called only once, right after all stats counters are reset to 0. Therefore all the computations have zero effect on return values. This commmit to removed those effectless code. Change-Id: I50d27c0802547921fa36c60aa4bd92d76247f595 --- vp9/encoder/vp9_encodeframe.c | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'vp9/encoder/vp9_encodeframe.c') diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index b20b662f3..c6bc2c205 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -2581,35 +2581,17 @@ static MV_REFERENCE_FRAME get_frame_type(const VP9_COMP *cpi) { } static TX_MODE select_tx_mode(const VP9_COMP *cpi) { - if (cpi->mb.e_mbd.lossless) { + if (cpi->mb.e_mbd.lossless) return ONLY_4X4; - } else if (cpi->common.current_video_frame == 0) { + if (cpi->common.current_video_frame == 0) return TX_MODE_SELECT; - } else { - if (cpi->sf.tx_size_search_method == USE_LARGESTALL) { - return ALLOW_32X32; - } else if (cpi->sf.tx_size_search_method == USE_FULL_RD) { - const RD_OPT *const rd_opt = &cpi->rd; - const MV_REFERENCE_FRAME frame_type = get_frame_type(cpi); - return rd_opt->tx_select_threshes[frame_type][ALLOW_32X32] > - rd_opt->tx_select_threshes[frame_type][TX_MODE_SELECT] ? - ALLOW_32X32 : TX_MODE_SELECT; - } else if (cpi->sf.tx_size_search_method == USE_TX_8X8) { - return TX_MODE_SELECT; - } else { - unsigned int total = 0; - int i; - for (i = 0; i < TX_SIZES; ++i) - total += cpi->tx_stepdown_count[i]; - - if (total) { - const double fraction = (double)cpi->tx_stepdown_count[0] / total; - return fraction > 0.90 ? ALLOW_32X32 : TX_MODE_SELECT; - } else { - return cpi->common.tx_mode; - } - } - } + if (cpi->sf.tx_size_search_method == USE_LARGESTALL) + return ALLOW_32X32; + else if (cpi->sf.tx_size_search_method == USE_FULL_RD|| + cpi->sf.tx_size_search_method == USE_TX_8X8) + return TX_MODE_SELECT; + else + return cpi->common.tx_mode; } static void nonrd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile, -- cgit v1.2.3