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

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 3ef926ed
......@@ -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,
......
......@@ -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];
......
......@@ -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)
......
......@@ -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;
......
......@@ -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
......
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