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 60fe1a7..157f00f 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -1390,6 +1390,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
}
@@ -1628,9 +1630,14 @@
aom_tree_merge_probs(av1_ext_partition_tree, pre_fc->partition_prob[i],
counts->partition[i], fc->partition_prob[i]);
#else
- 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 // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_EXT_INTRA
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index 583c81f..77c73bf 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -55,6 +55,9 @@
#else
aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
#endif
+#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_ANS || CONFIG_DAALA_EC
coeff_cdf_model coef_cdfs[TX_SIZES][PLANE_TYPES];
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 856ce46..bf91a17 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1419,7 +1419,12 @@
else
p = (PARTITION_TYPE)aom_read_tree(r, av1_ext_partition_tree, probs);
#else
+#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
#endif // CONFIG_EXT_PARTITION_TYPES
else if (!has_rows && has_cols)
p = aom_read(r, probs[1]) ? PARTITION_SPLIT : PARTITION_HORZ;
@@ -3680,9 +3685,14 @@
for (i = 0; i < EXT_PARTITION_TYPES - 1; ++i)
av1_diff_update_prob(&r, &fc->partition_prob[j][i]);
#else
- 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 // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_EXT_INTRA
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index eca31d5..6b8004c 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1746,7 +1746,11 @@
av1_write_token(w, av1_ext_partition_tree, probs,
&ext_partition_encodings[p]);
#else
+#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
#endif // CONFIG_EXT_PARTITION_TYPES
} else if (!has_rows && has_cols) {
assert(p == PARTITION_SPLIT || p == PARTITION_HORZ);
@@ -3448,9 +3452,14 @@
prob_diff_update(av1_ext_partition_tree, fc->partition_prob[i],
counts->partition[i], EXT_PARTITION_TYPES, header_bc);
#else
- 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 // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_EXT_INTRA