From 00b3331ee8db2bbb015ff54a76fe28cb53617802 Mon Sep 17 00:00:00 2001 From: "Nathan E. Egge" Date: Wed, 16 Nov 2016 09:44:26 -0500 Subject: [PATCH] Use switchable_interp_cdf with CONFIG_EC_MULTISYMBOL. Change-Id: I3f7eeff102fc30e2cef59c2c07df94826587d100 --- av1/common/entropymode.c | 16 +++++++--------- av1/common/entropymode.h | 9 ++++----- av1/decoder/decodemv.c | 4 ++-- av1/decoder/decoder.c | 4 ++-- av1/encoder/bitstream.c | 2 +- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index d980cf2d4..e34d0e7ec 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c @@ -1775,14 +1775,14 @@ 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_switchable_interp_tree, fc->switchable_interp_prob, - fc->switchable_interp_cdf, SWITCHABLE_FILTER_CONTEXTS); 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 #if CONFIG_EC_MULTISYMBOL + av1_tree_to_cdf_1D(av1_switchable_interp_tree, fc->switchable_interp_prob, + fc->switchable_interp_cdf, SWITCHABLE_FILTER_CONTEXTS); av1_tree_to_cdf_1D(av1_partition_tree, fc->partition_prob, fc->partition_cdf, PARTITION_CONTEXTS); #if !CONFIG_EXT_TX @@ -1798,12 +1798,10 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { #endif } -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL int av1_switchable_interp_ind[SWITCHABLE_FILTERS]; int av1_switchable_interp_inv[SWITCHABLE_FILTERS]; -#endif -#if CONFIG_EC_MULTISYMBOL void av1_set_mode_cdfs(struct AV1Common *cm) { FRAME_CONTEXT *fc = cm->fc; int i, j; @@ -1816,6 +1814,10 @@ void av1_set_mode_cdfs(struct AV1Common *cm) { av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[i], fc->partition_cdf[i]); + for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j) + av1_tree_to_cdf(av1_switchable_interp_tree, fc->switchable_interp_prob[j], + fc->switchable_interp_cdf[j]); + #if !CONFIG_EXT_TX for (i = TX_4X4; i < EXT_TX_SIZES; ++i) for (j = 0; j < TX_TYPES; ++j) @@ -1836,10 +1838,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 (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j) - 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]); diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index 35505c640..7b22c52dd 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 switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS] - [SWITCHABLE_FILTERS]; 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]; #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]; @@ -358,11 +358,10 @@ extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)]; extern const aom_tree_index av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)]; #endif // CONFIG_LOOP_RESTORATION -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS]; extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS]; -#endif -#if CONFIG_EC_MULTISYMBOL + void av1_set_mode_cdfs(struct AV1Common *cm); #endif diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 5a082c0a8..0363ea22f 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c @@ -1082,7 +1082,7 @@ static INLINE void read_mb_interp_filter(AV1_COMMON *const cm, if (has_subpel_mv_component(xd->mi[0], xd, dir) || (mbmi->ref_frame[1] > INTRA_FRAME && has_subpel_mv_component(xd->mi[0], xd, dir + 2))) { -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL mbmi->interp_filter[dir] = (InterpFilter)av1_switchable_interp_inv[aom_read_symbol( r, cm->fc->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS, @@ -1112,7 +1112,7 @@ static INLINE void read_mb_interp_filter(AV1_COMMON *const cm, mbmi->interp_filter = cm->interp_filter; } else { const int ctx = av1_get_pred_context_switchable_interp(xd); -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL mbmi->interp_filter = (InterpFilter)av1_switchable_interp_inv[aom_read_symbol( r, cm->fc->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS, diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c index f497f164c..a421ec14e 100644 --- a/av1/decoder/decoder.c +++ b/av1/decoder/decoder.c @@ -51,14 +51,14 @@ static void initialize_dec(void) { #endif // CONFIG_EXT_INTER init_done = 1; #if CONFIG_DAALA_EC - av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv, - SWITCHABLE_FILTERS, av1_switchable_interp_tree); 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, + SWITCHABLE_FILTERS, av1_switchable_interp_tree); #if !CONFIG_EXT_TX av1_indices_from_tree(av1_ext_tx_ind, av1_ext_tx_inv, TX_TYPES, av1_ext_tx_tree); diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index 60e2fbf87..896e6d70a 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c @@ -1111,7 +1111,7 @@ static void write_mb_interp_filter(AV1_COMP *cpi, const MACROBLOCKD *xd, #else { const int ctx = av1_get_pred_context_switchable_interp(xd); -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL aom_write_symbol(w, av1_switchable_interp_ind[mbmi->interp_filter], cm->fc->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS); #else