From 10ba2bedf0d32d94e896794681ceffad3c730709 Mon Sep 17 00:00:00 2001 From: "Nathan E. Egge" Date: Wed, 16 Nov 2016 09:44:26 -0500 Subject: [PATCH] Use kf_y_mode_cdf with CONFIG_EC_MULTISYMBOL. Change-Id: Ic0eba16329d7b63dd7d18e9cd28b89be4b5f2710 --- av1/common/entropymode.c | 16 ++++++++-------- av1/common/entropymode.h | 2 +- av1/common/onyxc_int.h | 4 ++-- av1/decoder/decodeframe.c | 2 +- av1/decoder/decodemv.c | 31 ++++++++++++++++--------------- av1/encoder/bitstream.c | 6 +++--- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index 6e3c3dee7..54ffa05c6 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c @@ -16,7 +16,7 @@ #include "av1/common/onyxc_int.h" #include "av1/common/seg_common.h" -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][INTRA_MODES]; #endif @@ -1775,8 +1775,6 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { #if CONFIG_DAALA_EC av1_tree_to_cdf_1D(av1_intra_mode_tree, fc->uv_mode_prob, fc->uv_mode_cdf, INTRA_MODES); - 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_intra_mode_tree, fc->y_mode_prob, fc->y_mode_cdf, @@ -1793,6 +1791,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { av1_tree_to_cdf_1D(av1_ext_tx_tree, fc->inter_ext_tx_prob, fc->inter_ext_tx_cdf, EXT_TX_SIZES); #endif + av1_tree_to_cdf_2D(av1_intra_mode_tree, av1_kf_y_mode_prob, av1_kf_y_mode_cdf, + INTRA_MODES, INTRA_MODES); av1_tree_to_cdf(av1_segment_tree, fc->seg.tree_probs, fc->seg.tree_cdf); #endif #if CONFIG_DELTA_Q @@ -1816,6 +1816,11 @@ void av1_set_mode_cdfs(struct AV1Common *cm) { av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[i], fc->partition_cdf[i]); + for (i = 0; i < INTRA_MODES; ++i) + for (j = 0; j < INTRA_MODES; ++j) + 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]); @@ -1842,11 +1847,6 @@ void av1_set_mode_cdfs(struct AV1Common *cm) { av1_tree_to_cdf(av1_intra_mode_tree, fc->uv_mode_prob[i], fc->uv_mode_cdf[i]); - for (i = 0; i < INTRA_MODES; ++i) - for (j = 0; j < INTRA_MODES; ++j) - av1_tree_to_cdf(av1_intra_mode_tree, cm->kf_y_prob[i][j], - cm->kf_y_cdf[i][j]); - #endif } #endif diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index 9dd248f6e..13fa0a939 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h @@ -286,7 +286,7 @@ typedef struct FRAME_COUNTS { extern const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES] [INTRA_MODES - 1]; -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL extern aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][INTRA_MODES]; #endif #if CONFIG_PALETTE diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h index fcf269497..4d88c2c25 100644 --- a/av1/common/onyxc_int.h +++ b/av1/common/onyxc_int.h @@ -393,7 +393,7 @@ typedef struct AV1Common { // - this is intentionally not placed in FRAME_CONTEXT since it's reset upon // each keyframe and not used afterwards aom_prob kf_y_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1]; -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL aom_cdf_prob kf_y_cdf[INTRA_MODES][INTRA_MODES][INTRA_MODES]; #endif #if CONFIG_GLOBAL_MOTION @@ -626,7 +626,7 @@ static INLINE const aom_prob *get_y_mode_probs(const AV1_COMMON *cm, return cm->kf_y_prob[above][left]; } -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL static INLINE aom_cdf_prob *get_y_mode_cdf(AV1_COMMON *cm, const MODE_INFO *mi, const MODE_INFO *above_mi, const MODE_INFO *left_mi, diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index ddd1e8d73..4ccdd6b82 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c @@ -4259,7 +4259,7 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data, if (frame_is_intra_only(cm)) { av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob); -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL av1_copy(cm->kf_y_cdf, av1_kf_y_mode_cdf); #endif #if !CONFIG_EC_ADAPT diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index fa84b921e..a6fa370d9 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c @@ -812,18 +812,19 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm, #if CONFIG_CB4X4 (void)i; mbmi->mode = -#if CONFIG_DAALA_EC - read_intra_mode(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 0)); +#if CONFIG_EC_MULTISYMBOL + read_intra_mode_cdf(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 0)); #else read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0)); -#endif // CONFIG_DAALA_EC +#endif #else switch (bsize) { case BLOCK_4X4: for (i = 0; i < 4; ++i) mi->bmi[i].as_mode = -#if CONFIG_DAALA_EC - read_intra_mode(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, i)); +#if CONFIG_EC_MULTISYMBOL + read_intra_mode_cdf(r, + get_y_mode_cdf(cm, mi, above_mi, left_mi, i)); #else read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, i)); #endif @@ -831,36 +832,36 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm, break; case BLOCK_4X8: mi->bmi[0].as_mode = mi->bmi[2].as_mode = -#if CONFIG_DAALA_EC - read_intra_mode(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 0)); +#if CONFIG_EC_MULTISYMBOL + read_intra_mode_cdf(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 0)); #else read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0)); #endif mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode = -#if CONFIG_DAALA_EC - read_intra_mode(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 1)); +#if CONFIG_EC_MULTISYMBOL + read_intra_mode_cdf(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 1)); #else read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 1)); #endif break; case BLOCK_8X4: mi->bmi[0].as_mode = mi->bmi[1].as_mode = -#if CONFIG_DAALA_EC - read_intra_mode(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 0)); +#if CONFIG_EC_MULTISYMBOL + read_intra_mode_cdf(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 0)); #else read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0)); #endif mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode = -#if CONFIG_DAALA_EC - read_intra_mode(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 2)); +#if CONFIG_EC_MULTISYMBOL + read_intra_mode_cdf(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 2)); #else read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 2)); #endif break; default: mbmi->mode = -#if CONFIG_DAALA_EC - read_intra_mode(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 0)); +#if CONFIG_EC_MULTISYMBOL + read_intra_mode_cdf(r, get_y_mode_cdf(cm, mi, above_mi, left_mi, 0)); #else read_intra_mode(r, get_y_mode_probs(cm, mi, above_mi, left_mi, 0)); #endif diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index 7ab738343..361299683 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c @@ -1699,7 +1699,7 @@ static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd, write_selected_tx_size(cm, xd, w); if (bsize >= BLOCK_8X8 || unify_bsize) { -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL aom_write_symbol(w, av1_intra_mode_ind[mbmi->mode], get_y_mode_cdf(cm, mi, above_mi, left_mi, 0), INTRA_MODES); #else @@ -1714,7 +1714,7 @@ static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd, for (idy = 0; idy < 2; idy += num_4x4_h) { for (idx = 0; idx < 2; idx += num_4x4_w) { const int block = idy * 2 + idx; -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL aom_write_symbol(w, av1_intra_mode_ind[mi->bmi[block].as_mode], get_y_mode_cdf(cm, mi, above_mi, left_mi, block), INTRA_MODES); @@ -4238,7 +4238,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) { #endif // CONFIG_EC_ADAPT, CONFIG_DAALA_EC if (frame_is_intra_only(cm)) { av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob); -#if CONFIG_DAALA_EC +#if CONFIG_EC_MULTISYMBOL av1_copy(cm->kf_y_cdf, av1_kf_y_mode_cdf); #endif