Commit 0929da52 authored by Thomas Davies's avatar Thomas Davies

EC_ADAPT: refactor and fix MinArfFreq unit tests.

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

Change-Id: I5677f78300156c8622f1728d7a343ff6c3a4ea64
parent 6ed2f832
......@@ -1435,7 +1435,4 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
for (t = 0; t <= TX_32X32; t++)
adapt_coef_probs(cm, t, count_sat, update_factor);
#if CONFIG_EC_MULTISYMBOL
av1_coef_pareto_cdfs(cm->fc);
#endif // CONFIG_EC_MULTISYMBOL
}
......@@ -925,6 +925,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
......@@ -1061,19 +1103,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
}
if (cm->seg.temporal_update) {
......@@ -1095,10 +1129,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
}
#if CONFIG_DELTA_Q
......
......@@ -245,6 +245,8 @@ extern const aom_tree_index av1_palette_color_tree[PALETTE_MAX_SIZE - 1]
#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);
......
......@@ -256,6 +256,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;
......@@ -263,21 +282,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
}
......@@ -135,6 +135,10 @@ typedef struct {
void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp);
#if CONFIG_EC_MULTISYMBOL
void av1_set_mv_cdfs(nmv_context *ctx);
#endif
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -41,6 +41,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"
......@@ -138,12 +139,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;
......@@ -158,17 +156,16 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
av1_diff_update_prob(r, &fc->drl_prob[i], ACCT_STR);
#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
static void read_ext_tx_probs(FRAME_CONTEXT *fc, aom_reader *r) {
int i, j, k;
if (aom_read(r, GROUP_DIFF_UPDATE_PROB, ACCT_STR)) {
......@@ -176,10 +173,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
}
}
}
......@@ -187,10 +180,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
}
}
}
......@@ -244,9 +233,6 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, aom_reader *r) {
#if !CONFIG_EC_ADAPT
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];
......@@ -254,23 +240,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
......@@ -775,9 +751,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,
......@@ -2089,30 +2062,17 @@ 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
}
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 // EC_ADAPT, DAALA_EC
if (frame_is_intra_only(cm)) {
av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob);
......@@ -2121,22 +2081,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_MOTION_VAR
for (j = 0; j < BLOCK_SIZES; ++j)
......@@ -2161,10 +2114,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
......@@ -2176,8 +2125,15 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#endif
#if !CONFIG_EC_ADAPT || !CONFIG_DAALA_EC
read_ext_tx_probs(fc, &r);
#endif // EC_ADAPT, DAALA_EC
#endif
}
#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);
}
......
......@@ -384,14 +384,11 @@ 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_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) -
av1_cost_zero(GROUP_DIFF_UPDATE_PROB);
......@@ -417,13 +414,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 +=
......@@ -436,10 +430,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
}
}
}
......@@ -1432,9 +1422,6 @@ static void update_coef_probs_common(aom_writer *const bc, AV1_COMP *cpi,
}
default: assert(0);
}
#if CONFIG_EC_MULTISYMBOL
av1_coef_pareto_cdfs(cpi->common.fc);
#endif // CONFIG_EC_MULTISYMBOL
}
static void update_coef_probs(AV1_COMP *cpi, aom_writer *w) {
......@@ -1610,12 +1597,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);
......@@ -2194,21 +2177,13 @@ static size_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
}
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_EC_ADAPT, CONFIG_DAALA_EC
#endif
if (frame_is_intra_only(cm)) {
av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob);
......@@ -2218,31 +2193,22 @@ static size_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_MOTION_VAR
for (i = 0; i < BLOCK_SIZES; ++i)
if (is_motion_variation_allowed_bsize(i))
......@@ -2292,12 +2258,8 @@ static size_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
......@@ -2309,6 +2271,13 @@ static size_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
update_ext_tx_probs(cm, header_bc);
#endif
}
#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);
......
......@@ -176,13 +176,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];
......@@ -205,6 +201,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) {
......@@ -221,10 +218,6 @@ void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
int j;
#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];
......@@ -233,9 +226,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)
......@@ -246,16 +236,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
......
......@@ -276,9 +276,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