Tile groups: ensure each tile in a TG has a length.

This ensures TGs can be decoded even if the whole
frame has not been received and the frame length
is not known.

Change-Id: If24837fcc3b5c46554751be792e91100de73e8d6
This commit is contained in:
Thomas Davies 2016-10-04 13:19:31 +01:00 коммит произвёл Yaowu Xu
Родитель be44c5f46f
Коммит 8fe64a3a23
2 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -2705,7 +2705,6 @@ static void get_tile_buffers(
for (r = 0; r < tile_rows; ++r) {
for (c = 0; c < tile_cols; ++c, ++tc) {
const int is_last = (r == tile_rows - 1) && (c == tile_cols - 1);
TileBufferDec *const buf = &tile_buffers[r][c];
hdr_offset = (tc && tc == first_tile_in_tg) ? hdr_size : 0;
@ -2720,9 +2719,8 @@ 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, is_last,
&pbi->common.error, &data, pbi->decrypt_cb,
pbi->decrypt_state, buf);
get_tile_buffer(data_end, pbi->tile_size_bytes, 0, &pbi->common.error,
&data, pbi->decrypt_cb, pbi->decrypt_state, buf);
}
}
#else

Просмотреть файл

@ -3277,13 +3277,15 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
for (tile_col = 0; tile_col < tile_cols; tile_col++) {
TileBufferEnc *const buf = &tile_buffers[tile_row][tile_col];
const int is_last_col = (tile_col == tile_cols - 1);
const int is_last_tile = is_last_col && is_last_row;
unsigned int tile_size;
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
#if !CONFIG_TILE_GROUPS
const int is_last_tile = is_last_col && is_last_row;
#else
const int tile_idx = tile_row * tile_cols + tile_col;
// All tiles in a tile group have a length
const int is_last_tile = 0;
if (tile_count >= tg_size) {
// Copy uncompressed header
memcpy(dst + total_size, dst, uncompressed_hdr_size * sizeof(uint8_t));