Commit a0de6d59 authored by Thomas Davies's avatar Thomas Davies

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
parent 96382283
......@@ -3353,6 +3353,7 @@ static void get_tile_buffers(
for (r = 0; r < tile_rows; ++r) {
for (c = 0; c < tile_cols; ++c, ++tc) {
TileBufferDec *const buf = &tile_buffers[r][c];
const int is_last = (r == tile_rows - 1) && (c == tile_cols - 1);
hdr_offset = (tc && tc == first_tile_in_tg) ? hdr_size : 0;
buf->col = c;
......@@ -3366,8 +3367,9 @@ static void get_tile_buffers(
}
first_tile_in_tg += tc == first_tile_in_tg ? pbi->tg_size : 0;
data += hdr_offset;
get_tile_buffer(data_end, pbi->tile_size_bytes, 0, &pbi->common.error,
&data, pbi->decrypt_cb, pbi->decrypt_state, buf);
get_tile_buffer(data_end, pbi->tile_size_bytes, is_last,
&pbi->common.error, &data, pbi->decrypt_cb,
pbi->decrypt_state, buf);
}
}
#else
......
......@@ -4087,9 +4087,7 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
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 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
#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 @@ static int remux_tiles(const AV1_COMMON *const cm, uint8_t *dst,
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);
......
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