Commit 7b8ac4f5 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Nathan Egge

Update y_mode_cdf tables once per frame.

Move computing the y_mode_cdf tables per coded intra mode symbol to
 computing them only when the probabilities are updated.

Change-Id: I8c43d09b8ef5febe2a3ec64bd51d28bd78ea73ed
parent ef56088c
......@@ -866,6 +866,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->intra_ext_tx_prob, default_intra_ext_tx_prob);
av1_copy(fc->inter_ext_tx_prob, default_inter_ext_tx_prob);
#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,
......
......@@ -103,6 +103,7 @@ typedef struct frame_contexts {
aom_prob inter_ext_tx_prob[EXT_TX_SIZES][TX_TYPES - 1];
int initialized;
#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];
......
......@@ -2092,9 +2092,14 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
setup_compound_reference_mode(cm);
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_MISC_FIXES
for (j = 0; j < PARTITION_CONTEXTS; ++j) {
......
......@@ -41,7 +41,11 @@ static PREDICTION_MODE read_intra_mode(aom_reader *r, const aom_prob *p) {
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;
......
......@@ -722,7 +722,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];
......@@ -730,7 +736,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
}
}
}
......@@ -2059,9 +2070,14 @@ static size_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
counts->comp_ref[i]);
#endif // CONFIG_EXT_REFS
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
}
#if !CONFIG_MISC_FIXES
for (i = 0; i < PARTITION_CONTEXTS; ++i) {
......
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