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) {
#endif // CONFIG_ENTROPY
for (tx_size = 0; tx_size < TX_SIZES; tx_size++)
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
for (tx_size = TX_4X4; tx_size < TX_SIZES; ++tx_size)
......
......@@ -1453,6 +1453,48 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#if CONFIG_DAALA_EC
int av1_switchable_interp_ind[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
#if CONFIG_EXT_INTERP
......@@ -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],
counts->intra_ext_tx[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) {
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
......@@ -1692,10 +1726,6 @@ void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
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_DELTA_Q
......
......@@ -349,6 +349,8 @@ extern const aom_tree_index
#if CONFIG_DAALA_EC
extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
void av1_set_mode_cdfs(struct AV1Common *cm);
#endif
void av1_setup_past_independence(struct AV1Common *cm);
......
......@@ -266,6 +266,25 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
#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) {
#if CONFIG_REF_MV
int i;
......@@ -273,21 +292,7 @@ void av1_init_mv_probs(AV1_COMMON *cm) {
#else
cm->fc->nmvc = default_nmv_context;
#if CONFIG_EC_MULTISYMBOL
{
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]);
}
}
}
av1_set_mv_cdfs(&cm->fc->nmvc);
#endif
#endif
#if CONFIG_GLOBAL_MOTION
......
......@@ -134,11 +134,13 @@ typedef struct {
} nmv_context_counts;
void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp);
#if CONFIG_GLOBAL_MOTION
extern const aom_tree_index
av1_global_motion_types_tree[TREE_SIZE(GLOBAL_MOTION_TYPES)];
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_EC_MULTISYMBOL
void av1_set_mv_cdfs(nmv_context *ctx);
#endif
#ifdef __cplusplus
} // extern "C"
......
......@@ -38,6 +38,7 @@
#endif // CONFIG_DERING
#include "av1/common/entropy.h"
#include "av1/common/entropymode.h"
#include "av1/common/entropymv.h"
#include "av1/common/idct.h"
#include "av1/common/pred_common.h"
#include "av1/common/quant_common.h"
......@@ -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 (i = 0; i < SWITCHABLE_FILTERS - 1; ++i)
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) {
int i;
......@@ -143,17 +141,16 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
#endif // CONFIG_EXT_INTER
#else
int j;
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
for (i = 0; i < INTER_MODE_CONTEXTS; ++i) {
for (j = 0; j < INTER_MODES - 1; ++j)
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
}
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if CONFIG_EXT_INTER
static void read_inter_compound_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
int i, j;
......@@ -174,10 +171,6 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, aom_reader *r) {
for (j = 0; j < TX_TYPES; ++j) {
for (k = 0; k < TX_TYPES - 1; ++k)
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) {
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], 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) {
#if !CONFIG_EC_ADAPT || !CONFIG_EC_MULTISYMBOL
int j;
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) {
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) {
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->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) {
nmv_component *const comp_ctx = &ctx->comps[i];
for (j = 0; j < CLASS0_SIZE; ++j) {
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);
#if CONFIG_EC_MULTISYMBOL
av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->fp, comp_ctx->fp_cdf);
#endif
}
#endif // !CONFIG_EC_ADAPT
......@@ -1935,9 +1911,6 @@ static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r) {
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);
#if CONFIG_EC_MULTISYMBOL
av1_coef_pareto_cdfs(fc);
#endif // CONFIG_EC_MULTISYMBOL
}
static void setup_segmentation(AV1_COMMON *const cm,
......@@ -3783,19 +3756,11 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
}
for (k = 0; k < MAX_SEGMENTS - 1; k++)
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 (i = 0; i < INTRA_MODES - 1; ++i)
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
......@@ -3805,21 +3770,16 @@ 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], ACCT_STR);
#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], 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 // EC_ADAPT, DAALA_EC
#if CONFIG_EXT_INTRA
for (i = 0; i < INTRA_FILTERS + 1; ++i)
for (j = 0; j < INTRA_FILTERS - 1; ++j)
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)) {
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,
#endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
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)
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 // EC_ADAPT, DAALA_EC
} else {
#if !CONFIG_REF_MV
nmv_context *const nmvc = &fc->nmvc;
#endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
read_inter_mode_probs(fc, &r);
#endif
#if CONFIG_EXT_INTER
read_inter_compound_mode_probs(fc, &r);
......@@ -3895,10 +3848,6 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
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
}
#endif
......@@ -3916,8 +3865,15 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#endif
#if CONFIG_GLOBAL_MOTION
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);
}
......
......@@ -565,13 +565,9 @@ static void update_switchable_interp_probs(AV1_COMMON *cm, aom_writer *w,
prob_diff_update(
av1_switchable_interp_tree, cm->fc->switchable_interp_prob[j],
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
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
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
static void update_ext_tx_probs(AV1_COMMON *cm, aom_writer *w) {
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) {
for (j = 0; j < TX_TYPES; ++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);
#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;
for (i = TX_4X4; i < EXT_TX_SIZES; ++i) {
savings +=
......@@ -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) {
prob_diff_update(av1_ext_tx_tree, cm->fc->inter_ext_tx_prob[i],
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,
}
default: assert(0);
}
#if CONFIG_RANS || CONFIG_DAALA_EC
av1_coef_pareto_cdfs(cpi->common.fc);
#endif // CONFIG_EC_MULTISYMBOL
}
#if CONFIG_ENTROPY
......@@ -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,
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) {
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) {
for (i = 0; i < INTRA_MODES; ++i) {
prob_diff_update(av1_intra_mode_tree, fc->uv_mode_prob[i],
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
......@@ -3766,12 +3745,8 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
for (i = 0; i < PARTITION_CONTEXTS; ++i) {
prob_diff_update(av1_partition_tree, fc->partition_prob[i],
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
for (i = 0; i < INTRA_FILTERS + 1; ++i)
......@@ -3787,31 +3762,22 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
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],
counts->kf_y_mode[i][j], INTRA_MODES, probwt,
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
} else {
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
#if CONFIG_REF_MV
update_inter_mode_probs(cm, header_bc, counts);
#else
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
for (i = 0; i < INTER_MODE_CONTEXTS; ++i) {
prob_diff_update(av1_inter_mode_tree, cm->fc->inter_mode_probs[i],
counts->inter_mode[i], INTER_MODES, probwt, header_bc);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_inter_mode_tree, cm->fc->inter_mode_probs[i],
cm->fc->inter_mode_cdf[i]);
#endif
}
#endif
#endif // CONFIG_EC_ADAPT, CONFIG_DAALA_EC
#endif
#if CONFIG_EXT_INTER
update_inter_compound_mode_probs(cm, probwt, header_bc);
......@@ -3895,12 +3861,8 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
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, probwt, 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
}
#endif // CONFIG_EC_ADAPT, CONFIG_DAALA_EC
#endif
av1_write_nmv_probs(cm, cm->allow_high_precision_mv, header_bc,
#if CONFIG_REF_MV
......@@ -3922,6 +3884,13 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
write_global_motion(cpi, header_bc);
#endif // CONFIG_GLOBAL_MOTION
}
#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
#if CONFIG_ANS
ans_write_init(&header_ans, data);
buf_ans_flush(header_bc, &header_ans);
......
......@@ -175,13 +175,9 @@ void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
for (nmv_ctx = 0; nmv_ctx < NMV_CONTEXTS; ++nmv_ctx) {
nmv_context *const mvc = &cm->fc->nmvc[nmv_ctx];
nmv_context_counts *const counts = &nmv_counts[nmv_ctx];
#if !CONFIG_EC_ADAPT
write_mv_update(av1_mv_joint_tree, mvc->joints, counts->joints, MV_JOINTS,
w);
#if CONFIG_DAALA_EC
av1_tree_to_cdf(av1_mv_joint_tree, cm->fc->nmvc.joints,
cm->fc->nmvc.joint_cdf);
#endif
for (i = 0; i < 2; ++i) {
nmv_component *comp = &mvc->comps[i];
......@@ -204,6 +200,7 @@ void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
write_mv_update(av1_mv_fp_tree, mvc->comps[i].fp, counts->comps[i].fp,
MV_FP_SIZE, w);
}
#endif
if (usehp) {
for (i = 0; i < 2; ++i) {
......@@ -219,10 +216,6 @@ void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
#if !CONFIG_EC_ADAPT
write_mv_update(av1_mv_joint_tree, mvc->joints, counts->joints, MV_JOINTS, w);
#if CONFIG_EC_MULTISYMBOL
av1_tree_to_cdf(av1_mv_joint_tree, cm->fc->nmvc.joints,
cm->fc->nmvc.joint_cdf);
#endif
for (i = 0; i < 2; ++i) {
nmv_component *comp = &mvc->comps[i];
......@@ -231,9 +224,6 @@ void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
update_mv(w, comp_counts->sign, &comp->sign, MV_UPDATE_PROB);
write_mv_update(av1_mv_class_tree, comp->classes, comp_counts->classes,
MV_CLASSES, w);
#if CONFIG_EC_MULTISYMBOL
av1_tree_to_cdf(av1_mv_class_tree, comp->classes, comp->class_cdf);
#endif
write_mv_update(av1_mv_class0_tree, comp->class0, comp_counts->class0,
CLASS0_SIZE, w);
for (j = 0; j < MV_OFFSET_BITS; ++j)
......@@ -244,16 +234,9 @@ void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
for (j = 0; j < CLASS0_SIZE; ++j) {
write_mv_update(av1_mv_fp_tree, mvc->comps[i].class0_fp[j],
counts->comps[i].class0_fp[j], MV_FP_SIZE, w);
#if CONFIG_EC_MULTISYMBOL
av1_tree_to_cdf(av1_mv_fp_tree, mvc->comps[i].class0_fp[j],
mvc->comps[i].class0_fp_cdf[j]);
#endif
}
write_mv_update(av1_mv_fp_tree, mvc->comps[i].fp, counts->comps[i].fp,
MV_FP_SIZE, w);
#if CONFIG_EC_MULTISYMBOL
av1_tree_to_cdf(av1_mv_fp_tree, mvc->comps[i].fp, mvc->comps[i].fp_cdf);
#endif
}
#endif // !CONFIG_EC_ADAPT
......
......@@ -374,9 +374,6 @@ void av1_choose_segmap_coding_method(AV1_COMMON *cm, MACROBLOCKD *xd) {
} else {
seg->temporal_update = 0;
}
#if !CONFIG_EC_ADAPT && CONFIG_DAALA_EC
av1_tree_to_cdf(av1_segment_tree, segp->tree_probs, segp->tree_cdf);
#endif
}
void av1_reset_segment_features(AV1_COMMON *cm) {
......
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