Commit 6bdc40f1 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Thomas Davies

Remove the EC_ADAPT experimental flags.

Removing these flags make the EC_ADAPT experiment an integral part of
 the draft AV1 bitstream definition
This commit has no effect on metrics.

Change-Id: Ice78520935e8bfa9d25cf4b8384a1b872069d09c
parent 9f5cedd1
......@@ -194,9 +194,7 @@ static INLINE int aom_read_symbol_(aom_reader *r, aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
ret = aom_read_cdf(r, cdf, nsymbs, ACCT_STR_NAME);
#if CONFIG_EC_ADAPT
update_cdf(cdf, ret, nsymbs);
#endif
return ret;
}
......
......@@ -140,9 +140,7 @@ static INLINE void aom_write_cdf(aom_writer *w, int symb,
static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *cdf,
int nsymbs) {
aom_write_cdf(w, symb, cdf, nsymbs);
#if CONFIG_EC_ADAPT
update_cdf(cdf, symb, nsymbs);
#endif
}
static INLINE void aom_write_tree_as_cdf(aom_writer *w,
......
......@@ -186,10 +186,8 @@ int tree_to_cdf(const aom_tree_index *tree, const aom_prob *probs,
for (i = 1; i < nsymbs; i++) {
cdf[i] = AOM_ICDF(AOM_ICDF(cdf[i - 1]) + cdf[i]);
}
// Store symbol count at the end of the CDF
#if CONFIG_EC_ADAPT
// Store symbol count at the end of the CDF
cdf[nsymbs] = 0;
#endif
return nsymbs;
}
......
......@@ -148,7 +148,6 @@ static INLINE void av1_tree_to_cdf(const aom_tree_index *tree,
void av1_indices_from_tree(int *ind, int *inv, const aom_tree_index *tree);
#if CONFIG_EC_ADAPT
static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
const int rate = 4 + (cdf[nsymbs] > 31) + get_msb(nsymbs);
const int rate2 = 5;
......@@ -183,7 +182,6 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
#endif
cdf[nsymbs] += (cdf[nsymbs] < 32);
}
#endif
#ifdef __cplusplus
} // extern "C"
......
......@@ -702,9 +702,7 @@ typedef struct macroblockd {
#if CONFIG_PVQ
daala_dec_ctx daala_dec;
#endif
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *tile_ctx;
#endif
/* Bit depth: 8, 10, 12 */
int bd;
......
......@@ -5590,7 +5590,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
#endif
}
#if CONFIG_EC_ADAPT
static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
int cdf_size, const int num_tiles) {
int i;
......@@ -5714,9 +5713,7 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
#if CONFIG_EXT_INTER
AVERAGE_TILE_CDFS(inter_compound_mode_cdf)
#if CONFIG_EC_ADAPT
AVERAGE_TILE_CDFS(compound_type_cdf)
#endif // CONFIG_EC_ADAPT
#if CONFIG_INTERINTRA
#if CONFIG_NEW_MULTISYMBOL
......@@ -5808,4 +5805,3 @@ void av1_average_tile_pvq_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
AVERAGE_TILE_CDFS(pvq_context.pvq.pvq_skip_dir_cdf)
}
#endif // CONFIG_PVQ
#endif // CONFIG_EC_ADAPT
......@@ -188,9 +188,7 @@ struct AV1Common;
struct frame_contexts;
void av1_default_coef_probs(struct AV1Common *cm);
void av1_adapt_coef_probs(struct AV1Common *cm);
#if CONFIG_EC_ADAPT
void av1_adapt_coef_cdfs(struct AV1Common *cm, struct frame_contexts *pre_fc);
#endif
// This is the index in the scan order beyond which all coefficients for
// 8x8 transform and above are in the top band.
......@@ -431,7 +429,6 @@ static INLINE aom_prob av1_mode_mv_merge_probs(aom_prob pre_prob,
return mode_mv_merge_probs(pre_prob, ct);
}
#if CONFIG_EC_ADAPT
void av1_average_tile_coef_cdfs(struct frame_contexts *fc,
struct frame_contexts *ec_ctxs[],
aom_cdf_prob *cdf_ptrs[], int num_tiles);
......@@ -450,7 +447,6 @@ void av1_default_pvq_probs(struct AV1Common *cm);
void av1_average_tile_pvq_cdfs(struct frame_contexts *fc,
struct frame_contexts *ec_ctxs[], int num_tiles);
#endif // CONFIG_PVQ
#endif // CONFIG_EC_ADAPT
#ifdef __cplusplus
} // extern "C"
#endif
......
This diff is collapsed.
......@@ -195,37 +195,29 @@ typedef struct frame_contexts {
#if CONFIG_EXT_INTER
aom_prob inter_compound_mode_probs[INTER_MODE_CONTEXTS]
[INTER_COMPOUND_MODES - 1];
#if CONFIG_EC_ADAPT
aom_cdf_prob inter_compound_mode_cdf[INTER_MODE_CONTEXTS]
[CDF_SIZE(INTER_COMPOUND_MODES)];
#endif
#if CONFIG_COMPOUND_SINGLEREF
aom_prob inter_singleref_comp_mode_probs[INTER_MODE_CONTEXTS]
[INTER_SINGLEREF_COMP_MODES - 1];
#endif // CONFIG_COMPOUND_SINGLEREF
aom_prob compound_type_prob[BLOCK_SIZES][COMPOUND_TYPES - 1];
#if CONFIG_EC_ADAPT
aom_cdf_prob compound_type_cdf[BLOCK_SIZES][CDF_SIZE(COMPOUND_TYPES)];
#endif
#if CONFIG_INTERINTRA
aom_prob interintra_prob[BLOCK_SIZE_GROUPS];
aom_prob wedge_interintra_prob[BLOCK_SIZES];
aom_prob interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1];
#if CONFIG_EC_ADAPT
#if CONFIG_NEW_MULTISYMBOL
aom_cdf_prob interintra_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(2)];
aom_cdf_prob wedge_interintra_cdf[BLOCK_SIZES][CDF_SIZE(2)];
#endif
aom_cdf_prob interintra_mode_cdf[BLOCK_SIZE_GROUPS]
[CDF_SIZE(INTERINTRA_MODES)];
#endif
#endif // CONFIG_INTERINTRA
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
aom_prob motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1];
#if CONFIG_EC_ADAPT
aom_cdf_prob motion_mode_cdf[BLOCK_SIZES][CDF_SIZE(MOTION_MODES)];
#endif
#if CONFIG_NCOBMC_ADAPT_WEIGHT && CONFIG_MOTION_VAR
aom_prob ncobmc_mode_prob[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES - 1];
#endif
......@@ -372,11 +364,11 @@ typedef struct frame_contexts {
typedef struct FRAME_COUNTS {
// Note: This structure should only contain 'unsigned int' fields, or
// aggregates built solely from 'unsigned int' fields/elements
#if !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#if CONFIG_ENTROPY_STATS
unsigned int kf_y_mode[INTRA_MODES][INTRA_MODES][INTRA_MODES];
unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
unsigned int uv_mode[INTRA_MODES][INTRA_MODES];
#endif // !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#endif // CONFIG_ENTROPY_STATS
#if CONFIG_EXT_PARTITION_TYPES
unsigned int partition[PARTITION_CONTEXTS][EXT_PARTITION_TYPES];
#else
......@@ -510,13 +502,6 @@ typedef struct FRAME_COUNTS {
#endif // CONFIG_FILTER_INTRA
} FRAME_COUNTS;
#if !CONFIG_EC_ADAPT
// Default probabilities for signaling Intra mode for Y plane -- used only for
// intra-only frames. ('default_if_y_probs' is used for inter frames).
// Contexts used: Intra mode (Y plane) of 'above' and 'left' blocks.
extern const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
[INTRA_MODES - 1];
#endif
// CDF version of 'av1_kf_y_mode_prob'.
extern const aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES]
[CDF_SIZE(INTRA_MODES)];
......@@ -536,14 +521,8 @@ extern const aom_prob av1_default_palette_uv_color_index_prob
[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS][PALETTE_COLORS - 1];
#endif // CONFIG_PALETTE
#if !CONFIG_EC_ADAPT
extern const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
extern int av1_intra_mode_ind[INTRA_MODES];
extern int av1_intra_mode_inv[INTRA_MODES];
#else
extern const int av1_intra_mode_ind[INTRA_MODES];
extern const int av1_intra_mode_inv[INTRA_MODES];
#endif
#if CONFIG_EXT_TX
extern int av1_ext_tx_intra_ind[EXT_TX_SETS_INTRA][TX_TYPES];
extern int av1_ext_tx_intra_inv[EXT_TX_SETS_INTRA][TX_TYPES];
......@@ -605,10 +584,6 @@ extern const aom_tree_index
extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
#if !CONFIG_EC_ADAPT
void av1_set_mode_cdfs(struct AV1Common *cm);
#endif
void av1_setup_past_independence(struct AV1Common *cm);
void av1_adapt_intra_frame_probs(struct AV1Common *cm);
......
......@@ -228,25 +228,6 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
}
}
#if !CONFIG_EC_ADAPT
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) {
int i;
for (i = 0; i < NMV_CONTEXTS; ++i) {
......
......@@ -137,9 +137,6 @@ typedef enum {
void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx,
MvSubpelPrecision precision);
#if !CONFIG_EC_ADAPT
void av1_set_mv_cdfs(nmv_context *ctx);
#endif
#ifdef __cplusplus
} // extern "C"
......
......@@ -22,9 +22,7 @@ void aom_cdf_init_q15_1D(uint16_t *cdf, int nsyms, int cdf_size) {
for (i = 0; i < nsyms; i++)
cdf[i] = AOM_ICDF((i + 1)*CDF_PROB_TOP/nsyms);
#if CONFIG_EC_ADAPT
cdf[cdf_size - 1] = 0;
#endif
}
/** Adapts a Q15 cdf after encoding/decoding a symbol. */
......
......@@ -47,7 +47,7 @@ void generic_model_init(generic_encoder *model);
#define OD_CDFS_INIT_Q15(cdfs) \
{ int n_cdfs = sizeof(cdfs)/sizeof(cdfs[0]); \
int cdf_size = sizeof(cdfs[0])/sizeof(cdfs[0][0]); \
int nsyms = cdf_size - CONFIG_EC_ADAPT; \
int nsyms = cdf_size - 1; \
int i_; \
for (i_ = 0; i_ < n_cdfs; i_++) \
aom_cdf_init_q15_1D(cdfs[i_], nsyms, cdf_size); \
......
This diff is collapsed.
This diff is collapsed.
......@@ -50,10 +50,6 @@ static void initialize_dec(void) {
av1_init_wedge_masks();
#endif // CONFIG_EXT_INTER
init_done = 1;
#if !CONFIG_EC_ADAPT
av1_indices_from_tree(av1_intra_mode_ind, av1_intra_mode_inv,
av1_intra_mode_tree);
#endif
av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv,
av1_switchable_interp_tree);
#if CONFIG_EXT_TX
......
......@@ -53,9 +53,7 @@ typedef struct TileData {
#if CONFIG_CFL
CFL_CTX cfl;
#endif
#if CONFIG_EC_ADAPT
DECLARE_ALIGNED(16, FRAME_CONTEXT, tctx);
#endif
#if CONFIG_PALETTE
DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]);
#endif // CONFIG_PALETTE
......@@ -75,9 +73,7 @@ typedef struct TileWorkerData {
#if CONFIG_CFL
CFL_CTX cfl;
#endif
#if CONFIG_EC_ADAPT
FRAME_CONTEXT tctx;
#endif
#if CONFIG_PALETTE
DECLARE_ALIGNED(16, uint8_t, color_index_map[2][MAX_SB_SQUARE]);
#endif // CONFIG_PALETTE
......
......@@ -110,12 +110,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
#endif // CONFIG_AOM_QM
int ctx, const int16_t *scan, const int16_t *nb,
int16_t *max_scan_line, aom_reader *r) {
FRAME_COUNTS *counts = xd->counts;
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *const ec_ctx = xd->fc;
#endif
const int max_eob = tx_size_2d[tx_size];
const int ref = is_inter_block(&xd->mi[0]->mbmi);
#if CONFIG_AOM_QM
......@@ -131,11 +126,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
ec_ctx->coef_tail_cdfs[tx_size_ctx][type][ref];
int val = 0;
#if !CONFIG_EC_ADAPT
unsigned int *blockz_count;
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = NULL;
unsigned int(*eob_branch_count)[COEFF_CONTEXTS] = NULL;
#endif
uint8_t token_cache[MAX_TX_SQUARE];
const uint8_t *band_translate = get_band_translate(tx_size);
int dq_shift;
......@@ -145,14 +135,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
const tran_low_t *dqv_val = &dq_val[0][0];
#endif // CONFIG_NEW_QUANT
if (counts) {
#if !CONFIG_EC_ADAPT
coef_counts = counts->coef[tx_size_ctx][type][ref];
eob_branch_count = counts->eob_branch[tx_size_ctx][type][ref];
blockz_count = counts->blockz_count[tx_size_ctx][type][ref][ctx];
#endif
}
dq_shift = av1_get_tx_scale(tx_size);
band = *band_translate++;
......@@ -172,9 +154,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
HEAD_TOKENS + first_pos, ACCT_STR) +
!first_pos;
if (first_pos) {
#if !CONFIG_EC_ADAPT
if (counts) ++blockz_count[comb_token != 0];
#endif
if (comb_token == 0) return 0;
}
token = comb_token >> 1;
......@@ -182,11 +161,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
while (!token) {
*max_scan_line = AOMMAX(*max_scan_line, scan[c]);
token_cache[scan[c]] = 0;
#if !CONFIG_EC_ADAPT
if (counts && !last_pos) {
++coef_counts[band][ctx][ZERO_TOKEN];
}
#endif
++c;
dqv = dq[1];
ctx = get_coef_context(nb, token_cache, c);
......@@ -202,13 +176,6 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
}
more_data = comb_token & 1;
#if !CONFIG_EC_ADAPT
if (counts && !last_pos) {
++coef_counts[band][ctx][token];
++eob_branch_count[band][ctx];
if (!more_data) ++coef_counts[band][ctx][EOB_MODEL_TOKEN];
}
#endif
if (token > ONE_TOKEN)
token +=
......
This diff is collapsed.
......@@ -4697,10 +4697,8 @@ void av1_encode_tile(AV1_COMP *cpi, ThreadData *td, int tile_row,
#endif
#endif // #if CONFIG_PVQ
#if CONFIG_EC_ADAPT
this_tile->tctx = *cm->fc;
td->mb.e_mbd.tile_ctx = &this_tile->tctx;
#endif // #if CONFIG_EC_ADAPT
#if CONFIG_CFL
MACROBLOCKD *const xd = &td->mb.e_mbd;
......@@ -5442,7 +5440,7 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
const MODE_INFO *left_mi, const int intraonly,
const int mi_row, const int mi_col) {
const MB_MODE_INFO *const mbmi = &mi->mbmi;
#if !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#if CONFIG_ENTROPY_STATS
const PREDICTION_MODE y_mode = mbmi->mode;
const PREDICTION_MODE uv_mode = mbmi->uv_mode;
#else
......@@ -5450,12 +5448,12 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
(void)above_mi;
(void)left_mi;
(void)intraonly;
#endif // !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#endif // CONFIG_ENTROPY_STATS
const BLOCK_SIZE bsize = mbmi->sb_type;
const int unify_bsize = CONFIG_CB4X4;
if (bsize < BLOCK_8X8 && !unify_bsize) {
#if !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#if CONFIG_ENTROPY_STATS
int idx, idy;
const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
......@@ -5471,9 +5469,9 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
++counts->y_mode[0][bmode];
}
}
#endif // !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#endif // CONFIG_ENTROPY_STATS
} else {
#if !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#if CONFIG_ENTROPY_STATS
if (intraonly) {
const PREDICTION_MODE above = av1_above_block_mode(mi, above_mi, 0);
const PREDICTION_MODE left = av1_left_block_mode(mi, left_mi, 0);
......@@ -5481,7 +5479,7 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
} else {
++counts->y_mode[size_group_lookup[bsize]][y_mode];
}
#endif // !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#endif // CONFIG_ENTROPY_STATS
#if CONFIG_FILTER_INTRA
if (mbmi->mode == DC_PRED
#if CONFIG_PALETTE
......@@ -5527,9 +5525,9 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
(void)mi_col;
(void)xd;
#endif
#if !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#if CONFIG_ENTROPY_STATS
++counts->uv_mode[y_mode][uv_mode];
#endif // !CONFIG_EC_ADAPT || CONFIG_ENTROPY_STATS
#endif // CONFIG_ENTROPY_STATS
}
#if CONFIG_VAR_TX
......
......@@ -112,11 +112,7 @@ void av1_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
// These numbers are empirically obtained.
static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
#if CONFIG_EC_ADAPT
{ 10, 7 }, { 8, 5 },
#else
{ 10, 6 }, { 8, 6 },
#endif
};
static INLINE unsigned int get_token_bit_costs(
......@@ -1352,11 +1348,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
&pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
#if CONFIG_CFL
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *const ec_ctx = cm->fc;
#endif // CONFIG_EC_ADAPT
#if CONFIG_DEBUG
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
......
......@@ -150,23 +150,6 @@ static void update_mv(aom_writer *w, const unsigned int ct[2], aom_prob *cur_p,
#endif
}
#if !CONFIG_EC_ADAPT
static void write_mv_update(const aom_tree_index *tree,
aom_prob probs[/*n - 1*/],
const unsigned int counts[/*n - 1*/], int n,
aom_writer *w) {
int i;
unsigned int branch_ct[32][2];
// Assuming max number of probabilities <= 32
assert(n <= 32);
av1_tree_probs_from_distribution(tree, branch_ct, counts);
for (i = 0; i < n - 1; ++i)
update_mv(w, branch_ct[i], &probs[i], MV_UPDATE_PROB);
}
#endif
void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
nmv_context_counts *const nmv_counts) {
int i;
......@@ -174,34 +157,6 @@ 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);
for (i = 0; i < 2; ++i) {
int j;
nmv_component *comp = &mvc->comps[i];
nmv_component_counts *comp_counts = &counts->comps[i];
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);
write_mv_update(av1_mv_class0_tree, comp->class0, comp_counts->class0,
CLASS0_SIZE, w);
for (j = 0; j < MV_OFFSET_BITS; ++j)
update_mv(w, comp_counts->bits[j], &comp->bits[j], MV_UPDATE_PROB);
}
for (i = 0; i < 2; ++i) {
int j;
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);
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) {
......
......@@ -4401,8 +4401,6 @@ static void dump_filtered_recon_frames(AV1_COMP *cpi) {
}
#endif // DUMP_RECON_FRAMES
#if CONFIG_EC_ADAPT
static void make_update_tile_list_enc(AV1_COMP *cpi, const int tile_rows,
const int tile_cols,
FRAME_CONTEXT *ec_ctxs[]) {
......@@ -4411,7 +4409,6 @@ static void make_update_tile_list_enc(AV1_COMP *cpi, const int tile_rows,
ec_ctxs[i] = &cpi->tile_data[i].tctx;
}
#endif
static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
uint8_t *dest, int skip_adapt,
unsigned int *frame_flags) {
......@@ -4419,13 +4416,11 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
const AV1EncoderConfig *const oxcf = &cpi->oxcf;
struct segmentation *const seg = &cm->seg;
TX_SIZE t;
#if CONFIG_EC_ADAPT
FRAME_CONTEXT **tile_ctxs = aom_malloc(cm->tile_rows * cm->tile_cols *
sizeof(&cpi->tile_data[0].tctx));
aom_cdf_prob **cdf_ptrs =
aom_malloc(cm->tile_rows * cm->tile_cols *
sizeof(&cpi->tile_data[0].tctx.partition_cdf[0][0]));
#endif
#if CONFIG_XIPHRC
int frame_type;
int drop_this_frame = 0;
......@@ -4511,10 +4506,8 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
++cm->current_video_frame;
#if CONFIG_EC_ADAPT
aom_free(tile_ctxs);
aom_free(cdf_ptrs);
#endif
return;
}
#endif // CONFIG_EXT_REFS
......@@ -4568,10 +4561,8 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
if (drop_this_frame) {
av1_rc_postencode_update_drop_frame(cpi);
++cm->current_video_frame;
#if CONFIG_EC_ADAPT
aom_free(tile_ctxs);
aom_free(cdf_ptrs);
#endif
return;
}
#else
......@@ -4582,10 +4573,8 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
if (av1_rc_drop_frame(cpi)) {
av1_rc_postencode_update_drop_frame(cpi);
++cm->current_video_frame;
#if CONFIG_EC_ADAPT
aom_free(tile_ctxs);
aom_free(cdf_ptrs);
#endif
return;
}
}
......@@ -4686,10 +4675,8 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
av1_pack_bitstream(cpi, dest, size);
if (skip_adapt) {
#if CONFIG_EC_ADAPT
aom_free(tile_ctxs);
aom_free(cdf_ptrs);
#endif
return;
}
......@@ -4730,7 +4717,6 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
av1_adapt_coef_probs(cm);
av1_adapt_intra_frame_probs(cm);
#if CONFIG_EC_ADAPT
make_update_tile_list_enc(cpi, cm->tile_rows, cm->tile_cols, tile_ctxs);
av1_average_tile_coef_cdfs(cpi->common.fc, tile_ctxs, cdf_ptrs,
cm->tile_rows * cm->tile_cols);
......@@ -4740,7 +4726,6 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
av1_average_tile_pvq_cdfs(cpi->common.fc, tile_ctxs,
cm->tile_rows * cm->tile_cols);
#endif // CONFIG_PVQ
#endif // CONFIG_EC_ADAPT
#if CONFIG_ADAPT_SCAN
av1_adapt_scan_order(cm);
#endif // CONFIG_ADAPT_SCAN
......@@ -4750,12 +4735,10 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
av1_adapt_inter_frame_probs(cm);
av1_adapt_mv_probs(cm, cm->allow_high_precision_mv);
#if CONFIG_EC_ADAPT
av1_average_tile_inter_cdfs(&cpi->common, cpi->common.fc, tile_ctxs,
cdf_ptrs, cm->tile_rows * cm->tile_cols);
av1_average_tile_mv_cdfs(cpi->common.fc, tile_ctxs, cdf_ptrs,
cm->tile_rows * cm->tile_cols);
#endif
}
}
......@@ -4791,10 +4774,8 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
if (drop_this_frame) {
av1_rc_postencode_update_drop_frame(cpi);
++cm->current_video_frame;
#if CONFIG_EC_ADAPT
aom_free(tile_ctxs);
aom_free(cdf_ptrs);
#endif
return;
}
#else // !CONFIG_XIPHRC
......@@ -4843,10 +4824,8 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
#if CONFIG_EXT_REFS
}
#endif // CONFIG_EXT_REFS
#if CONFIG_EC_ADAPT
aom_free(tile_ctxs);
aom_free(cdf_ptrs);
#endif
}
static void Pass0Encode(AV1_COMP *cpi, size_t *size, uint8_t *dest,
......
......@@ -317,9 +317,7 @@ typedef struct TileDataEnc {
#if CONFIG_CFL
CFL_CTX cfl;
#endif
#if CONFIG_EC_ADAPT
DECLARE_ALIGNED(16, FRAME_CONTEXT, tctx);