From a59b23dd4aa9778f731863fcc1b1444395902a6c Mon Sep 17 00:00:00 2001 From: "Nathan E. Egge" Date: Wed, 16 Nov 2016 09:44:26 -0500 Subject: [PATCH] Use inter_mode_cdf with CONFIG_EC_MULTISYMBOL. Change-Id: I1cf27d2f029c1e985cafb468f60e7117d92593f5 --- av1/common/entropymode.c | 14 ++++++++------ av1/common/entropymode.h | 4 +++- av1/decoder/decodemv.c | 2 +- av1/decoder/decoder.c | 4 ++-- av1/encoder/bitstream.c | 4 +++- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index e34d0e7ec..f66d85413 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c @@ -585,8 +585,10 @@ static const aom_prob default_delta_q_probs[DELTA_Q_CONTEXTS] = { 220, 220, #endif int av1_intra_mode_ind[INTRA_MODES]; int av1_intra_mode_inv[INTRA_MODES]; +#if CONFIG_EC_MULTISYMBOL int av1_inter_mode_ind[INTER_MODES]; int av1_inter_mode_inv[INTER_MODES]; +#endif /* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */ #if CONFIG_ALT_INTRA @@ -1775,8 +1777,6 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { BLOCK_SIZE_GROUPS); av1_tree_to_cdf_1D(av1_intra_mode_tree, fc->uv_mode_prob, fc->uv_mode_cdf, INTRA_MODES); - av1_tree_to_cdf_1D(av1_inter_mode_tree, fc->inter_mode_probs, - fc->inter_mode_cdf, INTER_MODE_CONTEXTS); av1_tree_to_cdf_2D(av1_intra_mode_tree, av1_kf_y_mode_prob, av1_kf_y_mode_cdf, INTRA_MODES, INTRA_MODES); #endif @@ -1785,6 +1785,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { fc->switchable_interp_cdf, SWITCHABLE_FILTER_CONTEXTS); av1_tree_to_cdf_1D(av1_partition_tree, fc->partition_prob, fc->partition_cdf, PARTITION_CONTEXTS); + av1_tree_to_cdf_1D(av1_inter_mode_tree, fc->inter_mode_probs, + fc->inter_mode_cdf, INTER_MODE_CONTEXTS); #if !CONFIG_EXT_TX av1_tree_to_cdf_2D(av1_ext_tx_tree, fc->intra_ext_tx_prob, fc->intra_ext_tx_cdf, EXT_TX_SIZES, TX_TYPES); @@ -1818,6 +1820,10 @@ void av1_set_mode_cdfs(struct AV1Common *cm) { av1_tree_to_cdf(av1_switchable_interp_tree, fc->switchable_interp_prob[j], fc->switchable_interp_cdf[j]); + for (i = 0; i < INTER_MODE_CONTEXTS; ++i) + av1_tree_to_cdf(av1_inter_mode_tree, fc->inter_mode_probs[i], + fc->inter_mode_cdf[i]); + #if !CONFIG_EXT_TX for (i = TX_4X4; i < EXT_TX_SIZES; ++i) for (j = 0; j < TX_TYPES; ++j) @@ -1838,10 +1844,6 @@ void av1_set_mode_cdfs(struct AV1Common *cm) { av1_tree_to_cdf(av1_intra_mode_tree, cm->kf_y_prob[i][j], cm->kf_y_cdf[i][j]); - for (i = 0; i < INTER_MODE_CONTEXTS; ++i) - av1_tree_to_cdf(av1_inter_mode_tree, fc->inter_mode_probs[i], - fc->inter_mode_cdf[i]); - for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) av1_tree_to_cdf(av1_intra_mode_tree, fc->y_mode_prob[i], fc->y_mode_cdf[i]); diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index 7b22c52dd..9fce276ab 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h @@ -168,12 +168,12 @@ typedef struct frame_contexts { #if CONFIG_DAALA_EC aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][INTRA_MODES]; aom_cdf_prob uv_mode_cdf[INTRA_MODES][INTRA_MODES]; - aom_cdf_prob inter_mode_cdf[INTER_MODE_CONTEXTS][INTER_MODES]; #endif #if CONFIG_EC_MULTISYMBOL aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][PARTITION_TYPES]; aom_cdf_prob switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS] [SWITCHABLE_FILTERS]; + aom_cdf_prob inter_mode_cdf[INTER_MODE_CONTEXTS][INTER_MODES]; #if !CONFIG_EXT_TX aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][TX_TYPES]; aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES]; @@ -310,6 +310,8 @@ extern const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)]; #if CONFIG_DAALA_EC extern int av1_intra_mode_ind[INTRA_MODES]; extern int av1_intra_mode_inv[INTRA_MODES]; +#endif +#if CONFIG_EC_MULTISYMBOL extern int av1_inter_mode_ind[INTER_MODES]; extern int av1_inter_mode_inv[INTER_MODES]; #endif diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 0363ea22f..ed833f332 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c @@ -196,7 +196,7 @@ static PREDICTION_MODE read_inter_mode(AV1_COMMON *cm, MACROBLOCKD *xd, // Invalid prediction mode. assert(0); #else -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL const int mode = av1_inter_mode_inv[aom_read_symbol( r, cm->fc->inter_mode_cdf[ctx], INTER_MODES, ACCT_STR)]; #else diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c index a421ec14e..49c9e3249 100644 --- a/av1/decoder/decoder.c +++ b/av1/decoder/decoder.c @@ -53,8 +53,6 @@ static void initialize_dec(void) { #if CONFIG_DAALA_EC av1_indices_from_tree(av1_intra_mode_ind, av1_intra_mode_inv, INTRA_MODES, av1_intra_mode_tree); - av1_indices_from_tree(av1_inter_mode_ind, av1_inter_mode_inv, INTER_MODES, - av1_inter_mode_tree); #endif #if CONFIG_EC_MULTISYMBOL av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv, @@ -63,6 +61,8 @@ static void initialize_dec(void) { av1_indices_from_tree(av1_ext_tx_ind, av1_ext_tx_inv, TX_TYPES, av1_ext_tx_tree); #endif + av1_indices_from_tree(av1_inter_mode_ind, av1_inter_mode_inv, INTER_MODES, + av1_inter_mode_tree); #endif } } diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index 896e6d70a..f0244bbeb 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c @@ -197,6 +197,8 @@ void av1_encode_token_init(void) { #if CONFIG_DAALA_EC av1_indices_from_tree(av1_intra_mode_ind, av1_intra_mode_inv, INTRA_MODES, av1_intra_mode_tree); +#endif +#if CONFIG_EC_MULTISYMBOL av1_indices_from_tree(av1_inter_mode_ind, av1_inter_mode_inv, INTER_MODES, av1_inter_mode_tree); #endif @@ -262,7 +264,7 @@ static void write_inter_mode(AV1_COMMON *cm, aom_writer *w, } #else assert(is_inter_mode(mode)); -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL aom_write_symbol(w, av1_inter_mode_ind[INTER_OFFSET(mode)], cm->fc->inter_mode_cdf[mode_ctx], INTER_MODES); #else