From 525745b17ab832000c36b9823f6874ef657c187d Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Mon, 29 Jul 2013 17:06:18 -0700 Subject: [PATCH] Remove a redundant branching in tokenize_b The tokenize_b function is only called when output flag is on. Hence removing the conditional branch on it therein. Change-Id: Ib709f47f23f39ca05a695faf86fa3377f11f2dd0 --- vp9/encoder/vp9_tokenize.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index a6a867a..27831aa 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -95,7 +95,6 @@ struct tokenize_b_args { MACROBLOCKD *xd; TOKENEXTRA **tp; TX_SIZE tx_size; - int dry_run; }; static void set_entropy_context_b(int plane, int block, BLOCK_SIZE_TYPE bsize, @@ -126,9 +125,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize, VP9_COMP *cpi = args->cpi; MACROBLOCKD *xd = args->xd; TOKENEXTRA **tp = args->tp; - TX_SIZE tx_size = ss_txfrm_size / 2; - int dry_run = args->dry_run; - + TX_SIZE tx_size = ss_txfrm_size >> 1; MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi; int pt; /* near block/prev token context index */ int c = 0, rc = 0; @@ -218,11 +215,10 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize, assert(vp9_coef_encodings[t->token].len - t->skip_eob_node > 0); - if (!dry_run) { - ++counts[type][ref][band][pt][token]; - if (!t->skip_eob_node) - ++cpi->common.counts.eob_branch[tx_size][type][ref][band][pt]; - } + ++counts[type][ref][band][pt][token]; + if (!t->skip_eob_node) + ++cpi->common.counts.eob_branch[tx_size][type][ref][band][pt]; + token_cache[rc] = vp9_pt_energy_class[token]; ++t; } while (c < eob && ++c < seg_eob); @@ -276,7 +272,7 @@ void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run, const int mb_skip_context = vp9_get_pred_context_mbskip(xd); const int skip_inc = !vp9_segfeature_active(&xd->seg, mbmi->segment_id, SEG_LVL_SKIP); - struct tokenize_b_args arg = { cpi, xd, t, mbmi->txfm_size, dry_run }; + struct tokenize_b_args arg = {cpi, xd, t, mbmi->txfm_size}; mbmi->mb_skip_coeff = vp9_sb_is_skippable(xd, bsize); if (mbmi->mb_skip_coeff) { -- 2.7.4