Moving mi configuration loop from vp9_read_mode_info to set_offsets. set_offsets() is a right place to configure all mi-related pointers. Change-Id: I7d2fda72de5fc27e86c6589543b41fa044681dbf
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 56b05ce..7fc1dd2 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c
@@ -348,23 +348,27 @@ static void set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd, const TileInfo *const tile, BLOCK_SIZE bsize, int mi_row, int mi_col) { - const int bh = num_8x8_blocks_high_lookup[bsize]; const int bw = num_8x8_blocks_wide_lookup[bsize]; + const int bh = num_8x8_blocks_high_lookup[bsize]; + const int x_mis = MIN(bw, cm->mi_cols - mi_col); + const int y_mis = MIN(bh, cm->mi_rows - mi_row); const int offset = mi_row * cm->mode_info_stride + mi_col; const int tile_offset = tile->mi_row_start * cm->mode_info_stride + tile->mi_col_start; + int x, y; xd->mi_8x8 = cm->mi_grid_visible + offset; xd->prev_mi_8x8 = cm->prev_mi_grid_visible + offset; - - // we are using the mode info context stream here - xd->mi_8x8[0] = xd->mi_stream + offset - tile_offset; - xd->mi_8x8[0]->mbmi.sb_type = bsize; - // Special case: if prev_mi is NULL, the previous mode info context // cannot be used. xd->last_mi = cm->prev_mi ? xd->prev_mi_8x8[0] : NULL; + xd->mi_8x8[0] = xd->mi_stream + offset - tile_offset; + xd->mi_8x8[0]->mbmi.sb_type = bsize; + for (y = 0; y < y_mis; ++y) + for (x = !y; x < x_mis; ++x) + xd->mi_8x8[y * cm->mode_info_stride + x] = xd->mi_8x8[0]; + set_skip_context(xd, xd->above_context, xd->left_context, mi_row, mi_col); // Distance of Mb to the various image edges. These are specified to 8th pel