Make decode modules independent of tile index
authorJingning Han <jingning@google.com>
Tue, 22 Oct 2013 22:22:59 +0000 (15:22 -0700)
committerJingning Han <jingning@google.com>
Tue, 22 Oct 2013 22:22:59 +0000 (15:22 -0700)
Assign the pointer to mode_info stream per tile. Remove the use of
tile_col in the decoding modules.

Change-Id: I7df87086708a3d92c5e20e86bcfb04e458ff47a6

vp9/common/vp9_blockd.h
vp9/decoder/vp9_decodframe.c

index 31959c1..a0f646e 100644 (file)
@@ -201,6 +201,7 @@ typedef struct macroblockd {
   // A NULL indicates that the 8x8 is not part of the image
   MODE_INFO **mi_8x8;
   MODE_INFO **prev_mi_8x8;
+  MODE_INFO *mi_stream;
 
   int up_available;
   int left_available;
index 5ac5c2b..b8b63fe 100644 (file)
@@ -173,7 +173,6 @@ static int decode_tokens(VP9_COMMON *const cm, MACROBLOCKD *const xd,
 }
 
 static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE bsize,
-                        int tile_col,
                         int mi_row, int mi_col) {
   VP9_COMMON *const cm = &pbi->common;
   MACROBLOCKD *const xd = &pbi->mb;
@@ -187,9 +186,9 @@ static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE bsize,
   xd->prev_mi_8x8 = cm->prev_mi_grid_visible + offset;
 
   // we are using the mode info context stream here
-  xd->mi_8x8[0] = pbi->mi_streams[tile_col];
+  xd->mi_8x8[0] = xd->mi_stream;
   xd->mi_8x8[0]->mbmi.sb_type = bsize;
-  pbi->mi_streams[tile_col]++;
+  ++xd->mi_stream;
 
   // Special case: if prev_mi is NULL, the previous mode info context
   // cannot be used.
@@ -220,8 +219,7 @@ static void set_ref(VP9_COMMON *const cm, MACROBLOCKD *const xd,
   xd->corrupted |= cfg->corrupted;
 }
 
-static void decode_modes_b(VP9D_COMP *pbi, int tile_col,
-                           int mi_row, int mi_col,
+static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
                            vp9_reader *r, BLOCK_SIZE bsize, int index) {
   VP9_COMMON *const cm = &pbi->common;
   MACROBLOCKD *const xd = &pbi->mb;
@@ -233,7 +231,7 @@ static void decode_modes_b(VP9D_COMP *pbi, int tile_col,
     if (index > 0)
       return;
 
-  set_offsets(pbi, bsize, tile_col, mi_row, mi_col);
+  set_offsets(pbi, bsize, mi_row, mi_col);
   vp9_read_mode_info(cm, xd, mi_row, mi_col, r);
 
   if (less8x8)
@@ -270,8 +268,7 @@ static void decode_modes_b(VP9D_COMP *pbi, int tile_col,
   xd->corrupted |= vp9_reader_has_error(r);
 }
 
-static void decode_modes_sb(VP9D_COMP *pbi, int tile_col,
-                            int mi_row, int mi_col,
+static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
                             vp9_reader* r, BLOCK_SIZE bsize, int index) {
   VP9_COMMON *const cm = &pbi->common;
   MACROBLOCKD *const xd = &pbi->mb;
@@ -309,23 +306,23 @@ static void decode_modes_sb(VP9D_COMP *pbi, int tile_col,
 
   switch (partition) {
     case PARTITION_NONE:
-      decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize, 0);
+      decode_modes_b(pbi, mi_row, mi_col, r, subsize, 0);
       break;
     case PARTITION_HORZ:
-      decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize, 0);
+      decode_modes_b(pbi, mi_row, mi_col, r, subsize, 0);
       if (mi_row + hbs < cm->mi_rows)
-        decode_modes_b(pbi, tile_col, mi_row + hbs, mi_col, r, subsize, 1);
+        decode_modes_b(pbi, mi_row + hbs, mi_col, r, subsize, 1);
       break;
     case PARTITION_VERT:
-      decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize, 0);
+      decode_modes_b(pbi, mi_row, mi_col, r, subsize, 0);
       if (mi_col + hbs < cm->mi_cols)
-        decode_modes_b(pbi, tile_col, mi_row, mi_col + hbs, r, subsize, 1);
+        decode_modes_b(pbi, mi_row, mi_col + hbs, r, subsize, 1);
       break;
     case PARTITION_SPLIT: {
       int n;
       for (n = 0; n < 4; n++) {
         const int j = n >> 1, i = n & 1;
-        decode_modes_sb(pbi, tile_col, mi_row + j * hbs, mi_col + i * hbs,
+        decode_modes_sb(pbi, mi_row + j * hbs, mi_col + i * hbs,
                         r, subsize, n);
       }
     } break;
@@ -586,6 +583,9 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r, int tile_col) {
   VP9_COMMON *const cm = &pbi->common;
   int mi_row, mi_col;
   YV12_BUFFER_CONFIG *const fb = &cm->yv12_fb[cm->new_fb_idx];
+  MACROBLOCKD *xd = &pbi->mb;
+
+  xd->mi_stream = pbi->mi_streams[tile_col];
 
   if (pbi->do_loopfilter_inline) {
     if (num_threads > 1) {
@@ -606,7 +606,7 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r, int tile_col) {
     vp9_zero(cm->left_seg_context);
     for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end;
          mi_col += MI_BLOCK_SIZE)
-      decode_modes_sb(pbi, tile_col, mi_row, mi_col, r, BLOCK_64X64, 0);
+      decode_modes_sb(pbi, mi_row, mi_col, r, BLOCK_64X64, 0);
 
     if (pbi->do_loopfilter_inline) {
       // delay the loopfilter by 1 macroblock row.