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
diff --git a/av1/common/blockd.h b/av1/common/blockd.h index 285adfa..ce93693 100644 --- a/av1/common/blockd.h +++ b/av1/common/blockd.h
@@ -534,6 +534,9 @@ #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;
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 74ca45c..9668a3d 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -3408,6 +3408,11 @@ #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];
diff --git a/av1/decoder/decoder.h b/av1/decoder/decoder.h index 9ef6493..6713537 100644 --- a/av1/decoder/decoder.h +++ b/av1/decoder/decoder.h
@@ -47,6 +47,9 @@ /* 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
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index ea2adf3..2746d7b 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -3836,7 +3836,7 @@ 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 @@ // 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);
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index a06264d..b7d8e84 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -4891,6 +4891,9 @@ #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;
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h index dce432b..83ed874 100644 --- a/av1/encoder/encoder.h +++ b/av1/encoder/encoder.h
@@ -280,6 +280,9 @@ #if CONFIG_PVQ PVQ_QUEUE pvq_q; #endif +#if CONFIG_EC_ADAPT + FRAME_CONTEXT tctx; +#endif } TileDataEnc; typedef struct RD_COUNTS {