]> granicus.if.org Git - libvpx/commitdiff
Tile groups: ensure each tile in a TG has a length.
authorThomas Davies <thdavies@cisco.com>
Tue, 4 Oct 2016 12:19:31 +0000 (13:19 +0100)
committerYaowu Xu <yaowu@google.com>
Fri, 28 Oct 2016 20:01:40 +0000 (13:01 -0700)
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
av1/encoder/bitstream.c

index 4007eaa8baa8f2c4049d31e4473d8494c536c6db..134274d8b5515904de6b193b7f83820e60c8cb45 100644 (file)
@@ -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
index ba119706c48dad800d52597658935ebaffc1a847..4fe9acb9550982dafeb25aca87d80ec9a24e54a4 100644 (file)
@@ -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));