diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index 3a6b3c34324cc538a9118dab659e7154bc17e2a4..d16f4f72b239ff2310c8f7f3a6761a4ea29a49a7 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c @@ -1411,6 +1411,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { av1_copy(fc->switchable_restore_prob, default_switchable_restore_prob); #endif // CONFIG_LOOP_RESTORATION #if CONFIG_DAALA_EC + av1_tree_to_cdf_1D(av1_intra_mode_tree, fc->y_mode_prob, fc->y_mode_cdf, + BLOCK_SIZE_GROUPS); av1_tree_to_cdf_1D(av1_switchable_interp_tree, fc->switchable_interp_prob, fc->switchable_interp_cdf, SWITCHABLE_FILTER_CONTEXTS); av1_tree_to_cdf_2D(av1_ext_tx_tree, fc->intra_ext_tx_prob, diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index f889c561eb88cca08329561c70d544a421de63fd..11bf124cfbcdb82d43d381966eb4f4f51d17ccc9 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h @@ -165,6 +165,7 @@ typedef struct frame_contexts { aom_prob switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1]; #endif // CONFIG_LOOP_RESTORATION #if CONFIG_DAALA_EC + aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][INTRA_MODES]; aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][PARTITION_TYPES]; aom_cdf_prob switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS] [SWITCHABLE_FILTERS]; diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index b579934979140e718d5638fd0b0eeebf224f5ed5..060c79cdd10e88d5f2bf68642e8181849f761ca2 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c @@ -3817,9 +3817,14 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data, read_frame_reference_mode_probs(cm, &r); - for (j = 0; j < BLOCK_SIZE_GROUPS; j++) + for (j = 0; j < BLOCK_SIZE_GROUPS; j++) { for (i = 0; i < INTRA_MODES - 1; ++i) av1_diff_update_prob(&r, &fc->y_mode_prob[j][i], ACCT_STR); +#if CONFIG_DAALA_EC + av1_tree_to_cdf(av1_intra_mode_tree, fc->y_mode_prob[j], + fc->y_mode_cdf[j]); +#endif + } #if CONFIG_REF_MV for (i = 0; i < NMV_CONTEXTS; ++i) diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 68eb482b6a6fb2ca7addaf1c44c9e37ff34257de..9d8bb5ca9cb976ec2054f4467823dda459a4ca0b 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c @@ -91,7 +91,11 @@ static int read_delta_qindex(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r, static PREDICTION_MODE read_intra_mode_y(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r, int size_group) { const PREDICTION_MODE y_mode = +#if CONFIG_DAALA_EC + read_intra_mode_cdf(r, cm->fc->y_mode_cdf[size_group]); +#else read_intra_mode(r, cm->fc->y_mode_prob[size_group]); +#endif FRAME_COUNTS *counts = xd->counts; if (counts) ++counts->y_mode[size_group][y_mode]; return y_mode; diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index 70f7e7b4bcb22b6af8b1e5c15258406d81f9a541..e8b5d50b0f43c27bd1326f11e3fb5a79210d787f 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c @@ -1235,7 +1235,13 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi, if (!is_inter) { if (bsize >= BLOCK_8X8) { +#if CONFIG_DAALA_EC + aom_write_symbol(w, av1_intra_mode_ind[mode], + cm->fc->y_mode_cdf[size_group_lookup[bsize]], + INTRA_MODES); +#else write_intra_mode(w, mode, cm->fc->y_mode_prob[size_group_lookup[bsize]]); +#endif } else { int idx, idy; const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; @@ -1243,7 +1249,12 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi, for (idy = 0; idy < 2; idy += num_4x4_h) { for (idx = 0; idx < 2; idx += num_4x4_w) { const PREDICTION_MODE b_mode = mi->bmi[idy * 2 + idx].as_mode; +#if CONFIG_DAALA_EC + aom_write_symbol(w, av1_intra_mode_ind[b_mode], cm->fc->y_mode_cdf[0], + INTRA_MODES); +#else write_intra_mode(w, b_mode, cm->fc->y_mode_prob[0]); +#endif } } } @@ -3734,9 +3745,14 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) { } } - for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) + for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) { prob_diff_update(av1_intra_mode_tree, cm->fc->y_mode_prob[i], counts->y_mode[i], INTRA_MODES, header_bc); +#if CONFIG_DAALA_EC + av1_tree_to_cdf(av1_intra_mode_tree, cm->fc->y_mode_prob[i], + cm->fc->y_mode_cdf[i]); +#endif + } av1_write_nmv_probs(cm, cm->allow_high_precision_mv, header_bc, #if CONFIG_REF_MV