PVQ uses backward updated context in a tile
In the beginning of encoding and bitstream packing,
the frame context in common of codec is copied to the frame context
in each tile.
Initial prob and context is based on flat probability and
does not come from table at the moment.
The bd-rate change for the test set objective-1-fast
on awcy with high delay mode is:
PSNR PSNR HVS SSIM CIEDE 2000 PSNR Cb PSNR Cr MS SSIM
-0.77 -1.05 -0.74 -0.67 -0.67 -0.77 -0.88
Change-Id: Ic9105ac68aceb7486cb5f6f1c0b19df5853f2cb9
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index f802662..5c5599f 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1037,7 +1037,7 @@
const BLOCK_SIZE plane_bsize =
get_plane_block_size(AOMMAX(bsize, BLOCK_8X8), pd);
- adapt = &x->daala_enc.state.adapt;
+ adapt = x->daala_enc.state.adapt;
max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
max_blocks_high = max_block_high(xd, plane_bsize, plane);
@@ -4121,6 +4121,10 @@
this_tile->tctx = *cm->fc;
cpi->td.mb.e_mbd.tile_ctx = &this_tile->tctx;
#endif
+#if CONFIG_PVQ
+ cpi->td.mb.pvq_q = &this_tile->pvq_q;
+ cpi->td.mb.daala_enc.state.adapt = &this_tile->tctx.pvq_context;
+#endif // CONFIG_PVQ
#if CONFIG_ANS
buf_ans_write_init(buf_ans, dst + total_size);
write_modes(cpi, &tile_info, buf_ans, &tok, tok_end);
@@ -4129,11 +4133,6 @@
tile_size = buf_ans_write_end(buf_ans);
#else
aom_start_encode(&mode_bc, dst + total_size);
-#if CONFIG_PVQ
- // 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
write_modes(cpi, &tile_info, &mode_bc, &tok, tok_end);
#if !CONFIG_LV_MAP
assert(tok == tok_end);