Commit f77d4ad3 authored by Thomas Davies's avatar Thomas Davies

EC_ADAPT: add per tile contexts.

This will support adapting in each tile.

(https://bugs.chromium.org/p/aomedia/issues/detail?id=71)

Change-Id: I3eced47715749a48f78c4ccf151c4d0b58f36c0d
parent 71bf3eec
......@@ -534,6 +534,9 @@ typedef struct macroblockd {
#if CONFIG_PVQ
daala_dec_ctx daala_dec;
#endif
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *tile_ctx;
#endif
#if CONFIG_AOM_HIGHBITDEPTH
/* Bit depth: 8, 10, 12 */
int bd;
......
......@@ -3408,6 +3408,11 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
#if CONFIG_PVQ
daala_dec_init(cm, &td->xd.daala_dec, &td->bit_reader);
#endif
#if CONFIG_EC_ADAPT
// Initialise the tile context from the frame context
td->tctx = *cm->fc;
td->xd.tile_ctx = &td->tctx;
#endif
#if CONFIG_PALETTE
td->xd.plane[0].color_index_map = td->color_index_map[0];
td->xd.plane[1].color_index_map = td->color_index_map[1];
......
......@@ -47,6 +47,9 @@ typedef struct TileData {
/* forward transformed predicted image, a reference for PVQ */
DECLARE_ALIGNED(16, tran_low_t, pvq_ref_coeff[OD_TXSIZE_MAX * OD_TXSIZE_MAX]);
#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
......
......@@ -3836,7 +3836,7 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
for (tile_col = 0; tile_col < tile_cols; tile_col++) {
const int tile_idx = tile_row * tile_cols + tile_col;
TileBufferEnc *const buf = &tile_buffers[tile_row][tile_col];
#if CONFIG_PVQ
#if CONFIG_PVQ || CONFIG_EC_ADAPT
TileDataEnc *this_tile = &cpi->tile_data[tile_idx];
#endif
const TOKENEXTRA *tok = tok_buffers[tile_row][tile_col];
......@@ -3917,6 +3917,10 @@ 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;
#elif 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);
......
......@@ -4891,6 +4891,9 @@ void av1_encode_tile(AV1_COMP *cpi, ThreadData *td, int tile_row,
#error "CONFIG_PVQ currently requires CONFIG_DAALA_EC."
#endif
od_adapt_ctx_reset(adapt, 0);
#elif CONFIG_EC_ADAPT
this_tile->tctx = *cm->fc;
td->mb.e_mbd.tile_ctx = &this_tile->tctx;
#endif // #if CONFIG_PVQ
for (mi_row = tile_info->mi_row_start; mi_row < tile_info->mi_row_end;
......
......@@ -280,6 +280,9 @@ typedef struct TileDataEnc {
#if CONFIG_PVQ
PVQ_QUEUE pvq_q;
#endif
#if CONFIG_EC_ADAPT
FRAME_CONTEXT tctx;
#endif
} TileDataEnc;
typedef struct RD_COUNTS {
......
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