[NORMATIVE] Signal which tile is used for cdf update
This patch adds signalling of the tile id to use for cdf
update as suggested by Peter de Rivaz and agreed at the
working group meeting of 3rd April 2018. The encoder can
select any tile it likes for the cdf update but at the
moment chooses the largest tile to signal. The decoder
uses which ever tile was signalled.
The additional bits are only signalled if there is more
than one tile and the signalling uses
(log2_tile_cols + log2_tile_rows) bits.
BUG=aomedia:1678
Change-Id: I1db514b8078ccf2a0ba5f3a249ee2eaf59917250
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 126a5c3..7c59568 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2215,6 +2215,8 @@
return;
}
if (cm->tile_rows * cm->tile_cols > 1) {
+ // tile id used for cdf update
+ aom_wb_write_literal(wb, 0, cm->log2_tile_cols + cm->log2_tile_rows);
// Number of bytes in tile size - 1
aom_wb_write_literal(wb, 3, 2);
}
@@ -3681,6 +3683,11 @@
max_tile_col_size, &tile_size_bytes, &unused);
total_size += tile_data_offset;
assert(tile_size_bytes >= 1 && tile_size_bytes <= 4);
+
+ // fill in id of tile to use for the cdf update which encoder currently
+ // sets to the largest tile (but is up to the encoder)
+ aom_wb_overwrite_literal(saved_wb, cm->largest_tile_id,
+ cm->log2_tile_cols + cm->log2_tile_rows);
aom_wb_overwrite_literal(saved_wb, tile_size_bytes - 1, 2);
// Update the OBU length if remux_tiles() reduced the size.