Commit 493623ea authored by Thomas Davies's avatar Thomas Davies

Enable ec_adapt by default and fix experiment compatibilities.

EXT_TILE: allocate variables on the heap due to the potentially
large number of tiles.

ANS: initialise tile contexts.

EXT_INTER, MOTION_VAR, WARPED_MOTION: fix compilation.

Change-Id: I43a9d01c2442d97b6a8875712f77d932dce3740d
parent f14853de
......@@ -5685,10 +5685,9 @@ static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
av1_average_cdf(cdf_ptr, fc_cdf_ptr, cdf_size, num_tiles);
void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
const int num_tiles) {
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
int i, cdf_size;
aom_cdf_prob *cdf_ptr[MAX_TILE_ROWS * MAX_TILE_COLS];
aom_cdf_prob *fc_cdf_ptr;
#if CONFIG_NEW_TOKENSET
......@@ -5700,10 +5699,9 @@ void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
}
void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
const int num_tiles) {
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
int i, k, cdf_size;
aom_cdf_prob *cdf_ptr[MAX_TILE_ROWS * MAX_TILE_COLS];
aom_cdf_prob *fc_cdf_ptr;
#if CONFIG_REF_MV
......@@ -5729,10 +5727,9 @@ void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
}
void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
const int num_tiles) {
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
int i, cdf_size;
aom_cdf_prob *cdf_ptr[MAX_TILE_ROWS * MAX_TILE_COLS];
aom_cdf_prob *fc_cdf_ptr;
AVERAGE_TILE_CDFS(tx_size_cdf);
......@@ -5763,10 +5760,9 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
FRAME_CONTEXT *ec_ctxs[],
const int num_tiles) {
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
int i, cdf_size;
aom_cdf_prob *cdf_ptr[MAX_TILE_ROWS * MAX_TILE_COLS];
aom_cdf_prob *fc_cdf_ptr;
// FIXME: comp_inter_cdf not defined
......
......@@ -404,17 +404,17 @@ static INLINE aom_prob av1_mode_mv_merge_probs(aom_prob pre_prob,
#if CONFIG_EC_ADAPT
void av1_average_tile_coef_cdfs(struct frame_contexts *fc,
struct frame_contexts *ec_ctxs[],
const int num_tiles);
aom_cdf_prob *cdf_ptrs[], const int num_tiles);
void av1_average_tile_mv_cdfs(struct frame_contexts *fc,
struct frame_contexts *ec_ctxs[],
const int num_tiles);
aom_cdf_prob *cdf_ptrs[], const int num_tiles);
void av1_average_tile_intra_cdfs(struct frame_contexts *fc,
struct frame_contexts *ec_ctxs[],
const int num_tiles);
aom_cdf_prob *cdf_ptrs[], const int num_tiles);
void av1_average_tile_inter_cdfs(struct AV1Common *cm,
struct frame_contexts *fc,
struct frame_contexts *ec_ctxs[],
const int num_tiles);
aom_cdf_prob *cdf_ptrs[], const int num_tiles);
#endif
#ifdef __cplusplus
} // extern "C"
......
......@@ -4509,7 +4509,8 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
FRAME_CONTEXT *const fc = cm->fc;
aom_reader r;
int k, i;
#if !CONFIG_EC_ADAPT
#if !CONFIG_EC_ADAPT || \
(CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION || CONFIG_EXT_INTER)
int j;
#endif
......@@ -4979,7 +4980,11 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
if (!xd->corrupted) {
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *tile_ctxs[MAX_TILE_ROWS * MAX_TILE_COLS];
FRAME_CONTEXT **tile_ctxs = aom_malloc(cm->tile_rows * cm->tile_cols *
sizeof(&pbi->tile_data[0].tctx));
aom_cdf_prob **cdf_ptrs =
aom_malloc(cm->tile_rows * cm->tile_cols *
sizeof(&pbi->tile_data[0].tctx.partition_cdf[0][0]));
make_update_tile_list_dec(pbi, cm->tile_rows, cm->tile_cols, tile_ctxs);
#endif
......@@ -4989,9 +4994,9 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
av1_adapt_coef_probs(cm);
av1_adapt_intra_frame_probs(cm);
#if CONFIG_EC_ADAPT
av1_average_tile_coef_cdfs(pbi->common.fc, tile_ctxs,
av1_average_tile_coef_cdfs(pbi->common.fc, tile_ctxs, cdf_ptrs,
cm->tile_rows * cm->tile_cols);
av1_average_tile_intra_cdfs(pbi->common.fc, tile_ctxs,
av1_average_tile_intra_cdfs(pbi->common.fc, tile_ctxs, cdf_ptrs,
cm->tile_rows * cm->tile_cols);
#endif
#if CONFIG_ADAPT_SCAN
......@@ -5003,11 +5008,15 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
av1_adapt_mv_probs(cm, cm->allow_high_precision_mv);
#if CONFIG_EC_ADAPT
av1_average_tile_inter_cdfs(&pbi->common, pbi->common.fc, tile_ctxs,
cm->tile_rows * cm->tile_cols);
av1_average_tile_mv_cdfs(pbi->common.fc, tile_ctxs,
cdf_ptrs, cm->tile_rows * cm->tile_cols);
av1_average_tile_mv_cdfs(pbi->common.fc, tile_ctxs, cdf_ptrs,
cm->tile_rows * cm->tile_cols);
#endif
}
#if CONFIG_EC_ADAPT
aom_free(tile_ctxs);
aom_free(cdf_ptrs);
#endif
} else {
debug_check_frame_counts(cm);
}
......
......@@ -363,7 +363,8 @@ static void encode_unsigned_max(struct aom_write_bit_buffer *wb, int data,
aom_wb_write_literal(wb, data, get_unsigned_bits(max));
}
#if !CONFIG_EC_ADAPT
#if !CONFIG_EC_ADAPT || \
(CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION || CONFIG_EXT_INTER)
static void prob_diff_update(const aom_tree_index *tree,
aom_prob probs[/*n - 1*/],
const unsigned int counts[/*n - 1*/], int n,
......@@ -4115,6 +4116,11 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
// The last tile does not have a header.
if (!is_last_tile) total_size += 4;
#if CONFIG_EC_ADAPT
// Initialise tile context from the frame context
this_tile->tctx = *cm->fc;
cpi->td.mb.e_mbd.tile_ctx = &this_tile->tctx;
#endif
#if CONFIG_ANS
buf_ans_write_init(buf_ans, dst + total_size);
write_modes(cpi, &tile_info, buf_ans, &tok, tok_end);
......@@ -4127,11 +4133,6 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
// NOTE: This will not work with CONFIG_ANS turned on.
od_adapt_ctx_reset(&cpi->td.mb.daala_enc.state.adapt, 0);
cpi->td.mb.pvq_q = &this_tile->pvq_q;
#endif
#if CONFIG_EC_ADAPT
// Initialise tile context from the frame context
this_tile->tctx = *cm->fc;
cpi->td.mb.e_mbd.tile_ctx = &this_tile->tctx;
#endif
write_modes(cpi, &tile_info, &mode_bc, &tok, tok_end);
assert(tok == tok_end);
......
......@@ -4676,7 +4676,11 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
struct segmentation *const seg = &cm->seg;
TX_SIZE t;
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *tile_ctxs[MAX_TILE_ROWS * MAX_TILE_COLS];
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;
......@@ -4956,9 +4960,9 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
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,
av1_average_tile_coef_cdfs(cpi->common.fc, tile_ctxs, cdf_ptrs,
cm->tile_rows * cm->tile_cols);
av1_average_tile_intra_cdfs(cpi->common.fc, tile_ctxs,
av1_average_tile_intra_cdfs(cpi->common.fc, tile_ctxs, cdf_ptrs,
cm->tile_rows * cm->tile_cols);
#endif
#if CONFIG_ADAPT_SCAN
......@@ -4972,8 +4976,8 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
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,
cm->tile_rows * cm->tile_cols);
av1_average_tile_mv_cdfs(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
}
......@@ -5057,6 +5061,10 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
if (cm->is_reference_frame)
#endif // CONFIG_EXT_REFS
cm->prev_frame = cm->cur_frame;
#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,
......
......@@ -477,6 +477,7 @@ post_process_cmdline() {
soft_enable tile_groups
soft_enable rect_tx
soft_enable cdef
soft_enable ec_adapt
# Enable low-bitdepth pixel pipeline by default
soft_enable lowbitdepth
......
......@@ -50,7 +50,7 @@ decode_to_md5() {
decode_to_md5_av1() {
# expected MD5 sum for the last frame.
local expected_md5="eb2bbc257a8520dcd6334701d72171d8"
local expected_md5="2da13fe8dcd86d86b4bd8d4147f3dce6"
local file="${AV1_IVF_FILE}"
if [ "$(av1_decode_available)" = "yes" ]; then
......
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