Commit 6519bebf authored by Thomas Davies's avatar Thomas Davies Committed by Yaowu Xu

EC_ADAPT: refactor and fix MinArfFreq unit tests.

Ensure that cdfs are synced with pdfs after every
forward update.

Change-Id: I5677f78300156c8622f1728d7a343ff6c3a4ea64
parent 58c520af
...@@ -2925,9 +2925,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) { ...@@ -2925,9 +2925,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
#endif // CONFIG_ENTROPY #endif // CONFIG_ENTROPY
for (tx_size = 0; tx_size < TX_SIZES; tx_size++) for (tx_size = 0; tx_size < TX_SIZES; tx_size++)
adapt_coef_probs(cm, tx_size, count_sat, update_factor); adapt_coef_probs(cm, tx_size, count_sat, update_factor);
#if CONFIG_RANS
av1_coef_pareto_cdfs(cm->fc);
#endif // CONFIG_RANS
#if CONFIG_ADAPT_SCAN #if CONFIG_ADAPT_SCAN
for (tx_size = TX_4X4; tx_size < TX_SIZES; ++tx_size) for (tx_size = TX_4X4; tx_size < TX_SIZES; ++tx_size)
......
...@@ -1453,6 +1453,48 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { ...@@ -1453,6 +1453,48 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#if CONFIG_DAALA_EC #if CONFIG_DAALA_EC
int av1_switchable_interp_ind[SWITCHABLE_FILTERS]; int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
int av1_switchable_interp_inv[SWITCHABLE_FILTERS]; int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
void av1_set_mode_cdfs(struct AV1Common *cm) {
FRAME_CONTEXT *fc = cm->fc;
int i, j;
if (cm->seg.enabled && cm->seg.update_map) {
av1_tree_to_cdf(av1_segment_tree, cm->fc->seg.tree_probs,
cm->fc->seg.tree_cdf);
}
for (i = 0; i < INTRA_MODES; ++i)
av1_tree_to_cdf(av1_intra_mode_tree, fc->uv_mode_prob[j],
fc->uv_mode_cdf[j]);
for (i = 0; i < PARTITION_CONTEXTS; ++i)
av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[i],
fc->partition_cdf[i]);
for (i = 0; i < INTRA_MODES; ++i)
for (j = 0; j < INTRA_MODES; ++j)
av1_tree_to_cdf(av1_intra_mode_tree, cm->kf_y_prob[i][j],
cm->kf_y_cdf[i][j]);
for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j)
av1_tree_to_cdf(av1_switchable_interp_tree, fc->switchable_interp_prob[j],
fc->switchable_interp_cdf[j]);
for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
av1_tree_to_cdf(av1_inter_mode_tree, fc->inter_mode_probs[i],
fc->inter_mode_cdf[i]);
for (i = 0; i < BLOCK_SIZE_GROUPS; ++i)
av1_tree_to_cdf(av1_intra_mode_tree, fc->y_mode_prob[i], fc->y_mode_cdf[i]);
for (i = TX_4X4; i < EXT_TX_SIZES; ++i)
for (j = 0; j < TX_TYPES; ++j)
av1_tree_to_cdf(av1_ext_tx_tree, fc->intra_ext_tx_prob[i][j],
fc->intra_ext_tx_cdf[i][j]);
for (i = TX_4X4; i < EXT_TX_SIZES; ++i)
av1_tree_to_cdf(av1_ext_tx_tree, fc->inter_ext_tx_prob[i],
fc->inter_ext_tx_cdf[i]);
}
#endif #endif
#if CONFIG_EXT_INTERP #if CONFIG_EXT_INTERP
...@@ -1650,19 +1692,11 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) { ...@@ -1650,19 +1692,11 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
aom_tree_merge_probs(av1_ext_tx_tree, pre_fc->intra_ext_tx_prob[i][j], aom_tree_merge_probs(av1_ext_tx_tree, pre_fc->intra_ext_tx_prob[i][j],
counts->intra_ext_tx[i][j], counts->intra_ext_tx[i][j],
fc->intra_ext_tx_prob[i][j]); fc->intra_ext_tx_prob[i][j]);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_ext_tx_tree, fc->intra_ext_tx_prob[i][j],
fc->intra_ext_tx_cdf[i][j]);
#endif
} }
} }
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
aom_tree_merge_probs(av1_ext_tx_tree, pre_fc->inter_ext_tx_prob[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]); 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 #endif // CONFIG_EXT_TX
...@@ -1692,10 +1726,6 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) { ...@@ -1692,10 +1726,6 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
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], aom_tree_merge_probs(av1_partition_tree, pre_fc->partition_prob[i],
counts->partition[i], 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 #endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_DELTA_Q #if CONFIG_DELTA_Q
......
...@@ -349,6 +349,8 @@ extern const aom_tree_index ...@@ -349,6 +349,8 @@ extern const aom_tree_index
#if CONFIG_DAALA_EC #if CONFIG_DAALA_EC
extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS]; extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS]; extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
void av1_set_mode_cdfs(struct AV1Common *cm);
#endif #endif
void av1_setup_past_independence(struct AV1Common *cm); void av1_setup_past_independence(struct AV1Common *cm);
......
...@@ -266,6 +266,25 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) { ...@@ -266,6 +266,25 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
#endif #endif
} }
#if CONFIG_EC_MULTISYMBOL
void av1_set_mv_cdfs(nmv_context *ctx) {
int i;
int j;
av1_tree_to_cdf(av1_mv_joint_tree, ctx->joints, ctx->joint_cdf);
for (i = 0; i < 2; ++i) {
nmv_component *const comp_ctx = &ctx->comps[i];
av1_tree_to_cdf(av1_mv_class_tree, comp_ctx->classes, comp_ctx->class_cdf);
for (j = 0; j < CLASS0_SIZE; ++j) {
av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->class0_fp[j],
comp_ctx->class0_fp_cdf[j]);
}
av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->fp, comp_ctx->fp_cdf);
}
}
#endif
void av1_init_mv_probs(AV1_COMMON *cm) { void av1_init_mv_probs(AV1_COMMON *cm) {
#if CONFIG_REF_MV #if CONFIG_REF_MV
int i; int i;
...@@ -273,21 +292,7 @@ void av1_init_mv_probs(AV1_COMMON *cm) { ...@@ -273,21 +292,7 @@ void av1_init_mv_probs(AV1_COMMON *cm) {
#else #else
cm->fc->nmvc = default_nmv_context; cm->fc->nmvc = default_nmv_context;
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
{ av1_set_mv_cdfs(&cm->fc->nmvc);
int i, j;
av1_tree_to_cdf(av1_mv_joint_tree, cm->fc->nmvc.joints,
cm->fc->nmvc.joint_cdf);
for (i = 0; i < 2; i++) {
av1_tree_to_cdf(av1_mv_class_tree, cm->fc->nmvc.comps[i].classes,
cm->fc->nmvc.comps[i].class_cdf);
av1_tree_to_cdf(av1_mv_fp_tree, cm->fc->nmvc.comps[i].fp,
cm->fc->nmvc.comps[i].fp_cdf);
for (j = 0; j < CLASS0_SIZE; j++) {
av1_tree_to_cdf(av1_mv_fp_tree, cm->fc->nmvc.comps[i].class0_fp[j],
cm->fc->nmvc.comps[i].class0_fp_cdf[j]);
}
}
}
#endif #endif
#endif #endif
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION
......
...@@ -134,11 +134,13 @@ typedef struct { ...@@ -134,11 +134,13 @@ typedef struct {
} nmv_context_counts; } nmv_context_counts;
void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp); void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp);
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION
extern const aom_tree_index extern const aom_tree_index
av1_global_motion_types_tree[TREE_SIZE(GLOBAL_MOTION_TYPES)]; av1_global_motion_types_tree[TREE_SIZE(GLOBAL_MOTION_TYPES)];
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION
#if CONFIG_EC_MULTISYMBOL
void av1_set_mv_cdfs(nmv_context *ctx);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#endif // CONFIG_DERING #endif // CONFIG_DERING
#include "av1/common/entropy.h" #include "av1/common/entropy.h"
#include "av1/common/entropymode.h" #include "av1/common/entropymode.h"
#include "av1/common/entropymv.h"
#include "av1/common/idct.h" #include "av1/common/idct.h"
#include "av1/common/pred_common.h" #include "av1/common/pred_common.h"
#include "av1/common/quant_common.h" #include "av1/common/quant_common.h"
...@@ -120,12 +121,9 @@ static void read_switchable_interp_probs(FRAME_CONTEXT *fc, aom_reader *r) { ...@@ -120,12 +121,9 @@ static void read_switchable_interp_probs(FRAME_CONTEXT *fc, aom_reader *r) {
for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j) { for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j) {
for (i = 0; i < SWITCHABLE_FILTERS - 1; ++i) for (i = 0; i < SWITCHABLE_FILTERS - 1; ++i)
av1_diff_update_prob(r, &fc->switchable_interp_prob[j][i], ACCT_STR); av1_diff_update_prob(r, &fc->switchable_interp_prob[j][i], ACCT_STR);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_switchable_interp_tree, fc->switchable_interp_prob[j],
fc->switchable_interp_cdf[j]);
#endif
} }
} }
#endif
static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) { static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
int i; int i;
...@@ -143,17 +141,16 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) { ...@@ -143,17 +141,16 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
#else #else
int j; int j;
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
for (i = 0; i < INTER_MODE_CONTEXTS; ++i) { for (i = 0; i < INTER_MODE_CONTEXTS; ++i) {
for (j = 0; j < INTER_MODES - 1; ++j) for (j = 0; j < INTER_MODES - 1; ++j)
av1_diff_update_prob(r, &fc->inter_mode_probs[i][j], ACCT_STR); av1_diff_update_prob(r, &fc->inter_mode_probs[i][j], ACCT_STR);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_inter_mode_tree, fc->inter_mode_probs[i],
fc->inter_mode_cdf[i]);
#endif
} }
#endif #endif
#endif
} }
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
static void read_inter_compound_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) { static void read_inter_compound_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
int i, j; int i, j;
...@@ -174,10 +171,6 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, aom_reader *r) { ...@@ -174,10 +171,6 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, aom_reader *r) {
for (j = 0; j < TX_TYPES; ++j) { for (j = 0; j < TX_TYPES; ++j) {
for (k = 0; k < TX_TYPES - 1; ++k) for (k = 0; k < TX_TYPES - 1; ++k)
av1_diff_update_prob(r, &fc->intra_ext_tx_prob[i][j][k], ACCT_STR); av1_diff_update_prob(r, &fc->intra_ext_tx_prob[i][j][k], ACCT_STR);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_ext_tx_tree, fc->intra_ext_tx_prob[i][j],
fc->intra_ext_tx_cdf[i][j]);
#endif
} }
} }
} }
...@@ -185,10 +178,6 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, aom_reader *r) { ...@@ -185,10 +178,6 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, aom_reader *r) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
for (k = 0; k < TX_TYPES - 1; ++k) for (k = 0; k < TX_TYPES - 1; ++k)
av1_diff_update_prob(r, &fc->inter_ext_tx_prob[i][k], ACCT_STR); av1_diff_update_prob(r, &fc->inter_ext_tx_prob[i][k], ACCT_STR);
#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
} }
} }
} }
...@@ -248,9 +237,6 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, aom_reader *r) { ...@@ -248,9 +237,6 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, aom_reader *r) {
#if !CONFIG_EC_ADAPT || !CONFIG_EC_MULTISYMBOL #if !CONFIG_EC_ADAPT || !CONFIG_EC_MULTISYMBOL
int j; int j;
update_mv_probs(ctx->joints, MV_JOINTS - 1, r); update_mv_probs(ctx->joints, MV_JOINTS - 1, r);
#if CONFIG_EC_MULTISYMBOL
av1_tree_to_cdf(av1_mv_joint_tree, ctx->joints, ctx->joint_cdf);
#endif
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
nmv_component *const comp_ctx = &ctx->comps[i]; nmv_component *const comp_ctx = &ctx->comps[i];
...@@ -258,23 +244,13 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, aom_reader *r) { ...@@ -258,23 +244,13 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, aom_reader *r) {
update_mv_probs(comp_ctx->classes, MV_CLASSES - 1, r); update_mv_probs(comp_ctx->classes, MV_CLASSES - 1, r);
update_mv_probs(comp_ctx->class0, CLASS0_SIZE - 1, r); update_mv_probs(comp_ctx->class0, CLASS0_SIZE - 1, r);
update_mv_probs(comp_ctx->bits, MV_OFFSET_BITS, r); update_mv_probs(comp_ctx->bits, MV_OFFSET_BITS, r);
#if CONFIG_EC_MULTISYMBOL
av1_tree_to_cdf(av1_mv_class_tree, comp_ctx->classes, comp_ctx->class_cdf);
#endif
} }
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
nmv_component *const comp_ctx = &ctx->comps[i]; nmv_component *const comp_ctx = &ctx->comps[i];
for (j = 0; j < CLASS0_SIZE; ++j) { for (j = 0; j < CLASS0_SIZE; ++j) {
update_mv_probs(comp_ctx->class0_fp[j], MV_FP_SIZE - 1, r); update_mv_probs(comp_ctx->class0_fp[j], MV_FP_SIZE - 1, r);
#if CONFIG_EC_MULTISYMBOL
av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->class0_fp[j],
comp_ctx->class0_fp_cdf[j]);
#endif
} }
update_mv_probs(comp_ctx->fp, MV_FP_SIZE - 1, r); update_mv_probs(comp_ctx->fp, MV_FP_SIZE - 1, r);
#if CONFIG_EC_MULTISYMBOL
av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->fp, comp_ctx->fp_cdf);
#endif
} }
#endif // !CONFIG_EC_ADAPT #endif // !CONFIG_EC_ADAPT
...@@ -1935,9 +1911,6 @@ static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r) { ...@@ -1935,9 +1911,6 @@ static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r) {
TX_SIZE tx_size; TX_SIZE tx_size;
for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size) for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
read_coef_probs_common(fc->coef_probs[tx_size], r); read_coef_probs_common(fc->coef_probs[tx_size], r);
#if CONFIG_EC_MULTISYMBOL
av1_coef_pareto_cdfs(fc);
#endif // CONFIG_EC_MULTISYMBOL
} }
static void setup_segmentation(AV1_COMMON *const cm, static void setup_segmentation(AV1_COMMON *const cm,
...@@ -3783,19 +3756,11 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data, ...@@ -3783,19 +3756,11 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
} }
for (k = 0; k < MAX_SEGMENTS - 1; k++) for (k = 0; k < MAX_SEGMENTS - 1; k++)
av1_diff_update_prob(&r, &cm->fc->seg.tree_probs[k], ACCT_STR); av1_diff_update_prob(&r, &cm->fc->seg.tree_probs[k], ACCT_STR);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_segment_tree, cm->fc->seg.tree_probs,
cm->fc->seg.tree_cdf);
#endif
} }
for (j = 0; j < INTRA_MODES; j++) { for (j = 0; j < INTRA_MODES; j++) {
for (i = 0; i < INTRA_MODES - 1; ++i) for (i = 0; i < INTRA_MODES - 1; ++i)
av1_diff_update_prob(&r, &fc->uv_mode_prob[j][i], ACCT_STR); av1_diff_update_prob(&r, &fc->uv_mode_prob[j][i], ACCT_STR);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_intra_mode_tree, fc->uv_mode_prob[j],
fc->uv_mode_cdf[j]);
#endif
} }
#if CONFIG_EXT_PARTITION_TYPES #if CONFIG_EXT_PARTITION_TYPES
...@@ -3805,21 +3770,16 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data, ...@@ -3805,21 +3770,16 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
for (i = 0; i < EXT_PARTITION_TYPES - 1; ++i) for (i = 0; i < EXT_PARTITION_TYPES - 1; ++i)
av1_diff_update_prob(&r, &fc->partition_prob[j][i], ACCT_STR); av1_diff_update_prob(&r, &fc->partition_prob[j][i], ACCT_STR);
#else #else
for (j = 0; j < PARTITION_CONTEXTS; ++j) { for (j = 0; j < PARTITION_CONTEXTS; ++j)
for (i = 0; i < PARTITION_TYPES - 1; ++i) for (i = 0; i < PARTITION_TYPES - 1; ++i)
av1_diff_update_prob(&r, &fc->partition_prob[j][i], ACCT_STR); av1_diff_update_prob(&r, &fc->partition_prob[j][i], ACCT_STR);
#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 #endif // CONFIG_EXT_PARTITION_TYPES
#endif // EC_ADAPT, DAALA_EC #endif // EC_ADAPT, DAALA_EC
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
for (i = 0; i < INTRA_FILTERS + 1; ++i) for (i = 0; i < INTRA_FILTERS + 1; ++i)
for (j = 0; j < INTRA_FILTERS - 1; ++j) for (j = 0; j < INTRA_FILTERS - 1; ++j)
av1_diff_update_prob(&r, &fc->intra_filter_probs[i][j], ACCT_STR); av1_diff_update_prob(&r, &fc->intra_filter_probs[i][j], ACCT_STR);
#endif // CONFIG_EXT_INTRA #endif // EC_ADAPT, DAALA_EC
if (frame_is_intra_only(cm)) { if (frame_is_intra_only(cm)) {
av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob); av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob);
...@@ -3828,22 +3788,15 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data, ...@@ -3828,22 +3788,15 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#endif #endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC #if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
for (k = 0; k < INTRA_MODES; k++) for (k = 0; k < INTRA_MODES; k++)
for (j = 0; j < INTRA_MODES; j++) { for (j = 0; j < INTRA_MODES; j++)
for (i = 0; i < INTRA_MODES - 1; ++i) for (i = 0; i < INTRA_MODES - 1; ++i)
av1_diff_update_prob(&r, &cm->kf_y_prob[k][j][i], ACCT_STR); av1_diff_update_prob(&r, &cm->kf_y_prob[k][j][i], ACCT_STR);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_intra_mode_tree, cm->kf_y_prob[k][j],
cm->kf_y_cdf[k][j]);
#endif #endif
}
#endif // EC_ADAPT, DAALA_EC
} else { } else {
#if !CONFIG_REF_MV #if !CONFIG_REF_MV
nmv_context *const nmvc = &fc->nmvc; nmv_context *const nmvc = &fc->nmvc;
#endif #endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
read_inter_mode_probs(fc, &r); read_inter_mode_probs(fc, &r);
#endif
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
read_inter_compound_mode_probs(fc, &r); read_inter_compound_mode_probs(fc, &r);
...@@ -3895,10 +3848,6 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data, ...@@ -3895,10 +3848,6 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
for (j = 0; j < BLOCK_SIZE_GROUPS; j++) { for (j = 0; j < BLOCK_SIZE_GROUPS; j++) {
for (i = 0; i < INTRA_MODES - 1; ++i) for (i = 0; i < INTRA_MODES - 1; ++i)
av1_diff_update_prob(&r, &fc->y_mode_prob[j][i], ACCT_STR); 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
} }
#endif #endif
...@@ -3916,8 +3865,15 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data, ...@@ -3916,8 +3865,15 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#endif #endif
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION
read_global_motion(cm, &r); read_global_motion(cm, &r);
#endif // CONFIG_GLOBAL_MOTION #endif // EC_ADAPT, DAALA_EC
} }
#if CONFIG_EC_MULTISYMBOL
av1_coef_pareto_cdfs(fc);
av1_set_mv_cdfs(&fc->nmvc);
#if CONFIG_DAALA_EC
av1_set_mode_cdfs(cm);
#endif
#endif
return aom_reader_has_error(&r); return aom_reader_has_error(&r);
} }
......
...@@ -565,13 +565,9 @@ static void update_switchable_interp_probs(AV1_COMMON *cm, aom_writer *w, ...@@ -565,13 +565,9 @@ static void update_switchable_interp_probs(AV1_COMMON *cm, aom_writer *w,
prob_diff_update( prob_diff_update(
av1_switchable_interp_tree, cm->fc->switchable_interp_prob[j], av1_switchable_interp_tree, cm->fc->switchable_interp_prob[j],
counts->switchable_interp[j], SWITCHABLE_FILTERS, probwt, w); counts->switchable_interp[j], SWITCHABLE_FILTERS, probwt, w);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_switchable_interp_tree,
cm->fc->switchable_interp_prob[j],
cm->fc->switchable_interp_cdf[j]);
#endif
} }
} }
#endif
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) { static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) {
...@@ -631,6 +627,7 @@ static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) { ...@@ -631,6 +627,7 @@ static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) {
} }
#else #else
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) { static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) {
const int savings_thresh = av1_cost_one(GROUP_DIFF_UPDATE_PROB) - const int savings_thresh = av1_cost_one(GROUP_DIFF_UPDATE_PROB) -
...@@ -657,13 +654,10 @@ static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) { ...@@ -657,13 +654,10 @@ static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) {
for (j = 0; j < TX_TYPES; ++j) { for (j = 0; j < TX_TYPES; ++j) {
prob_diff_update(av1_ext_tx_tree, cm->fc->intra_ext_tx_prob[i][j], prob_diff_update(av1_ext_tx_tree, cm->fc->intra_ext_tx_prob[i][j],
cm->counts.intra_ext_tx[i][j], TX_TYPES, probwt, w); cm->counts.intra_ext_tx[i][j], TX_TYPES, probwt, w);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_ext_tx_tree, cm->fc->intra_ext_tx_prob[i][j],
cm->fc->intra_ext_tx_cdf[i][j]);
#endif
} }
} }
} }
savings = 0; savings = 0;
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
savings += savings +=
...@@ -676,10 +670,6 @@ static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) { ...@@ -676,10 +670,6 @@ static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) {
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
prob_diff_update(av1_ext_tx_tree, cm->fc->inter_ext_tx_prob[i], prob_diff_update(av1_ext_tx_tree, cm->fc->inter_ext_tx_prob[i],
cm->counts.inter_ext_tx[i], TX_TYPES, probwt, w); cm->counts.inter_ext_tx[i], TX_TYPES, probwt, 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
} }
} }
} }
...@@ -2345,9 +2335,6 @@ static void update_coef_probs_common(aom_writer *const bc, AV1_COMP *cpi, ...@@ -2345,9 +2335,6 @@ static void update_coef_probs_common(aom_writer *const bc, AV1_COMP *cpi,
} }
default: assert(0); default: assert(0);
} }
#if CONFIG_RANS || CONFIG_DAALA_EC
av1_coef_pareto_cdfs(cpi->common.fc);
#endif // CONFIG_EC_MULTISYMBOL
} }
#if CONFIG_ENTROPY #if CONFIG_ENTROPY
...@@ -2922,12 +2909,8 @@ static void update_seg_probs(AV1_COMP *cpi, aom_writer *w) { ...@@ -2922,12 +2909,8 @@ static void update_seg_probs(AV1_COMP *cpi, aom_writer *w) {
prob_diff_update(av1_segment_tree, cm->fc->seg.tree_probs, prob_diff_update(av1_segment_tree, cm->fc->seg.tree_probs,
cm->counts.seg.tree_total, MAX_SEGMENTS, probwt, w); cm->counts.seg.tree_total, MAX_SEGMENTS, probwt, w);
} }
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_segment_tree, cm->fc->seg.tree_probs,
cm->fc->seg.tree_cdf);
#endif
} }
#endif // CONFIG_EC_ADAPT,CONFIG_DAALA_EC #endif
static void write_txfm_mode(TX_MODE mode, struct aom_write_bit_buffer *wb) { static void write_txfm_mode(TX_MODE mode, struct aom_write_bit_buffer *wb) {
aom_wb_write_bit(wb, mode == TX_MODE_SELECT); aom_wb_write_bit(wb, mode == TX_MODE_SELECT);
...@@ -3749,10 +3732,6 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) { ...@@ -3749,10 +3732,6 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
for (i = 0; i < INTRA_MODES; ++i) { for (i = 0; i < INTRA_MODES; ++i) {
prob_diff_update(av1_intra_mode_tree, fc->uv_mode_prob[i], prob_diff_update(av1_intra_mode_tree, fc->uv_mode_prob[i],
counts->uv_mode[i], INTRA_MODES, probwt, header_bc); counts->uv_mode[i], INTRA_MODES, probwt, header_bc);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_intra_mode_tree, fc->uv_mode_prob[i],
fc->uv_mode_cdf[i]);
#endif
} }
#if CONFIG_EXT_PARTITION_TYPES #if CONFIG_EXT_PARTITION_TYPES
...@@ -3766,12 +3745,8 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) { ...@@ -3766,12 +3745,8 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
for (i = 0; i < PARTITION_CONTEXTS; ++i) { for (i = 0; i < PARTITION_CONTEXTS; ++i) {
prob_diff_update(av1_partition_tree, fc->partition_prob[i], prob_diff_update(av1_partition_tree, fc->partition_prob[i],
counts->partition[i], PARTITION_TYPES, probwt, header_bc); counts->partition[i], PARTITION_TYPES, probwt, 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 #endif // CONFIG_EC_ADAPT, CONFIG_DAALA_EC
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
for (i = 0; i < INTRA_FILTERS + 1; ++i) for (i = 0; i < INTRA_FILTERS + 1; ++i)
...@@ -3787,31 +3762,22 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) { ...@@ -3787,31 +3762,22 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC #if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
for (i = 0; i < INTRA_MODES; ++i) for (i = 0; i < INTRA_MODES; ++i)
for (j = 0; j < INTRA_MODES; ++j) { for (j = 0; j < INTRA_MODES; ++j)
prob_diff_update(av1_intra_mode_tree, cm->kf_y_prob[i][j], prob_diff_update(av1_intra_mode_tree, cm->kf_y_prob[i][j],
counts->kf_y_mode[i][j], INTRA_MODES, probwt, counts->kf_y_mode[i][j], INTRA_MODES, probwt,
header_bc); header_bc);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_intra_mode_tree, cm->kf_y_prob[i][j],
cm->kf_y_cdf[i][j]);
#endif
}
#endif // CONFIG_EC_ADAPT, CONFIG_DAALA_EC #endif // CONFIG_EC_ADAPT, CONFIG_DAALA_EC
} else { } else {
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if CONFIG_REF_MV #if CONFIG_REF_MV
update_inter_mode_probs(cm, header_bc, counts); update_inter_mode_probs(cm, header_bc, counts);
#else #else