Commit ac6093d1 authored by Scott LaVarnway's avatar Scott LaVarnway
Browse files

New mode_info_context storage -- undo revert

mode_info_context was stored as a grid of MODE_INFO structs.
The grid now constists of pointers to MODE_INFO structs.  The
MODE_INFO structs are now stored as a stream (decoder only),
eliminating unnecessary copies and is a little more cache
friendly.

Change-Id: I031d376284c6eb98a38ad5595b797f048a6cfc0d
parent 0607abc3
......@@ -31,22 +31,6 @@ void vp9_update_mode_info_border(VP9_COMMON *cm, MODE_INFO *mi) {
vpx_memset(&mi[i * stride], 0, sizeof(MODE_INFO));
}
void vp9_update_mode_info_in_image(VP9_COMMON *cm, MODE_INFO *mi) {
int i, j;
// For each in image mode_info element set the in image flag to 1
for (i = 0; i < cm->mi_rows; i++) {
MODE_INFO *ptr = mi;
for (j = 0; j < cm->mi_cols; j++) {
ptr->mbmi.in_image = 1;
ptr++; // Next element in the row
}
// Step over border element at start of next row
mi += cm->mode_info_stride;
}
}
void vp9_free_frame_buffers(VP9_COMMON *cm) {
int i;
......@@ -59,6 +43,8 @@ void vp9_free_frame_buffers(VP9_COMMON *cm) {
vpx_free(cm->prev_mip);
vpx_free(cm->above_seg_context);
vpx_free(cm->last_frame_seg_map);
vpx_free(cm->mi_grid_base);
vpx_free(cm->prev_mi_grid_base);
vpx_free(cm->above_context[0]);
for (i = 0; i < MAX_MB_PLANE; i++)
......@@ -67,6 +53,8 @@ void vp9_free_frame_buffers(VP9_COMMON *cm) {
cm->prev_mip = NULL;
cm->above_seg_context = NULL;
cm->last_frame_seg_map = NULL;
cm->mi_grid_base = NULL;
cm->prev_mi_grid_base = NULL;
}
static void set_mb_mi(VP9_COMMON *cm, int aligned_width, int aligned_height) {
......@@ -82,15 +70,18 @@ static void set_mb_mi(VP9_COMMON *cm, int aligned_width, int aligned_height) {
static void setup_mi(VP9_COMMON *cm) {
cm->mi = cm->mip + cm->mode_info_stride + 1;
cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1;
cm->mi_grid_visible = cm->mi_grid_base + cm->mode_info_stride + 1;
cm->prev_mi_grid_visible = cm->prev_mi_grid_base + cm->mode_info_stride + 1;
vpx_memset(cm->mip, 0,
cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
vp9_update_mode_info_border(cm, cm->mip);
vp9_update_mode_info_in_image(cm, cm->mi);
vpx_memset(cm->mi_grid_base, 0,
cm->mode_info_stride * (cm->mi_rows + 1) *
sizeof(*cm->mi_grid_base));
vp9_update_mode_info_border(cm, cm->mip);
vp9_update_mode_info_border(cm, cm->prev_mip);
vp9_update_mode_info_in_image(cm, cm->prev_mi);
}
int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height) {
......@@ -139,6 +130,14 @@ int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height) {
if (!cm->prev_mip)
goto fail;
cm->mi_grid_base = vpx_calloc(mi_size, sizeof(*cm->mi_grid_base));
if (!cm->mi_grid_base)
goto fail;
cm->prev_mi_grid_base = vpx_calloc(mi_size, sizeof(*cm->prev_mi_grid_base));
if (!cm->prev_mi_grid_base)
goto fail;
setup_mi(cm);
// FIXME(jkoleszar): allocate subsampled arrays for U/V once subsampling
......
......@@ -17,7 +17,6 @@
void vp9_initialize_common();
void vp9_update_mode_info_border(VP9_COMMON *cm, MODE_INFO *mi);
void vp9_update_mode_info_in_image(VP9_COMMON *cm, MODE_INFO *mi);
void vp9_create_common(VP9_COMMON *cm);
void vp9_remove_common(VP9_COMMON *cm);
......
......@@ -147,10 +147,6 @@ typedef struct {
// Flags used for prediction status of various bit-stream signals
unsigned char seg_id_predicted;
// Indicates if the block is part of the image (1) vs border (0)
// This can be useful in determining whether it provides a valid predictor
unsigned char in_image;
INTERPOLATIONFILTERTYPE interp_filter;
BLOCK_SIZE sb_type;
......@@ -206,10 +202,16 @@ typedef struct macroblockd {
struct scale_factors scale_factor[2];
MODE_INFO *prev_mode_info_context;
MODE_INFO *mode_info_context;
MODE_INFO *last_mi;
MODE_INFO *this_mi;
int mode_info_stride;
MODE_INFO *mic_stream_ptr;
// A NULL indicates that the 8x8 is not part of the image
MODE_INFO **mi_8x8;
MODE_INFO **prev_mi_8x8;
int up_available;
int left_available;
int right_available;
......@@ -319,7 +321,7 @@ extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT];
static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
const MACROBLOCKD *xd, int ib) {
const MODE_INFO *const mi = xd->mode_info_context;
const MODE_INFO *const mi = xd->this_mi;
const MB_MODE_INFO *const mbmi = &mi->mbmi;
if (plane_type != PLANE_TYPE_Y_WITH_DC ||
......@@ -334,13 +336,13 @@ static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
return plane_type == PLANE_TYPE_Y_WITH_DC ?
mode2txfm_map[xd->mode_info_context->mbmi.mode] : DCT_DCT;
mode2txfm_map[xd->this_mi->mbmi.mode] : DCT_DCT;
}
static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
return plane_type == PLANE_TYPE_Y_WITH_DC ?
mode2txfm_map[xd->mode_info_context->mbmi.mode] : DCT_DCT;
mode2txfm_map[xd->this_mi->mbmi.mode] : DCT_DCT;
}
static void setup_block_dptrs(MACROBLOCKD *xd, int ss_x, int ss_y) {
......@@ -389,7 +391,7 @@ static INLINE void foreach_transformed_block_in_plane(
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
foreach_transformed_block_visitor visit, void *arg) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const MB_MODE_INFO* mbmi = &xd->mode_info_context->mbmi;
const MB_MODE_INFO* mbmi = &xd->this_mi->mbmi;
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way.
......
......@@ -27,7 +27,7 @@ static void print_mi_data(VP9_COMMON *cm, FILE *file, char *descriptor,
int mi_row;
int mi_col;
int mi_index = 0;
MODE_INFO *mi = cm->mi;
MODE_INFO **mi_8x8 = cm->mi_grid_visible;
int rows = cm->mi_rows;
int cols = cm->mi_cols;
char prefix = descriptor[0];
......@@ -38,7 +38,8 @@ static void print_mi_data(VP9_COMMON *cm, FILE *file, char *descriptor,
fprintf(file, "%c ", prefix);
for (mi_col = 0; mi_col < cols; mi_col++) {
fprintf(file, "%2d ",
*((int*) ((char *) (&mi[mi_index].mbmi) + member_offset)));
*((int*) ((char *) (&mi_8x8[mi_index]->mbmi) +
member_offset)));
mi_index++;
}
fprintf(file, "\n");
......@@ -51,7 +52,7 @@ void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, char *file) {
int mi_col;
int mi_index = 0;
FILE *mvs = fopen(file, "a");
MODE_INFO *mi = cm->mi;
MODE_INFO **mi_8x8 = cm->mi_grid_visible;
int rows = cm->mi_rows;
int cols = cm->mi_cols;
......@@ -66,8 +67,8 @@ void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, char *file) {
for (mi_row = 0; mi_row < rows; mi_row++) {
fprintf(mvs,"V ");
for (mi_col = 0; mi_col < cols; mi_col++) {
fprintf(mvs, "%4d:%4d ", mi[mi_index].mbmi.mv[0].as_mv.row,
mi[mi_index].mbmi.mv[0].as_mv.col);
fprintf(mvs, "%4d:%4d ", mi_8x8[mi_index]->mbmi.mv[0].as_mv.row,
mi_8x8[mi_index]->mbmi.mv[0].as_mv.col);
mi_index++;
}
fprintf(mvs, "\n");
......
......@@ -510,10 +510,7 @@ void vp9_setup_past_independence(VP9_COMMON *cm) {
cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
vp9_update_mode_info_border(cm, cm->mip);
vp9_update_mode_info_in_image(cm, cm->mi);
vp9_update_mode_info_border(cm, cm->prev_mip);
vp9_update_mode_info_in_image(cm, cm->prev_mi);
vp9_zero(cm->ref_frame_sign_bias);
......
......@@ -43,12 +43,12 @@ void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col) {
int_mv dst_list[MAX_MV_REF_CANDIDATES];
int_mv mv_list[MAX_MV_REF_CANDIDATES];
MODE_INFO *const mi = xd->mode_info_context;
MODE_INFO *const mi = xd->this_mi;
assert(ref_idx == 0 || ref_idx == 1);
assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier
vp9_find_mv_refs_idx(cm, xd, mi, xd->prev_mode_info_context,
vp9_find_mv_refs_idx(cm, xd, mi, xd->last_mi,
mi->mbmi.ref_frame[ref_idx],
mv_list, block_idx, mi_row, mi_col);
......
......@@ -43,41 +43,50 @@ void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm,
int block_idx, int ref_idx,
int mi_row, int mi_col);
static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb,
const MODE_INFO *left_mb, int b) {
// FIXME(rbultje, jingning): temporary hack because jenkins doesn't
// understand this condition. This will go away soon.
const MODE_INFO *mi = cur_mb;
if (b == 0 || b == 2) {
/* On L edge, get from MB to left of us */
--cur_mb;
mi = left_mb;
if (!mi)
return DC_PRED;
if (is_inter_block(&cur_mb->mbmi)) {
if (mi->mbmi.ref_frame[0] != INTRA_FRAME) {
return DC_PRED;
} else if (cur_mb->mbmi.sb_type < BLOCK_8X8) {
return (cur_mb->bmi + 1 + b)->as_mode;
} else if (mi->mbmi.sb_type < BLOCK_8X8) {
return ((mi->bmi + 1 + b)->as_mode);
} else {
return cur_mb->mbmi.mode;
return mi->mbmi.mode;
}
}
assert(b == 1 || b == 3);
return (cur_mb->bmi + b - 1)->as_mode;
return (mi->bmi + b - 1)->as_mode;
}
static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
int b, int mi_stride) {
const MODE_INFO *above_mb, int b) {
const MODE_INFO *mi = cur_mb;
if (!(b >> 1)) {
/* On top edge, get from MB above us */
cur_mb -= mi_stride;
mi = above_mb;
if (!mi)
return DC_PRED;
if (is_inter_block(&cur_mb->mbmi)) {
if (mi->mbmi.ref_frame[0] != INTRA_FRAME) {
return DC_PRED;
} else if (cur_mb->mbmi.sb_type < BLOCK_8X8) {
return (cur_mb->bmi + 2 + b)->as_mode;
} else if (mi->mbmi.sb_type < BLOCK_8X8) {
return ((mi->bmi + 2 + b)->as_mode);
} else {
return cur_mb->mbmi.mode;
return mi->mbmi.mode;
}
}
return (cur_mb->bmi + b - 2)->as_mode;
return (mi->bmi + b - 2)->as_mode;
}
#endif // VP9_COMMON_VP9_FINDNEARMV_H_
......@@ -559,12 +559,12 @@ static void build_y_mask(const loop_filter_info_n *const lfi_n,
// by mi_row, mi_col.
// TODO(JBB): This function only works for yv12.
static void setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col,
const MODE_INFO *mi, const int mode_info_stride,
MODE_INFO **mi_8x8, const int mode_info_stride,
LOOP_FILTER_MASK *lfm) {
int idx_32, idx_16, idx_8;
const loop_filter_info_n *const lfi_n = &cm->lf_info;
const MODE_INFO *mip = mi;
const MODE_INFO *mip2 = mi;
MODE_INFO **mip = mi_8x8;
MODE_INFO **mip2 = mi_8x8;
// These are offsets to the next mi in the 64x64 block. It is what gets
// added to the mi ptr as we go through each loop. It helps us to avoids
......@@ -596,23 +596,23 @@ static void setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col,
// TODO(jimbankoski): Try moving most of the following code into decode
// loop and storing lfm in the mbmi structure so that we don't have to go
// through the recursive loop structure multiple times.
switch (mip->mbmi.sb_type) {
switch (mip[0]->mbmi.sb_type) {
case BLOCK_64X64:
build_masks(lfi_n, mip , 0, 0, lfm);
build_masks(lfi_n, mip[0] , 0, 0, lfm);
break;
case BLOCK_64X32:
build_masks(lfi_n, mip, 0, 0, lfm);
build_masks(lfi_n, mip[0], 0, 0, lfm);
mip2 = mip + mode_info_stride * 4;
if (4 >= max_rows)
break;
build_masks(lfi_n, mip2 , 32, 8, lfm);
build_masks(lfi_n, mip2[0], 32, 8, lfm);
break;
case BLOCK_32X64:
build_masks(lfi_n, mip, 0, 0, lfm);
build_masks(lfi_n, mip[0], 0, 0, lfm);
mip2 = mip + 4;
if (4 >= max_cols)
break;
build_masks(lfi_n, mip2, 4, 2, lfm);
build_masks(lfi_n, mip2[0], 4, 2, lfm);
break;
default:
for (idx_32 = 0; idx_32 < 4; mip += offset_32[idx_32], ++idx_32) {
......@@ -622,23 +622,23 @@ static void setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col,
const int mi_32_row_offset = ((idx_32 >> 1) << 2);
if (mi_32_col_offset >= max_cols || mi_32_row_offset >= max_rows)
continue;
switch (mip->mbmi.sb_type) {
switch (mip[0]->mbmi.sb_type) {
case BLOCK_32X32:
build_masks(lfi_n, mip, shift_y, shift_uv, lfm);
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
break;
case BLOCK_32X16:
build_masks(lfi_n, mip, shift_y, shift_uv, lfm);
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
if (mi_32_row_offset + 2 >= max_rows)
continue;
mip2 = mip + mode_info_stride * 2;
build_masks(lfi_n, mip2, shift_y + 16, shift_uv + 4, lfm);
build_masks(lfi_n, mip2[0], shift_y + 16, shift_uv + 4, lfm);
break;
case BLOCK_16X32:
build_masks(lfi_n, mip, shift_y, shift_uv, lfm);
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
if (mi_32_col_offset + 2 >= max_cols)
continue;
mip2 = mip + 2;
build_masks(lfi_n, mip2, shift_y + 2, shift_uv + 1, lfm);
build_masks(lfi_n, mip2[0], shift_y + 2, shift_uv + 1, lfm);
break;
default:
for (idx_16 = 0; idx_16 < 4; mip += offset_16[idx_16], ++idx_16) {
......@@ -652,29 +652,29 @@ static void setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col,
if (mi_16_col_offset >= max_cols || mi_16_row_offset >= max_rows)
continue;
switch (mip->mbmi.sb_type) {
switch (mip[0]->mbmi.sb_type) {
case BLOCK_16X16:
build_masks(lfi_n, mip, shift_y, shift_uv, lfm);
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
break;
case BLOCK_16X8:
build_masks(lfi_n, mip, shift_y, shift_uv, lfm);
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
if (mi_16_row_offset + 1 >= max_rows)
continue;
mip2 = mip + mode_info_stride;
build_y_mask(lfi_n, mip2, shift_y+8, lfm);
build_y_mask(lfi_n, mip2[0], shift_y+8, lfm);
break;
case BLOCK_8X16:
build_masks(lfi_n, mip, shift_y, shift_uv, lfm);
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
if (mi_16_col_offset +1 >= max_cols)
continue;
mip2 = mip + 1;
build_y_mask(lfi_n, mip2, shift_y+1, lfm);
build_y_mask(lfi_n, mip2[0], shift_y+1, lfm);
break;
default: {
const int shift_y = shift_32_y[idx_32] +
shift_16_y[idx_16] +
shift_8_y[0];
build_masks(lfi_n, mip, shift_y, shift_uv, lfm);
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
mip += offset[0];
for (idx_8 = 1; idx_8 < 4; mip += offset[idx_8], ++idx_8) {
const int shift_y = shift_32_y[idx_32] +
......@@ -688,7 +688,7 @@ static void setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col,
if (mi_8_col_offset >= max_cols ||
mi_8_row_offset >= max_rows)
continue;
build_y_mask(lfi_n, mip, shift_y, lfm);
build_y_mask(lfi_n, mip[0], shift_y, lfm);
}
break;
}
......@@ -792,7 +792,7 @@ static void setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col,
#if CONFIG_NON420
static void filter_block_plane_non420(VP9_COMMON *cm,
struct macroblockd_plane *plane,
const MODE_INFO *mi,
MODE_INFO **mi_8x8,
int mi_row, int mi_col) {
const int ss_x = plane->subsampling_x;
const int ss_y = plane->subsampling_y;
......@@ -816,24 +816,25 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
// Determine the vertical edges that need filtering
for (c = 0; c < MI_BLOCK_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
const int skip_this = mi[c].mbmi.skip_coeff
&& is_inter_block(&mi[c].mbmi);
const MODE_INFO *mi = mi_8x8[c];
const int skip_this = mi[0].mbmi.skip_coeff
&& is_inter_block(&mi[0].mbmi);
// left edge of current unit is block/partition edge -> no skip
const int block_edge_left = b_width_log2(mi[c].mbmi.sb_type) ?
!(c & ((1 << (b_width_log2(mi[c].mbmi.sb_type)-1)) - 1)) : 1;
const int block_edge_left = b_width_log2(mi[0].mbmi.sb_type) ?
!(c & ((1 << (b_width_log2(mi[0].mbmi.sb_type)-1)) - 1)) : 1;
const int skip_this_c = skip_this && !block_edge_left;
// top edge of current unit is block/partition edge -> no skip
const int block_edge_above = b_height_log2(mi[c].mbmi.sb_type) ?
!(r & ((1 << (b_height_log2(mi[c].mbmi.sb_type)-1)) - 1)) : 1;
const int block_edge_above = b_height_log2(mi[0].mbmi.sb_type) ?
!(r & ((1 << (b_height_log2(mi[0].mbmi.sb_type)-1)) - 1)) : 1;
const int skip_this_r = skip_this && !block_edge_above;
const TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV)
? get_uv_tx_size(&mi[c].mbmi)
: mi[c].mbmi.tx_size;
? get_uv_tx_size(&mi[0].mbmi)
: mi[0].mbmi.tx_size;
const int skip_border_4x4_c = ss_x && mi_col + c == cm->mi_cols - 1;
const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
// Filter level can vary per MI
if (!build_lfi(&cm->lf_info, &mi[c].mbmi, lfi[r] + (c >> ss_x)))
if (!build_lfi(&cm->lf_info, &mi[0].mbmi, lfi[r] + (c >> ss_x)))
continue;
// Build masks based on the transform size of each block
......@@ -892,7 +893,7 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
mask_4x4_c & border_mask,
mask_4x4_int[r], lfi[r]);
dst->buf += 8 * dst->stride;
mi += row_step_stride;
mi_8x8 += row_step_stride;
}
// Now do horizontal pass
......@@ -913,7 +914,7 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
static void filter_block_plane(VP9_COMMON *const cm,
struct macroblockd_plane *const plane,
const MODE_INFO *mi,
MODE_INFO **mi_8x8,
int mi_row, int mi_col,
LOOP_FILTER_MASK *lfm) {
const int ss_x = plane->subsampling_x;
......@@ -936,7 +937,8 @@ static void filter_block_plane(VP9_COMMON *const cm,
// Determine the vertical edges that need filtering
for (c = 0; c < MI_BLOCK_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
if (!build_lfi(&cm->lf_info, &mi[c].mbmi, lfi[r] + (c >> ss_x)))
const MODE_INFO *mi = mi_8x8[c];
if (!build_lfi(&cm->lf_info, &mi[0].mbmi, lfi[r] + (c >> ss_x)))
continue;
}
if (!plane->plane_type) {
......@@ -959,7 +961,7 @@ static void filter_block_plane(VP9_COMMON *const cm,
lfi[r]);
}
dst->buf += 8 * dst->stride;
mi += row_step_stride;
mi_8x8 += row_step_stride;
}
// Now do horizontal pass
......@@ -1001,7 +1003,7 @@ void vp9_loop_filter_rows(const YV12_BUFFER_CONFIG *frame_buffer,
#endif
for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) {
MODE_INFO* const mi = cm->mi + mi_row * cm->mode_info_stride;
MODE_INFO **mi_8x8 = cm->mi_grid_visible + mi_row * cm->mode_info_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
int plane;
......@@ -1012,17 +1014,18 @@ void vp9_loop_filter_rows(const YV12_BUFFER_CONFIG *frame_buffer,
#if CONFIG_NON420
if (use_420)
#endif
setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mode_info_stride, &lfm);
setup_mask(cm, mi_row, mi_col, mi_8x8 + mi_col, cm->mode_info_stride,
&lfm);
for (plane = 0; plane < num_planes; ++plane) {
#if CONFIG_NON420
if (use_420)
#endif
filter_block_plane(cm, &xd->plane[plane], mi + mi_col, mi_row, mi_col,
&lfm);
filter_block_plane(cm, &xd->plane[plane], mi_8x8 + mi_col, mi_row,
mi_col, &lfm);
#if CONFIG_NON420
else
filter_block_plane_non420(cm, &xd->plane[plane], mi + mi_col,
filter_block_plane_non420(cm, &xd->plane[plane], mi_8x8 + mi_col,
mi_row, mi_col);
#endif
}
......@@ -1035,7 +1038,6 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, MACROBLOCKD *xd,
int y_only, int partial) {
int start_mi_row, end_mi_row, mi_rows_to_filter;
if (!frame_filter_level) return;
start_mi_row = 0;
mi_rows_to_filter = cm->mi_rows;
if (partial && cm->mi_rows > 8) {
......
/*
* Copyright (c) 2012 The WebM project authors. All Rights Reserved.
*
......@@ -203,8 +204,8 @@ void vp9_find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
const MV *const mv_ref = &mv_ref_search[i];
if (is_inside(cm, mi_col, mi_row, mv_ref)) {
const int check_sub_blocks = block_idx >= 0;
const MODE_INFO *const candidate_mi = &mi[mv_ref->col + mv_ref->row
* xd->mode_info_stride];
const MODE_INFO *const candidate_mi = xd->mi_8x8[mv_ref->col + mv_ref->row
* xd->mode_info_stride];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
// Keep counts for entropy encoding.
context_counter += mode_2_counter[candidate->mode];
......@@ -230,8 +231,9 @@ void vp9_find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
for (; i < MVREF_NEIGHBOURS; ++i) {
const MV *const mv_ref = &mv_ref_search[i];
if (is_inside(cm, mi_col, mi_row, mv_ref)) {
const MB_MODE_INFO *const candidate = &mi[mv_ref->col + mv_ref->row
* xd->mode_info_stride].mbmi;
const MB_MODE_INFO *const candidate = &xd->mi_8x8[mv_ref->col +
mv_ref->row
* xd->mode_info_stride]->mbmi;
if (candidate->ref_frame[0] == ref_frame) {
ADD_MV_REF_LIST(candidate->mv[0]);
......@@ -259,8 +261,9 @@ void vp9_find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
for (i = 0; i < MVREF_NEIGHBOURS; ++i) {
const MV *mv_ref = &mv_ref_search[i];
if (is_inside(cm, mi_col, mi_row, mv_ref)) {
const MB_MODE_INFO *const candidate = &mi[mv_ref->col + mv_ref->row
* xd->mode_info_stride].mbmi;
const MB_MODE_INFO *const candidate = &xd->mi_8x8[mv_ref->col +
mv_ref->row
* xd->mode_info_stride]->mbmi;
// If the candidate is INTRA we don't want to consider its mv.
if (is_inter_block(candidate))
......
......@@ -164,6 +164,10 @@ typedef struct VP9Common {
MODE_INFO *prev_mip; /* MODE_INFO array 'mip' from last decoded frame */
MODE_INFO *prev_mi; /* 'mi' from last frame (points into prev_mip) */
MODE_INFO **mi_grid_base;
MODE_INFO **mi_grid_visible;
MODE_INFO **prev_mi_grid_base;
MODE_INFO **prev_mi_grid_visible;
// Persistent mb segment id map used in prediction.
unsigned char *last_frame_seg_map;
......
......@@ -18,28 +18,28 @@
// Returns a context number for the given MB prediction signal
unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
const MODE_INFO *const mi = xd->mode_info_context;
const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
const int left_in_image = xd->left_available && left_mbmi->in_image;
const int above_in_image = xd->up_available && above_mbmi->in_image;
const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride];
const MODE_INFO * const left_mi = xd->mi_8x8[-1];
const int left_in_image = xd->left_available && left_mi;
const int above_in_image = xd->up_available && above_mi;
// Note:
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
// left
const int left_mv_pred = is_inter_mode(left_mbmi->mode);
const int left_mv_pred = left_in_image ? is_inter_mode(left_mi->mbmi.mode)
: 0;