From 784596d5f119d53c158c530949fee61582726545 Mon Sep 17 00:00:00 2001 From: Sarah Parker Date: Fri, 23 Jun 2017 08:41:26 -0700 Subject: [PATCH] Remove redundant checks in read/write_tx_type Change-Id: I348dfd1f8b555306a3fb625bf2303f9cd2649e07 --- av1/decoder/decodemv.c | 25 ++++++++++++------------- av1/encoder/bitstream.c | 21 ++++++++++----------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 0d65d6213..9ccdc8d40 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c @@ -932,23 +932,22 @@ void av1_read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd, !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { const int eset = get_ext_tx_set(tx_size, mbmi->sb_type, inter_block, cm->reduced_tx_set_used); + // eset == 0 should correspond to a set with only DCT_DCT and + // there is no need to read the tx_type + assert(eset != 0); FRAME_COUNTS *counts = xd->counts; if (inter_block) { - if (eset > 0) { - *tx_type = av1_ext_tx_inter_inv[eset][aom_read_symbol( - r, ec_ctx->inter_ext_tx_cdf[eset][square_tx_size], - ext_tx_cnt_inter[eset], ACCT_STR)]; - if (counts) ++counts->inter_ext_tx[eset][square_tx_size][*tx_type]; - } + *tx_type = av1_ext_tx_inter_inv[eset][aom_read_symbol( + r, ec_ctx->inter_ext_tx_cdf[eset][square_tx_size], + ext_tx_cnt_inter[eset], ACCT_STR)]; + if (counts) ++counts->inter_ext_tx[eset][square_tx_size][*tx_type]; } else if (ALLOW_INTRA_EXT_TX) { - if (eset > 0) { - *tx_type = av1_ext_tx_intra_inv[eset][aom_read_symbol( - r, ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode], - ext_tx_cnt_intra[eset], ACCT_STR)]; - if (counts) - ++counts->intra_ext_tx[eset][square_tx_size][mbmi->mode][*tx_type]; - } + *tx_type = av1_ext_tx_intra_inv[eset][aom_read_symbol( + r, ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode], + ext_tx_cnt_intra[eset], ACCT_STR)]; + if (counts) + ++counts->intra_ext_tx[eset][square_tx_size][mbmi->mode][*tx_type]; } } else { *tx_type = DCT_DCT; diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index f6c093be5..7a6fbb871 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c @@ -1757,21 +1757,20 @@ void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd, !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { const int eset = get_ext_tx_set(tx_size, bsize, is_inter, cm->reduced_tx_set_used); + // eset == 0 should correspond to a set with only DCT_DCT and there + // is no need to send the tx_type + assert(eset > 0); if (is_inter) { assert(ext_tx_used_inter[eset][tx_type]); - if (eset > 0) { - aom_write_symbol(w, av1_ext_tx_inter_ind[eset][tx_type], - ec_ctx->inter_ext_tx_cdf[eset][square_tx_size], - ext_tx_cnt_inter[eset]); - } + aom_write_symbol(w, av1_ext_tx_inter_ind[eset][tx_type], + ec_ctx->inter_ext_tx_cdf[eset][square_tx_size], + ext_tx_cnt_inter[eset]); } else if (ALLOW_INTRA_EXT_TX) { assert(ext_tx_used_intra[eset][tx_type]); - if (eset > 0) { - aom_write_symbol( - w, av1_ext_tx_intra_ind[eset][tx_type], - ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode], - ext_tx_cnt_intra[eset]); - } + aom_write_symbol( + w, av1_ext_tx_intra_ind[eset][tx_type], + ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode], + ext_tx_cnt_intra[eset]); } } #else -- GitLab