]> granicus.if.org Git - libvpx/commitdiff
Refactor internal tile_info variables to support 1024 tiles
authorJingning Han <jingning@google.com>
Wed, 20 May 2015 17:15:25 +0000 (10:15 -0700)
committerJingning Han <jingning@google.com>
Wed, 20 May 2015 17:19:01 +0000 (10:19 -0700)
Move the 2D tile info arrays as global variables. This resolves
the local function stack overflow issue due to excessively large
tile info variables. This allows the internal operation to support
up to 1024 row and column tiles.

Change-Id: I6644cc929e5d3a778a5c03a712ebfc0b8729f576

vp9/decoder/vp9_decodeframe.c
vp9/decoder/vp9_decoder.h
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_encoder.h

index 468a0536a958d4033612d45fd3e3706eda373015..4fc0f58ceb0a5ba2b0a5c6e11d7e6b9e6c377ff5 100644 (file)
@@ -1893,12 +1893,6 @@ static void setup_tile_info(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
 #endif
 }
 
-typedef struct TileBuffer {
-  const uint8_t *data;
-  size_t size;
-  int col;  // only used with multi-threaded decoding
-} TileBuffer;
-
 // Reads the next tile returning its size and adjusting '*data' accordingly
 // based on 'is_last'.
 static void get_tile_buffer(const uint8_t *const data_end,
@@ -1939,7 +1933,7 @@ static void get_tile_buffer(const uint8_t *const data_end,
 static void get_tile_buffers(VP9Decoder *pbi,
                              const uint8_t *data, const uint8_t *data_end,
                              int tile_cols, int tile_rows,
-                             TileBuffer (*tile_buffers)[1 << 6]) {
+                             TileBuffer (*tile_buffers)[1024]) {
   int r, c;
 
   for (r = 0; r < tile_rows; ++r) {
@@ -1962,9 +1956,9 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
   const int tile_cols = 1 << cm->log2_tile_cols;
   const int tile_rows = 1 << cm->log2_tile_rows;
 #if CONFIG_ROW_TILE
-  TileBuffer tile_buffers[64][64];
+  TileBuffer (*tile_buffers)[1024] = pbi->tile_buffers;
 #else
-  TileBuffer tile_buffers[4][1 << 6];
+  TileBuffer tile_buffers[4][1024];
 #endif
   int tile_row, tile_col;
   int mi_row, mi_col;
@@ -2138,6 +2132,8 @@ static int compare_tile_buffers(const void *a, const void *b) {
   }
 }
 
+// TODO(jingning): Multi-thread tile decoding is not supporting
+// arbitrary row/column tile numbers yet.
 static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
                                       const uint8_t *data,
                                       const uint8_t *data_end) {
@@ -2148,7 +2144,7 @@ static const uint8_t *decode_tiles_mt(VP9Decoder *pbi,
   const int tile_cols = 1 << cm->log2_tile_cols;
   const int tile_rows = 1 << cm->log2_tile_rows;
   const int num_workers = MIN(pbi->max_threads & ~1, tile_cols);
-  TileBuffer tile_buffers[1][1 << 6];
+  TileBuffer tile_buffers[1][1024];
   int n;
   int final_worker = -1;
 
index 4f52bb9c473d2e4ed6fa1289f9e495bcdb0b227f..3f4e53e858cf0b3d0fcf901b2614e5cb5c41abb3 100644 (file)
@@ -33,6 +33,12 @@ typedef struct TileData {
   DECLARE_ALIGNED(16, MACROBLOCKD, xd);
 } TileData;
 
+typedef struct TileBuffer {
+  const uint8_t *data;
+  size_t size;
+  int col;  // only used with multi-threaded decoding
+} TileBuffer;
+
 typedef struct VP9Decoder {
   DECLARE_ALIGNED(16, MACROBLOCKD, mb);
 
@@ -59,6 +65,10 @@ typedef struct VP9Decoder {
   int max_threads;
   int inv_tile_order;
   int need_resync;  // wait for key/intra-only frame
+
+#if CONFIG_ROW_TILE
+  TileBuffer tile_buffers[1024][1024];
+#endif
 } VP9Decoder;
 
 int vp9_receive_compressed_data(struct VP9Decoder *pbi,
index 0bf8167cac3bc69f6dc747bb7b6392e61955ba45..dd013cc8f82be088c661787014fb3a3f37f2b41e 100644 (file)
@@ -4537,8 +4537,8 @@ static void encode_tiles(VP9_COMP *cpi) {
 
   int tile_col, tile_row;
 #if CONFIG_ROW_TILE
-  TileInfo tile[64][64];
-  TOKENEXTRA *tok[64][64];
+  TileInfo (*tile)[1024] = cpi->tile_info;
+  TOKENEXTRA *(*tok)[1024] = cpi->tile_tok;
 #else
   TileInfo tile[4][1 << 6];
   TOKENEXTRA *tok[4][1 << 6];
index e1c184247a2025dbd9644e2676c9af872caff3ea..e2a818a1f98ac1bf410edc2954df81619744d98a 100644 (file)
@@ -426,6 +426,11 @@ typedef struct VP9_COMP {
   int multi_arf_enabled;
   int multi_arf_last_grp_enabled;
 
+#if CONFIG_ROW_TILE
+  TileInfo tile_info[1024][1024];
+  TOKENEXTRA *tile_tok[1024][1024];
+#endif
+
 #if CONFIG_VP9_TEMPORAL_DENOISING
   VP9_DENOISER denoiser;
 #endif