cm->frame_contexts[cm->frame_context_idx] = cm->fc;
}
- vpx_memset(cm->prev_mip, 0,
- cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
+ if (frame_is_intra_only(cm))
+ vpx_memset(cm->prev_mip, 0,
+ cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
+
vpx_memset(cm->mip, 0,
cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
const int *ref_sign_bias = cm->ref_frame_sign_bias;
int i, refmv_count = 0;
const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type];
- const MB_MODE_INFO *const prev_mbmi = prev_mi ? &prev_mi->mbmi : NULL;
+ const MB_MODE_INFO *const prev_mbmi = cm->coding_use_prev_mi && prev_mi ?
+ &prev_mi->mbmi : NULL;
int different_ref_found = 0;
int context_counter = 0;
int error_resilient_mode;
int frame_parallel_decoding_mode;
+ // Flag indicates if prev_mi can be used in coding:
+ // 0: encoder assumes decoder does not have prev_mi
+ // 1: encoder assumes decoder has and uses prev_mi
+ unsigned int coding_use_prev_mi;
+
int log2_tile_cols, log2_tile_rows;
// Private data associated with the frame buffer callbacks.
static void set_prev_mi(VP9_COMMON *cm) {
const int use_prev_in_find_mv_refs = cm->width == cm->last_width &&
cm->height == cm->last_height &&
- !cm->error_resilient_mode &&
!cm->intra_only &&
cm->last_show_frame;
// Special case: set prev_mi to NULL when the previous mode info
xd->mi_8x8 = cm->mi_grid_visible + offset;
xd->prev_mi_8x8 = cm->prev_mi_grid_visible + offset;
- // 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->last_mi = cm->coding_use_prev_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;
}
if (!cm->error_resilient_mode) {
+ cm->coding_use_prev_mi = 1;
cm->refresh_frame_context = vp9_rb_read_bit(rb);
cm->frame_parallel_decoding_mode = vp9_rb_read_bit(rb);
} else {
+ cm->coding_use_prev_mi = 0;
cm->refresh_frame_context = 0;
cm->frame_parallel_decoding_mode = 1;
}
alloc_tile_storage(pbi, tile_rows, tile_cols);
xd->mode_info_stride = cm->mode_info_stride;
- set_prev_mi(cm);
+ if (cm->coding_use_prev_mi)
+ set_prev_mi(cm);
+ else
+ cm->prev_mi = NULL;
setup_plane_dequants(cm, xd, cm->base_qindex);
vp9_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y);
xd->mi_8x8 = cm->mi_grid_visible + idx_str;
xd->prev_mi_8x8 = cm->prev_mi_grid_visible + idx_str;
- // 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] = cm->mi + idx_str;
cm->error_resilient_mode = (cpi->oxcf.error_resilient_mode != 0);
cm->frame_parallel_decoding_mode =
(cpi->oxcf.frame_parallel_decoding_mode != 0);
+
+ // By default, encoder assumes decoder can use prev_mi.
+ cm->coding_use_prev_mi = 1;
if (cm->error_resilient_mode) {
+ cm->coding_use_prev_mi = 0;
cm->frame_parallel_decoding_mode = 1;
cm->reset_frame_context = 0;
cm->refresh_frame_context = 0;