Update partition_cdf per frame. Move computing the partition_cdf tables per symbol to computing them only when the probabilities are updated. Change-Id: I442f9230ba00be7f5d0558d7c38d7324ad009ee8
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index dc03c92..4abc988 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c
@@ -406,6 +406,8 @@ fc->intra_ext_tx_cdf, EXT_TX_SIZES, TX_TYPES); av1_tree_to_cdf_1D(av1_ext_tx_tree, fc->inter_ext_tx_prob, fc->inter_ext_tx_cdf, EXT_TX_SIZES); + av1_tree_to_cdf_1D(av1_partition_tree, fc->partition_prob, fc->partition_cdf, + PARTITION_CONTEXTS); #endif } @@ -497,9 +499,14 @@ aom_tree_merge_probs(av1_intra_mode_tree, pre_fc->uv_mode_prob[i], counts->uv_mode[i], fc->uv_mode_prob[i]); - for (i = 0; i < PARTITION_CONTEXTS; i++) + for (i = 0; i < PARTITION_CONTEXTS; i++) { aom_tree_merge_probs(av1_partition_tree, pre_fc->partition_prob[i], counts->partition[i], fc->partition_prob[i]); +#if CONFIG_DAALA_EC + av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[i], + fc->partition_cdf[i]); +#endif + } #endif if (cm->interp_filter == SWITCHABLE) { @@ -584,9 +591,14 @@ aom_tree_merge_probs(av1_intra_mode_tree, pre_fc->uv_mode_prob[i], counts->uv_mode[i], fc->uv_mode_prob[i]); - for (i = 0; i < PARTITION_CONTEXTS; i++) + for (i = 0; i < PARTITION_CONTEXTS; i++) { aom_tree_merge_probs(av1_partition_tree, pre_fc->partition_prob[i], counts->partition[i], fc->partition_prob[i]); +#if CONFIG_DAALA_EC + av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[i], + fc->partition_cdf[i]); +#endif + } #endif }
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index 6ac4aff..2406518 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h
@@ -53,6 +53,9 @@ aom_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1]; aom_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1]; aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1]; +#if CONFIG_DAALA_EC + uint16_t partition_cdf[PARTITION_CONTEXTS][PARTITION_TYPES]; +#endif av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES]; #if CONFIG_RANS coeff_cdf_model coef_cdfs[TX_SIZES][PLANE_TYPES];
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 97760ac..02ab2ab 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -596,7 +596,12 @@ PARTITION_TYPE p; if (has_rows && has_cols) +#if CONFIG_DAALA_EC + p = (PARTITION_TYPE)aom_read_tree_cdf(r, cm->fc->partition_cdf[ctx], + PARTITION_TYPES); +#else p = (PARTITION_TYPE)aom_read_tree(r, av1_partition_tree, probs); +#endif else if (!has_rows && has_cols) p = aom_read(r, probs[1]) ? PARTITION_SPLIT : PARTITION_HORZ; else if (has_rows && !has_cols) @@ -1990,9 +1995,14 @@ for (i = 0; i < INTRA_MODES - 1; ++i) av1_diff_update_prob(&r, &fc->uv_mode_prob[j][i]); - for (j = 0; j < PARTITION_CONTEXTS; ++j) + for (j = 0; j < PARTITION_CONTEXTS; ++j) { for (i = 0; i < PARTITION_TYPES - 1; ++i) av1_diff_update_prob(&r, &fc->partition_prob[j][i]); +#if CONFIG_DAALA_EC + av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[j], + fc->partition_cdf[j]); +#endif + } #endif if (frame_is_intra_only(cm)) { @@ -2034,9 +2044,14 @@ av1_diff_update_prob(&r, &fc->y_mode_prob[j][i]); #if !CONFIG_MISC_FIXES - for (j = 0; j < PARTITION_CONTEXTS; ++j) + for (j = 0; j < PARTITION_CONTEXTS; ++j) { for (i = 0; i < PARTITION_TYPES - 1; ++i) av1_diff_update_prob(&r, &fc->partition_prob[j][i]); +#if CONFIG_DAALA_EC + av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[j], + fc->partition_cdf[j]); +#endif + } #endif #if CONFIG_REF_MV
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index 6ad40b5..f83a5a2 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -838,7 +838,11 @@ const int has_cols = (mi_col + hbs) < cm->mi_cols; if (has_rows && has_cols) { +#if CONFIG_DAALA_EC + aom_write_tree_cdf(w, p, cm->fc->partition_cdf[ctx], PARTITION_TYPES); +#else av1_write_token(w, av1_partition_tree, probs, &partition_encodings[p]); +#endif } else if (!has_rows && has_cols) { assert(p == PARTITION_SPLIT || p == PARTITION_HORZ); aom_write(w, p == PARTITION_SPLIT, probs[1]); @@ -1797,9 +1801,14 @@ prob_diff_update(av1_intra_mode_tree, fc->uv_mode_prob[i], counts->uv_mode[i], INTRA_MODES, header_bc); - for (i = 0; i < PARTITION_CONTEXTS; ++i) + for (i = 0; i < PARTITION_CONTEXTS; ++i) { prob_diff_update(av1_partition_tree, fc->partition_prob[i], counts->partition[i], PARTITION_TYPES, header_bc); +#if CONFIG_DAALA_EC + av1_tree_to_cdf(av1_partition_tree, cm->fc->partition_prob[i], + cm->fc->partition_cdf[i]); +#endif + } #endif if (frame_is_intra_only(cm)) { @@ -1879,9 +1888,14 @@ counts->y_mode[i], INTRA_MODES, header_bc); #if !CONFIG_MISC_FIXES - for (i = 0; i < PARTITION_CONTEXTS; ++i) + for (i = 0; i < PARTITION_CONTEXTS; ++i) { prob_diff_update(av1_partition_tree, fc->partition_prob[i], counts->partition[i], PARTITION_TYPES, header_bc); +#if CONFIG_DAALA_EC + av1_tree_to_cdf(av1_partition_tree, cm->fc->partition_prob[i], + cm->fc->partition_cdf[i]); +#endif + } #endif av1_write_nmv_probs(cm, cm->allow_high_precision_mv, header_bc,