Commit fba2be69 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Yaowu Xu

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
parent 93878c42
......@@ -1390,6 +1390,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
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 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
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
......
......@@ -54,6 +54,9 @@ typedef struct frame_contexts {
aom_prob partition_prob[PARTITION_CONTEXTS][EXT_PARTITION_TYPES - 1];
#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
......
......@@ -1418,8 +1418,13 @@ static PARTITION_TYPE read_partition(AV1_COMMON *cm, MACROBLOCKD *xd,
p = (PARTITION_TYPE)aom_read_tree(r, av1_partition_tree, probs);
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 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
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
......
......@@ -1745,8 +1745,12 @@ static void write_partition(const AV1_COMMON *const cm,
else
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 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment