Update inter_ext_tx_cdf per frame.

Move computing the inter_ext_tx_cdf tables per symbol to
 computing them only when the probabilities are updated.

Change-Id: I5e1e62f8eae8f6b2edbbd378beeb786649502c10
This commit is contained in:
Nathan E. Egge 2016-05-03 10:01:32 -04:00 коммит произвёл Yaowu Xu
Родитель 7c5b4c1665
Коммит 93878c4243
5 изменённых файлов: 32 добавлений и 7 удалений

Просмотреть файл

@ -1388,6 +1388,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
fc->switchable_interp_cdf, SWITCHABLE_FILTER_CONTEXTS);
av1_tree_to_cdf_2D(av1_ext_tx_tree, fc->intra_ext_tx_prob,
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);
#endif
}
@ -1596,6 +1598,10 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
aom_tree_merge_probs(av1_ext_tx_tree, pre_fc->inter_ext_tx_prob[i],
counts->inter_ext_tx[i], fc->inter_ext_tx_prob[i]);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_ext_tx_tree, fc->inter_ext_tx_prob[i],
fc->inter_ext_tx_cdf[i]);
#endif
}
#endif // CONFIG_EXT_TX

Просмотреть файл

@ -135,6 +135,7 @@ typedef struct frame_contexts {
uint16_t switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS];
uint16_t intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][TX_TYPES];
uint16_t inter_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES];
#endif
} FRAME_CONTEXT;

Просмотреть файл

@ -3533,6 +3533,10 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, aom_reader *r) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
for (k = 0; k < TX_TYPES - 1; ++k)
av1_diff_update_prob(r, &fc->inter_ext_tx_prob[i][k]);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_ext_tx_tree, fc->inter_ext_tx_prob[i],
fc->inter_ext_tx_cdf[i]);
#endif
}
}
}

Просмотреть файл

@ -1769,14 +1769,19 @@ static void read_inter_frame_mode_info(AV1Decoder *const pbi,
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
FRAME_COUNTS *counts = xd->counts;
if (inter_block) {
#if CONFIG_DAALA_EC
mbmi->tx_type = av1_ext_tx_inv[aom_read_tree_cdf(
r, cm->fc->inter_ext_tx_cdf[mbmi->tx_size], TX_TYPES)];
#else
mbmi->tx_type = aom_read_tree(r, av1_ext_tx_tree,
cm->fc->inter_ext_tx_prob[mbmi->tx_size]);
#endif
if (counts) ++counts->inter_ext_tx[mbmi->tx_size][mbmi->tx_type];
} else {
const TX_TYPE tx_type_nom = intra_mode_to_tx_type_context[mbmi->mode];
#if CONFIG_DAALA_EC
mbmi->tx_type = av1_ext_tx_inv[aom_read_tree_cdf(
r, cm->fc->intra_ext_tx_cdf[mbmi->tx_size][tx_type_nom], TX_TYPES)];
mbmi->tx_type = av1_ext_tx_inv[aom_read_tree_cdf(
r, cm->fc->intra_ext_tx_cdf[mbmi->tx_size][tx_type_nom], TX_TYPES)];
#else
mbmi->tx_type = aom_read_tree(
r, av1_ext_tx_tree,

Просмотреть файл

@ -603,6 +603,10 @@ static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
prob_diff_update(av1_ext_tx_tree, cm->fc->inter_ext_tx_prob[i],
cm->counts.inter_ext_tx[i], TX_TYPES, w);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_ext_tx_tree, cm->fc->inter_ext_tx_prob[i],
cm->fc->inter_ext_tx_cdf[i]);
#endif
}
}
}
@ -1458,16 +1462,21 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
#endif // CONFIG_SUPERTX
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
if (is_inter) {
#if CONFIG_DAALA_EC
aom_write_tree_cdf(w, av1_ext_tx_ind[mbmi->tx_type],
cm->fc->inter_ext_tx_cdf[mbmi->tx_size], TX_TYPES);
#else
av1_write_token(w, av1_ext_tx_tree,
cm->fc->inter_ext_tx_prob[mbmi->tx_size],
&ext_tx_encodings[mbmi->tx_type]);
#endif
} else {
#if CONFIG_DAALA_EC
aom_write_tree_cdf(
w, av1_ext_tx_ind[mbmi->tx_type],
cm->fc->intra_ext_tx_cdf[mbmi->tx_size]
[intra_mode_to_tx_type_context[mbmi->mode]],
TX_TYPES);
aom_write_tree_cdf(
w, av1_ext_tx_ind[mbmi->tx_type],
cm->fc->intra_ext_tx_cdf[mbmi->tx_size]
[intra_mode_to_tx_type_context[mbmi->mode]],
TX_TYPES);
#else
av1_write_token(
w, av1_ext_tx_tree,