From 8fe64a3a23db390d5d9cd47489863b5e51c09625 Mon Sep 17 00:00:00 2001 From: Thomas Davies Date: Tue, 4 Oct 2016 13:19:31 +0100 Subject: [PATCH] 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 --- av1/decoder/decodeframe.c | 6 ++---- av1/encoder/bitstream.c | 8 +++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 4007eaa8b..134274d8b 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c @@ -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 diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index ba119706c..4fe9acb95 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c @@ -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)); -- 2.40.0