TILE_GROUPS: omit tile length from last tile in the frame.
This change improves efficiency and means that tile groups
cause negligible loss (+0.03% BDR) in the current default
encoding configurations (1 tile group no matter how many tiles)
with frame-based wrapping.
In future, when wrapper formats support tile groups, lengths
can be omitted from the last tile in every tile group.
Change-Id: Ia701e6720208fbfa727f9aef0b692a6aafbcc93f
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 61216ab..bdc2617 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -4087,9 +4087,7 @@
for (tile_row = 0; tile_row < tile_rows; tile_row++) {
TileInfo tile_info;
-#if !CONFIG_TILE_GROUPS
const int is_last_row = (tile_row == tile_rows - 1);
-#endif
av1_tile_set_row(&tile_info, cm, tile_row);
for (tile_col = 0; tile_col < tile_cols; tile_col++) {
@@ -4100,13 +4098,11 @@
#endif
const TOKENEXTRA *tok = tok_buffers[tile_row][tile_col];
const TOKENEXTRA *tok_end = tok + cpi->tok_count[tile_row][tile_col];
-#if !CONFIG_TILE_GROUPS
const int is_last_col = (tile_col == tile_cols - 1);
const int is_last_tile = is_last_col && is_last_row;
+#if !CONFIG_TILE_GROUPS
(void)tile_idx;
#else
- // All tiles in a tile group have a length
- const int is_last_tile = 0;
if ((!mtu_size && tile_count > tg_size) ||
(mtu_size && tile_count && curr_tg_data_size >= mtu_size)) {
@@ -5004,12 +5000,7 @@
for (n = 0; n < n_tiles; n++) {
int tile_size;
-#if CONFIG_TILE_GROUPS
- if (0)
-#else
- if (n == n_tiles - 1)
-#endif
- {
+ if (n == n_tiles - 1) {
tile_size = data_size - rpos;
} else {
tile_size = mem_get_le32(dst + rpos);