Commit 84b05ac1 authored by Rupert Swarbrick's avatar Rupert Swarbrick Committed by Yaowu Xu
Browse files

Stop backward adaptation if EXT_TILE + cm->large_scale_tile

Backwards adaptation doesn't really make sense in this context,
because ext-tile means the decoder might not decode every tile in the
frame, in which case it can't work out how to adapt probabilities.

It turns out that the tests in the tree were passing when
SIMPLE_BWD_ADAPT was disabled because (presumably) all of them
happened to decode every tile, so backward adaptation worked as you'd
expect. With SIMPLE_BWD_ADAPT, there's some code in get_tile_buffers
to figure out which is the largest tile. This wasn't mirrored in
get_ls_tile_buffers, which caused the encoder and decoder to get out
of sync because they ended up with different CDFs. You also can't
easily fix things in get_ls_tile_buffers because that code is careful
not to calculate the size of tiles it doesn't need.

BUG=aomedia:917

Change-Id: Ia926692f86ca1466252108e09da3de590d45f048
parent 11812967
......@@ -3299,7 +3299,13 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
" state");
}
if (!cm->error_resilient_mode) {
#if CONFIG_EXT_TILE
const int might_bwd_adapt =
!(cm->error_resilient_mode || cm->large_scale_tile);
#else
const int might_bwd_adapt = !cm->error_resilient_mode;
#endif // CONFIG_EXT_TILE
if (might_bwd_adapt) {
cm->refresh_frame_context = aom_rb_read_bit(rb)
? REFRESH_FRAME_CONTEXT_FORWARD
: REFRESH_FRAME_CONTEXT_BACKWARD;
......
......@@ -4155,7 +4155,13 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
}
#endif // CONFIG_REFERENCE_BUFFER
if (!cm->error_resilient_mode) {
#if CONFIG_EXT_TILE
const int might_bwd_adapt =
!(cm->error_resilient_mode || cm->large_scale_tile);
#else
const int might_bwd_adapt = !cm->error_resilient_mode;
#endif // CONFIG_EXT_TILE
if (might_bwd_adapt) {
aom_wb_write_bit(
wb, cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_FORWARD);
}
......
......@@ -2480,6 +2480,11 @@ void av1_change_config(struct AV1_COMP *cpi, const AV1EncoderConfig *oxcf) {
(oxcf->error_resilient_mode || oxcf->frame_parallel_decoding_mode)
? REFRESH_FRAME_CONTEXT_FORWARD
: REFRESH_FRAME_CONTEXT_BACKWARD;
#if CONFIG_EXT_TILE
if (oxcf->large_scale_tile)
cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_FORWARD;
#endif // CONFIG_EXT_TILE
#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING
cm->reset_frame_context = RESET_FRAME_CONTEXT_NONE;
#endif
......@@ -5406,7 +5411,11 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
// Only reset the current context.
cm->reset_frame_context = RESET_FRAME_CONTEXT_CURRENT;
}
#endif
#if CONFIG_EXT_TILE
if (cpi->oxcf.large_scale_tile)
cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_FORWARD;
#endif // CONFIG_EXT_TILE
#endif // !CONFIG_NO_FRAME_CONTEXT_SIGNALING
}
if (cpi->oxcf.mtu == 0) {
cm->num_tg = cpi->oxcf.num_tile_groups;
......@@ -6206,6 +6215,10 @@ int av1_get_compressed_data(AV1_COMP *cpi, unsigned int *frame_flags,
(oxcf->error_resilient_mode || oxcf->frame_parallel_decoding_mode)
? REFRESH_FRAME_CONTEXT_FORWARD
: REFRESH_FRAME_CONTEXT_BACKWARD;
#if CONFIG_EXT_TILE
if (oxcf->large_scale_tile)
cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_FORWARD;
#endif // CONFIG_EXT_TILE
cpi->refresh_last_frame = 1;
cpi->refresh_golden_frame = 0;
......
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