Merge "VP9: Eliminate MB_MODE_INFO"

This commit is contained in:
Scott LaVarnway 2016-01-20 12:19:27 +00:00 committed by Gerrit Code Review
commit a7e0b1ea01
35 changed files with 833 additions and 860 deletions

View File

@ -13,7 +13,7 @@
PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi,
const MODE_INFO *left_mi, int b) {
if (b == 0 || b == 2) {
if (!left_mi || is_inter_block(&left_mi->mbmi))
if (!left_mi || is_inter_block(left_mi))
return DC_PRED;
return get_y_mode(left_mi, b + 1);
@ -26,7 +26,7 @@ PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi,
PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi,
const MODE_INFO *above_mi, int b) {
if (b == 0 || b == 1) {
if (!above_mi || is_inter_block(&above_mi->mbmi))
if (!above_mi || is_inter_block(above_mi))
return DC_PRED;
return get_y_mode(above_mi, b + 2);
@ -40,12 +40,12 @@ void vp9_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->mi[0]->mbmi;
const MODE_INFO* mi = xd->mi[0];
// 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.
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd)
: mbmi->tx_size;
const TX_SIZE tx_size = plane ? get_uv_tx_size(mi, pd)
: mi->tx_size;
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];

View File

@ -64,7 +64,7 @@ typedef struct {
typedef int8_t MV_REFERENCE_FRAME;
// This structure now relates to 8x8 block regions.
typedef struct {
typedef struct MODE_INFO {
// Common for both INTER and INTRA blocks
BLOCK_SIZE sb_type;
PREDICTION_MODE mode;
@ -82,24 +82,21 @@ typedef struct {
// TODO(slavarnway): Delete and use bmi[3].as_mv[] instead.
int_mv mv[2];
} MB_MODE_INFO;
typedef struct MODE_INFO {
MB_MODE_INFO mbmi;
b_mode_info bmi[4];
} MODE_INFO;
static INLINE PREDICTION_MODE get_y_mode(const MODE_INFO *mi, int block) {
return mi->mbmi.sb_type < BLOCK_8X8 ? mi->bmi[block].as_mode
: mi->mbmi.mode;
return mi->sb_type < BLOCK_8X8 ? mi->bmi[block].as_mode
: mi->mode;
}
static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) {
return mbmi->ref_frame[0] > INTRA_FRAME;
static INLINE int is_inter_block(const MODE_INFO *mi) {
return mi->ref_frame[0] > INTRA_FRAME;
}
static INLINE int has_second_ref(const MB_MODE_INFO *mbmi) {
return mbmi->ref_frame[1] > INTRA_FRAME;
static INLINE int has_second_ref(const MODE_INFO *mi) {
return mi->ref_frame[1] > INTRA_FRAME;
}
PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi,
@ -160,8 +157,6 @@ typedef struct macroblockd {
MODE_INFO **mi;
MODE_INFO *left_mi;
MODE_INFO *above_mi;
MB_MODE_INFO *left_mbmi;
MB_MODE_INFO *above_mbmi;
int up_available;
int left_available;
@ -212,19 +207,19 @@ extern const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES];
static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const MODE_INFO *const mi = xd->mi[0];
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi))
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mi))
return DCT_DCT;
return intra_mode_to_tx_type_lookup[mbmi->mode];
return intra_mode_to_tx_type_lookup[mi->mode];
}
static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
const MACROBLOCKD *xd, int ib) {
const MODE_INFO *const mi = xd->mi[0];
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(&mi->mbmi))
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mi))
return DCT_DCT;
return intra_mode_to_tx_type_lookup[get_y_mode(mi, ib)];
@ -242,9 +237,9 @@ static INLINE TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize,
}
}
static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
static INLINE TX_SIZE get_uv_tx_size(const MODE_INFO *mi,
const struct macroblockd_plane *pd) {
return get_uv_tx_size_impl(mbmi->tx_size, mbmi->sb_type, pd->subsampling_x,
return get_uv_tx_size_impl(mi->tx_size, mi->sb_type, pd->subsampling_x,
pd->subsampling_y);
}

View File

@ -35,7 +35,7 @@ static void print_mi_data(VP9_COMMON *cm, FILE *file, const char *descriptor,
fprintf(file, "%c ", prefix);
for (mi_col = 0; mi_col < cols; mi_col++) {
fprintf(file, "%2d ",
*((int*) ((char *) (&mi[0]->mbmi) +
*((int*) ((char *) (mi[0]) +
member_offset)));
mi++;
}
@ -53,18 +53,18 @@ void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, const char *file) {
int rows = cm->mi_rows;
int cols = cm->mi_cols;
print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, sb_type));
print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode));
print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0]));
print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, tx_size));
print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode));
print_mi_data(cm, mvs, "Partitions:", offsetof(MODE_INFO, sb_type));
print_mi_data(cm, mvs, "Modes:", offsetof(MODE_INFO, mode));
print_mi_data(cm, mvs, "Ref frame:", offsetof(MODE_INFO, ref_frame[0]));
print_mi_data(cm, mvs, "Transform:", offsetof(MODE_INFO, tx_size));
print_mi_data(cm, mvs, "UV Modes:", offsetof(MODE_INFO, uv_mode));
// output skip infomation.
log_frame_info(cm, "Skips:", mvs);
for (mi_row = 0; mi_row < rows; mi_row++) {
fprintf(mvs, "S ");
for (mi_col = 0; mi_col < cols; mi_col++) {
fprintf(mvs, "%2d ", mi[0]->mbmi.skip);
fprintf(mvs, "%2d ", mi[0]->skip);
mi++;
}
fprintf(mvs, "\n");
@ -78,8 +78,8 @@ void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, const 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[0]->mbmi.mv[0].as_mv.row,
mi[0]->mbmi.mv[0].as_mv.col);
fprintf(mvs, "%4d:%4d ", mi[0]->mv[0].as_mv.row,
mi[0]->mv[0].as_mv.col);
mi++;
}
fprintf(mvs, "\n");

View File

@ -232,9 +232,9 @@ static void update_sharpness(loop_filter_info_n *lfi, int sharpness_lvl) {
}
static uint8_t get_filter_level(const loop_filter_info_n *lfi_n,
const MB_MODE_INFO *mbmi) {
return lfi_n->lvl[mbmi->segment_id][mbmi->ref_frame[0]]
[mode_lf_lut[mbmi->mode]];
const MODE_INFO *mi) {
return lfi_n->lvl[mi->segment_id][mi->ref_frame[0]]
[mode_lf_lut[mi->mode]];
}
void vp9_loop_filter_init(VP9_COMMON *cm) {
@ -709,11 +709,10 @@ static void build_masks(const loop_filter_info_n *const lfi_n,
const MODE_INFO *mi, const int shift_y,
const int shift_uv,
LOOP_FILTER_MASK *lfm) {
const MB_MODE_INFO *mbmi = &mi->mbmi;
const BLOCK_SIZE block_size = mbmi->sb_type;
const TX_SIZE tx_size_y = mbmi->tx_size;
const BLOCK_SIZE block_size = mi->sb_type;
const TX_SIZE tx_size_y = mi->tx_size;
const TX_SIZE tx_size_uv = get_uv_tx_size_impl(tx_size_y, block_size, 1, 1);
const int filter_level = get_filter_level(lfi_n, mbmi);
const int filter_level = get_filter_level(lfi_n, mi);
uint64_t *const left_y = &lfm->left_y[tx_size_y];
uint64_t *const above_y = &lfm->above_y[tx_size_y];
uint64_t *const int_4x4_y = &lfm->int_4x4_y;
@ -754,7 +753,7 @@ static void build_masks(const loop_filter_info_n *const lfi_n,
// If the block has no coefficients and is not intra we skip applying
// the loop filter on block edges.
if (mbmi->skip && is_inter_block(mbmi))
if (mi->skip && is_inter_block(mi))
return;
// Here we are adding a mask for the transform size. The transform
@ -788,10 +787,9 @@ static void build_masks(const loop_filter_info_n *const lfi_n,
static void build_y_mask(const loop_filter_info_n *const lfi_n,
const MODE_INFO *mi, const int shift_y,
LOOP_FILTER_MASK *lfm) {
const MB_MODE_INFO *mbmi = &mi->mbmi;
const BLOCK_SIZE block_size = mbmi->sb_type;
const TX_SIZE tx_size_y = mbmi->tx_size;
const int filter_level = get_filter_level(lfi_n, mbmi);
const BLOCK_SIZE block_size = mi->sb_type;
const TX_SIZE tx_size_y = mi->tx_size;
const int filter_level = get_filter_level(lfi_n, mi);
uint64_t *const left_y = &lfm->left_y[tx_size_y];
uint64_t *const above_y = &lfm->above_y[tx_size_y];
uint64_t *const int_4x4_y = &lfm->int_4x4_y;
@ -812,7 +810,7 @@ static void build_y_mask(const loop_filter_info_n *const lfi_n,
*above_y |= above_prediction_mask[block_size] << shift_y;
*left_y |= left_prediction_mask[block_size] << shift_y;
if (mbmi->skip && is_inter_block(mbmi))
if (mi->skip && is_inter_block(mi))
return;
*above_y |= (size_mask[block_size] &
@ -980,7 +978,7 @@ void vp9_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[0]->mbmi.sb_type) {
switch (mip[0]->sb_type) {
case BLOCK_64X64:
build_masks(lfi_n, mip[0] , 0, 0, lfm);
break;
@ -1006,7 +1004,7 @@ void vp9_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[0]->mbmi.sb_type) {
switch (mip[0]->sb_type) {
case BLOCK_32X32:
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
break;
@ -1036,7 +1034,7 @@ void vp9_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[0]->mbmi.sb_type) {
switch (mip[0]->sb_type) {
case BLOCK_16X16:
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
break;
@ -1186,8 +1184,8 @@ void vp9_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 MODE_INFO *mi = mi_8x8[c];
const BLOCK_SIZE sb_type = mi[0].mbmi.sb_type;
const int skip_this = mi[0].mbmi.skip && is_inter_block(&mi[0].mbmi);
const BLOCK_SIZE sb_type = mi[0].sb_type;
const int skip_this = mi[0].skip && is_inter_block(mi);
// left edge of current unit is block/partition edge -> no skip
const int block_edge_left = (num_4x4_blocks_wide_lookup[sb_type] > 1) ?
!(c & (num_8x8_blocks_wide_lookup[sb_type] - 1)) : 1;
@ -1196,13 +1194,13 @@ void vp9_filter_block_plane_non420(VP9_COMMON *cm,
const int block_edge_above = (num_4x4_blocks_high_lookup[sb_type] > 1) ?
!(r & (num_8x8_blocks_high_lookup[sb_type] - 1)) : 1;
const int skip_this_r = skip_this && !block_edge_above;
const TX_SIZE tx_size = get_uv_tx_size(&mi[0].mbmi, plane);
const TX_SIZE tx_size = get_uv_tx_size(mi, plane);
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 (!(lfl[(r << 3) + (c >> ss_x)] =
get_filter_level(&cm->lf_info, &mi[0].mbmi)))
get_filter_level(&cm->lf_info, mi)))
continue;
// Build masks based on the transform size of each block
@ -1640,12 +1638,12 @@ static const uint8_t first_block_in_16x16[8][8] = {
// This function sets up the bit masks for a block represented
// by mi_row, mi_col in a 64x64 region.
// TODO(SJL): This function only works for yv12.
void vp9_build_mask(VP9_COMMON *cm, const MB_MODE_INFO *mbmi, int mi_row,
void vp9_build_mask(VP9_COMMON *cm, const MODE_INFO *mi, int mi_row,
int mi_col, int bw, int bh) {
const BLOCK_SIZE block_size = mbmi->sb_type;
const TX_SIZE tx_size_y = mbmi->tx_size;
const BLOCK_SIZE block_size = mi->sb_type;
const TX_SIZE tx_size_y = mi->tx_size;
const loop_filter_info_n *const lfi_n = &cm->lf_info;
const int filter_level = get_filter_level(lfi_n, mbmi);
const int filter_level = get_filter_level(lfi_n, mi);
const TX_SIZE tx_size_uv = get_uv_tx_size_impl(tx_size_y, block_size, 1, 1);
LOOP_FILTER_MASK *const lfm = get_lfm(&cm->lf, mi_row, mi_col);
uint64_t *const left_y = &lfm->left_y[tx_size_y];
@ -1693,7 +1691,7 @@ void vp9_build_mask(VP9_COMMON *cm, const MB_MODE_INFO *mbmi, int mi_row,
// If the block has no coefficients and is not intra we skip applying
// the loop filter on block edges.
if (mbmi->skip && is_inter_block(mbmi))
if (mi->skip && is_inter_block(mi))
return;
// Add a mask for the transform size. The transform size mask is set to

View File

@ -134,7 +134,7 @@ static INLINE LOOP_FILTER_MASK *get_lfm(const struct loopfilter *lf,
return &lf->lfm[(mi_col >> 3) + ((mi_row >> 3) * lf->lfm_stride)];
}
void vp9_build_mask(struct VP9Common *cm, const MB_MODE_INFO *mbmi, int mi_row,
void vp9_build_mask(struct VP9Common *cm, const MODE_INFO *mi, int mi_row,
int mi_col, int bw, int bh);
void vp9_adjust_mask(struct VP9Common *const cm, const int mi_row,
const int mi_col, LOOP_FILTER_MASK *lfm);

View File

@ -203,12 +203,12 @@ static void mfqe_block(BLOCK_SIZE bs, const uint8_t *y, const uint8_t *u,
static int mfqe_decision(MODE_INFO *mi, BLOCK_SIZE cur_bs) {
// Check the motion in current block(for inter frame),
// or check the motion in the correlated block in last frame (for keyframe).
const int mv_len_square = mi->mbmi.mv[0].as_mv.row *
mi->mbmi.mv[0].as_mv.row +
mi->mbmi.mv[0].as_mv.col *
mi->mbmi.mv[0].as_mv.col;
const int mv_len_square = mi->mv[0].as_mv.row *
mi->mv[0].as_mv.row +
mi->mv[0].as_mv.col *
mi->mv[0].as_mv.col;
const int mv_threshold = 100;
return mi->mbmi.mode >= NEARESTMV && // Not an intra block
return mi->mode >= NEARESTMV && // Not an intra block
cur_bs >= BLOCK_16X16 &&
mv_len_square <= mv_threshold;
}
@ -220,7 +220,7 @@ static void mfqe_partition(VP9_COMMON *cm, MODE_INFO *mi, BLOCK_SIZE bs,
uint8_t *yd, uint8_t *ud, uint8_t *vd,
int yd_stride, int uvd_stride) {
int mi_offset, y_offset, uv_offset;
const BLOCK_SIZE cur_bs = mi->mbmi.sb_type;
const BLOCK_SIZE cur_bs = mi->sb_type;
const int qdiff = cm->base_qindex - cm->postproc_state.last_base_qindex;
const int bsl = b_width_log2_lookup[bs];
PARTITION_TYPE partition = partition_lookup[bsl][cur_bs];

View File

@ -20,7 +20,7 @@ static void find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
uint8_t *mode_context) {
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 POSITION *const mv_ref_search = mv_ref_blocks[mi->sb_type];
int different_ref_found = 0;
int context_counter = 0;
const MV_REF *const prev_frame_mvs = cm->use_prev_frame_mvs ?
@ -38,15 +38,14 @@ static void find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row *
xd->mi_stride];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
// Keep counts for entropy encoding.
context_counter += mode_2_counter[candidate->mode];
context_counter += mode_2_counter[candidate_mi->mode];
different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame)
if (candidate_mi->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, block),
refmv_count, mv_ref_list, Done);
else if (candidate->ref_frame[1] == ref_frame)
else if (candidate_mi->ref_frame[1] == ref_frame)
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 1, mv_ref->col, block),
refmv_count, mv_ref_list, Done);
}
@ -58,14 +57,14 @@ static void find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
for (; i < MVREF_NEIGHBOURS; ++i) {
const POSITION *const mv_ref = &mv_ref_search[i];
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
const MB_MODE_INFO *const candidate =
&xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
const MODE_INFO *const candidate_mi =
xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride];
different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(candidate->mv[0], refmv_count, mv_ref_list, Done);
else if (candidate->ref_frame[1] == ref_frame)
ADD_MV_REF_LIST(candidate->mv[1], refmv_count, mv_ref_list, Done);
if (candidate_mi->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(candidate_mi->mv[0], refmv_count, mv_ref_list, Done);
else if (candidate_mi->ref_frame[1] == ref_frame)
ADD_MV_REF_LIST(candidate_mi->mv[1], refmv_count, mv_ref_list, Done);
}
}
@ -85,11 +84,11 @@ static void find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
for (i = 0; i < MVREF_NEIGHBOURS; ++i) {
const POSITION *mv_ref = &mv_ref_search[i];
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
const MB_MODE_INFO *const candidate =
&xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
const MODE_INFO *const candidate_mi =
xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride];
// If the candidate is INTRA we don't want to consider its mv.
IF_DIFF_REF_FRAME_ADD_MV(candidate, ref_frame, ref_sign_bias,
IF_DIFF_REF_FRAME_ADD_MV(candidate_mi, ref_frame, ref_sign_bias,
refmv_count, mv_ref_list, Done);
}
}
@ -163,7 +162,7 @@ void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
assert(MAX_MV_REF_CANDIDATES == 2);
find_mv_refs_idx(cm, xd, mi, mi->mbmi.ref_frame[ref], mv_list, block,
find_mv_refs_idx(cm, xd, mi, mi->ref_frame[ref], mv_list, block,
mi_row, mi_col, mode_context);
near_mv->as_int = 0;

View File

@ -136,19 +136,19 @@ static INLINE void clamp_mv_ref(MV *mv, const MACROBLOCKD *xd) {
// on whether the block_size < 8x8 and we have check_sub_blocks set.
static INLINE int_mv get_sub_block_mv(const MODE_INFO *candidate, int which_mv,
int search_col, int block_idx) {
return block_idx >= 0 && candidate->mbmi.sb_type < BLOCK_8X8
return block_idx >= 0 && candidate->sb_type < BLOCK_8X8
? candidate->bmi[idx_n_column_to_subblock[block_idx][search_col == 0]]
.as_mv[which_mv]
: candidate->mbmi.mv[which_mv];
: candidate->mv[which_mv];
}
// Performs mv sign inversion if indicated by the reference frame combination.
static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
static INLINE int_mv scale_mv(const MODE_INFO *mi, int ref,
const MV_REFERENCE_FRAME this_ref_frame,
const int *ref_sign_bias) {
int_mv mv = mbmi->mv[ref];
if (ref_sign_bias[mbmi->ref_frame[ref]] != ref_sign_bias[this_ref_frame]) {
int_mv mv = mi->mv[ref];
if (ref_sign_bias[mi->ref_frame[ref]] != ref_sign_bias[this_ref_frame]) {
mv.as_mv.row *= -1;
mv.as_mv.col *= -1;
}

View File

@ -406,22 +406,17 @@ static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
// Are edges available for intra prediction?
xd->up_available = (mi_row != 0);
xd->left_available = (mi_col > tile->mi_col_start);
// TODO(slavarnway): eliminate up/left available ???
if (xd->up_available) {
xd->above_mi = xd->mi[-xd->mi_stride];
// above_mi may be NULL in VP9 encoder's first pass.
xd->above_mbmi = xd->above_mi ? &xd->above_mi->mbmi : NULL;
} else {
xd->above_mi = NULL;
xd->above_mbmi = NULL;
}
if (xd->left_available) {
xd->left_mi = xd->mi[-1];
// left_mi may be NULL in VP9 encoder's first pass.
xd->left_mbmi = xd->left_mi ? &xd->left_mi->mbmi : NULL;
} else {
xd->left_mi = NULL;
xd->left_mbmi = NULL;
}
}

View File

@ -19,12 +19,12 @@ int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
// 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.
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const int left_type = xd->left_available && is_inter_block(left_mbmi) ?
left_mbmi->interp_filter : SWITCHABLE_FILTERS;
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
const int above_type = xd->up_available && is_inter_block(above_mbmi) ?
above_mbmi->interp_filter : SWITCHABLE_FILTERS;
const MODE_INFO *const left_mi = xd->left_mi;
const int left_type = xd->left_available && is_inter_block(left_mi) ?
left_mi->interp_filter : SWITCHABLE_FILTERS;
const MODE_INFO *const above_mi = xd->above_mi;
const int above_type = xd->up_available && is_inter_block(above_mi) ?
above_mi->interp_filter : SWITCHABLE_FILTERS;
if (left_type == above_type)
return left_type;
@ -44,18 +44,18 @@ int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
// 2 - intra/--, --/intra
// 3 - intra/intra
int vp9_get_intra_inter_context(const MACROBLOCKD *xd) {
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const int has_above = xd->up_available;
const int has_left = xd->left_available;
if (has_above && has_left) { // both edges available
const int above_intra = !is_inter_block(above_mbmi);
const int left_intra = !is_inter_block(left_mbmi);
const int above_intra = !is_inter_block(above_mi);
const int left_intra = !is_inter_block(left_mi);
return left_intra && above_intra ? 3
: left_intra || above_intra;
} else if (has_above || has_left) { // one edge available
return 2 * !is_inter_block(has_above ? above_mbmi : left_mbmi);
return 2 * !is_inter_block(has_above ? above_mi : left_mi);
} else {
return 0;
}
@ -64,8 +64,8 @@ int vp9_get_intra_inter_context(const MACROBLOCKD *xd) {
int vp9_get_reference_mode_context(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
int ctx;
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const int has_above = xd->up_available;
const int has_left = xd->left_available;
// Note:
@ -73,26 +73,26 @@ int vp9_get_reference_mode_context(const VP9_COMMON *cm,
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
if (has_above && has_left) { // both edges available
if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi))
if (!has_second_ref(above_mi) && !has_second_ref(left_mi))
// neither edge uses comp pred (0/1)
ctx = (above_mbmi->ref_frame[0] == cm->comp_fixed_ref) ^
(left_mbmi->ref_frame[0] == cm->comp_fixed_ref);
else if (!has_second_ref(above_mbmi))
ctx = (above_mi->ref_frame[0] == cm->comp_fixed_ref) ^
(left_mi->ref_frame[0] == cm->comp_fixed_ref);
else if (!has_second_ref(above_mi))
// one of two edges uses comp pred (2/3)
ctx = 2 + (above_mbmi->ref_frame[0] == cm->comp_fixed_ref ||
!is_inter_block(above_mbmi));
else if (!has_second_ref(left_mbmi))
ctx = 2 + (above_mi->ref_frame[0] == cm->comp_fixed_ref ||
!is_inter_block(above_mi));
else if (!has_second_ref(left_mi))
// one of two edges uses comp pred (2/3)
ctx = 2 + (left_mbmi->ref_frame[0] == cm->comp_fixed_ref ||
!is_inter_block(left_mbmi));
ctx = 2 + (left_mi->ref_frame[0] == cm->comp_fixed_ref ||
!is_inter_block(left_mi));
else // both edges use comp pred (4)
ctx = 4;
} else if (has_above || has_left) { // one edge available
const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
const MODE_INFO *edge_mi = has_above ? above_mi : left_mi;
if (!has_second_ref(edge_mbmi))
if (!has_second_ref(edge_mi))
// edge does not use comp pred (0/1)
ctx = edge_mbmi->ref_frame[0] == cm->comp_fixed_ref;
ctx = edge_mi->ref_frame[0] == cm->comp_fixed_ref;
else
// edge uses comp pred (3)
ctx = 3;
@ -107,8 +107,8 @@ int vp9_get_reference_mode_context(const VP9_COMMON *cm,
int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
int pred_context;
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const int above_in_image = xd->up_available;
const int left_in_image = xd->left_available;
@ -120,26 +120,26 @@ int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
const int var_ref_idx = !fix_ref_idx;
if (above_in_image && left_in_image) { // both edges available
const int above_intra = !is_inter_block(above_mbmi);
const int left_intra = !is_inter_block(left_mbmi);
const int above_intra = !is_inter_block(above_mi);
const int left_intra = !is_inter_block(left_mi);
if (above_intra && left_intra) { // intra/intra (2)
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter
const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
const MODE_INFO *edge_mi = above_intra ? left_mi : above_mi;
if (!has_second_ref(edge_mbmi)) // single pred (1/3)
pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]);
if (!has_second_ref(edge_mi)) // single pred (1/3)
pred_context = 1 + 2 * (edge_mi->ref_frame[0] != cm->comp_var_ref[1]);
else // comp pred (1/3)
pred_context = 1 + 2 * (edge_mbmi->ref_frame[var_ref_idx]
pred_context = 1 + 2 * (edge_mi->ref_frame[var_ref_idx]
!= cm->comp_var_ref[1]);
} else { // inter/inter
const int l_sg = !has_second_ref(left_mbmi);
const int a_sg = !has_second_ref(above_mbmi);
const MV_REFERENCE_FRAME vrfa = a_sg ? above_mbmi->ref_frame[0]
: above_mbmi->ref_frame[var_ref_idx];
const MV_REFERENCE_FRAME vrfl = l_sg ? left_mbmi->ref_frame[0]
: left_mbmi->ref_frame[var_ref_idx];
const int l_sg = !has_second_ref(left_mi);
const int a_sg = !has_second_ref(above_mi);
const MV_REFERENCE_FRAME vrfa = a_sg ? above_mi->ref_frame[0]
: above_mi->ref_frame[var_ref_idx];
const MV_REFERENCE_FRAME vrfl = l_sg ? left_mi->ref_frame[0]
: left_mi->ref_frame[var_ref_idx];
if (vrfa == vrfl && cm->comp_var_ref[1] == vrfa) {
pred_context = 0;
@ -167,16 +167,16 @@ int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
}
}
} else if (above_in_image || left_in_image) { // one edge available
const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi;
const MODE_INFO *edge_mi = above_in_image ? above_mi : left_mi;
if (!is_inter_block(edge_mbmi)) {
if (!is_inter_block(edge_mi)) {
pred_context = 2;
} else {
if (has_second_ref(edge_mbmi))
pred_context = 4 * (edge_mbmi->ref_frame[var_ref_idx]
if (has_second_ref(edge_mi))
pred_context = 4 * (edge_mi->ref_frame[var_ref_idx]
!= cm->comp_var_ref[1]);
else
pred_context = 3 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]);
pred_context = 3 * (edge_mi->ref_frame[0] != cm->comp_var_ref[1]);
}
} else { // no edges available (2)
pred_context = 2;
@ -188,8 +188,8 @@ int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
int pred_context;
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const int has_above = xd->up_available;
const int has_left = xd->left_available;
// Note:
@ -197,25 +197,25 @@ int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
if (has_above && has_left) { // both edges available
const int above_intra = !is_inter_block(above_mbmi);
const int left_intra = !is_inter_block(left_mbmi);
const int above_intra = !is_inter_block(above_mi);
const int left_intra = !is_inter_block(left_mi);
if (above_intra && left_intra) { // intra/intra
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter or inter/intra
const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
if (!has_second_ref(edge_mbmi))
pred_context = 4 * (edge_mbmi->ref_frame[0] == LAST_FRAME);
const MODE_INFO *edge_mi = above_intra ? left_mi : above_mi;
if (!has_second_ref(edge_mi))
pred_context = 4 * (edge_mi->ref_frame[0] == LAST_FRAME);
else
pred_context = 1 + (edge_mbmi->ref_frame[0] == LAST_FRAME ||
edge_mbmi->ref_frame[1] == LAST_FRAME);
pred_context = 1 + (edge_mi->ref_frame[0] == LAST_FRAME ||
edge_mi->ref_frame[1] == LAST_FRAME);
} else { // inter/inter
const int above_has_second = has_second_ref(above_mbmi);
const int left_has_second = has_second_ref(left_mbmi);
const MV_REFERENCE_FRAME above0 = above_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME above1 = above_mbmi->ref_frame[1];
const MV_REFERENCE_FRAME left0 = left_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME left1 = left_mbmi->ref_frame[1];
const int above_has_second = has_second_ref(above_mi);
const int left_has_second = has_second_ref(left_mi);
const MV_REFERENCE_FRAME above0 = above_mi->ref_frame[0];
const MV_REFERENCE_FRAME above1 = above_mi->ref_frame[1];
const MV_REFERENCE_FRAME left0 = left_mi->ref_frame[0];
const MV_REFERENCE_FRAME left1 = left_mi->ref_frame[1];
if (above_has_second && left_has_second) {
pred_context = 1 + (above0 == LAST_FRAME || above1 == LAST_FRAME ||
@ -234,15 +234,15 @@ int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
}
}
} else if (has_above || has_left) { // one edge available
const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
if (!is_inter_block(edge_mbmi)) { // intra
const MODE_INFO *edge_mi = has_above ? above_mi : left_mi;
if (!is_inter_block(edge_mi)) { // intra
pred_context = 2;
} else { // inter
if (!has_second_ref(edge_mbmi))
pred_context = 4 * (edge_mbmi->ref_frame[0] == LAST_FRAME);
if (!has_second_ref(edge_mi))
pred_context = 4 * (edge_mi->ref_frame[0] == LAST_FRAME);
else
pred_context = 1 + (edge_mbmi->ref_frame[0] == LAST_FRAME ||
edge_mbmi->ref_frame[1] == LAST_FRAME);
pred_context = 1 + (edge_mi->ref_frame[0] == LAST_FRAME ||
edge_mi->ref_frame[1] == LAST_FRAME);
}
} else { // no edges available
pred_context = 2;
@ -254,8 +254,8 @@ int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
int pred_context;
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const int has_above = xd->up_available;
const int has_left = xd->left_available;
@ -264,29 +264,29 @@ int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
if (has_above && has_left) { // both edges available
const int above_intra = !is_inter_block(above_mbmi);
const int left_intra = !is_inter_block(left_mbmi);
const int above_intra = !is_inter_block(above_mi);
const int left_intra = !is_inter_block(left_mi);
if (above_intra && left_intra) { // intra/intra
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter or inter/intra
const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
if (!has_second_ref(edge_mbmi)) {
if (edge_mbmi->ref_frame[0] == LAST_FRAME)
const MODE_INFO *edge_mi = above_intra ? left_mi : above_mi;
if (!has_second_ref(edge_mi)) {
if (edge_mi->ref_frame[0] == LAST_FRAME)
pred_context = 3;
else
pred_context = 4 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME);
pred_context = 4 * (edge_mi->ref_frame[0] == GOLDEN_FRAME);
} else {
pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME ||
edge_mbmi->ref_frame[1] == GOLDEN_FRAME);
pred_context = 1 + 2 * (edge_mi->ref_frame[0] == GOLDEN_FRAME ||
edge_mi->ref_frame[1] == GOLDEN_FRAME);
}
} else { // inter/inter
const int above_has_second = has_second_ref(above_mbmi);
const int left_has_second = has_second_ref(left_mbmi);
const MV_REFERENCE_FRAME above0 = above_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME above1 = above_mbmi->ref_frame[1];
const MV_REFERENCE_FRAME left0 = left_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME left1 = left_mbmi->ref_frame[1];
const int above_has_second = has_second_ref(above_mi);
const int left_has_second = has_second_ref(left_mi);
const MV_REFERENCE_FRAME above0 = above_mi->ref_frame[0];
const MV_REFERENCE_FRAME above1 = above_mi->ref_frame[1];
const MV_REFERENCE_FRAME left0 = left_mi->ref_frame[0];
const MV_REFERENCE_FRAME left1 = left_mi->ref_frame[1];
if (above_has_second && left_has_second) {
if (above0 == left0 && above1 == left1)
@ -321,16 +321,16 @@ int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
}
}
} else if (has_above || has_left) { // one edge available
const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
const MODE_INFO *edge_mi = has_above ? above_mi : left_mi;
if (!is_inter_block(edge_mbmi) ||
(edge_mbmi->ref_frame[0] == LAST_FRAME && !has_second_ref(edge_mbmi)))
if (!is_inter_block(edge_mi) ||
(edge_mi->ref_frame[0] == LAST_FRAME && !has_second_ref(edge_mi)))
pred_context = 2;
else if (!has_second_ref(edge_mbmi))
pred_context = 4 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME);
else if (!has_second_ref(edge_mi))
pred_context = 4 * (edge_mi->ref_frame[0] == GOLDEN_FRAME);
else
pred_context = 3 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME ||
edge_mbmi->ref_frame[1] == GOLDEN_FRAME);
pred_context = 3 * (edge_mi->ref_frame[0] == GOLDEN_FRAME ||
edge_mi->ref_frame[1] == GOLDEN_FRAME);
} else { // no edges available (2)
pred_context = 2;
}

View File

@ -42,8 +42,8 @@ static INLINE int vp9_get_pred_context_seg_id(const MACROBLOCKD *xd) {
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const int above_sip = (above_mi != NULL) ?
above_mi->mbmi.seg_id_predicted : 0;
const int left_sip = (left_mi != NULL) ? left_mi->mbmi.seg_id_predicted : 0;
above_mi->seg_id_predicted : 0;
const int left_sip = (left_mi != NULL) ? left_mi->seg_id_predicted : 0;
return above_sip + left_sip;
}
@ -56,8 +56,8 @@ static INLINE vpx_prob vp9_get_pred_prob_seg_id(const struct segmentation *seg,
static INLINE int vp9_get_skip_context(const MACROBLOCKD *xd) {
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const int above_skip = (above_mi != NULL) ? above_mi->mbmi.skip : 0;
const int left_skip = (left_mi != NULL) ? left_mi->mbmi.skip : 0;
const int above_skip = (above_mi != NULL) ? above_mi->skip : 0;
const int left_skip = (left_mi != NULL) ? left_mi->skip : 0;
return above_skip + left_skip;
}
@ -110,15 +110,15 @@ static INLINE vpx_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm,
// left of the entries corresponding to real blocks.
// The prediction flags in these dummy entries are initialized to 0.
static INLINE int get_tx_size_context(const MACROBLOCKD *xd) {
const int max_tx_size = max_txsize_lookup[xd->mi[0]->mbmi.sb_type];
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const int max_tx_size = max_txsize_lookup[xd->mi[0]->sb_type];
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const int has_above = xd->up_available;
const int has_left = xd->left_available;
int above_ctx = (has_above && !above_mbmi->skip) ? (int)above_mbmi->tx_size
: max_tx_size;
int left_ctx = (has_left && !left_mbmi->skip) ? (int)left_mbmi->tx_size
: max_tx_size;
int above_ctx = (has_above && !above_mi->skip) ? (int)above_mi->tx_size
: max_tx_size;
int left_ctx = (has_left && !left_mi->skip) ? (int)left_mi->tx_size
: max_tx_size;
if (!has_left)
left_ctx = above_ctx;

View File

@ -159,8 +159,8 @@ static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
int mi_x, int mi_y) {
struct macroblockd_plane *const pd = &xd->plane[plane];
const MODE_INFO *mi = xd->mi[0];
const int is_compound = has_second_ref(&mi->mbmi);
const InterpKernel *kernel = vp9_filter_kernels[mi->mbmi.interp_filter];
const int is_compound = has_second_ref(mi);
const InterpKernel *kernel = vp9_filter_kernels[mi->interp_filter];
int ref;
for (ref = 0; ref < 1 + is_compound; ++ref) {
@ -168,9 +168,9 @@ static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
struct buf_2d *const pre_buf = &pd->pre[ref];
struct buf_2d *const dst_buf = &pd->dst;
uint8_t *const dst = dst_buf->buf + dst_buf->stride * y + x;
const MV mv = mi->mbmi.sb_type < BLOCK_8X8
const MV mv = mi->sb_type < BLOCK_8X8
? average_split_mvs(pd, mi, ref, block)
: mi->mbmi.mv[ref].as_mv;
: mi->mv[ref].as_mv;
// TODO(jkoleszar): This clamping is done in the incorrect place for the
// scaling case. It needs to be done on the scaled MV, not the pre-scaling
@ -191,8 +191,8 @@ static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
const int x_start = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x));
const int y_start = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y));
#if CONFIG_BETTER_HW_COMPATIBILITY
assert(xd->mi[0]->mbmi.sb_type != BLOCK_4X8 &&
xd->mi[0]->mbmi.sb_type != BLOCK_8X4);
assert(xd->mi[0]->sb_type != BLOCK_4X8 &&
xd->mi[0]->sb_type != BLOCK_8X4);
assert(mv_q4.row == mv.row * (1 << (1 - pd->subsampling_y)) &&
mv_q4.col == mv.col * (1 << (1 - pd->subsampling_x)));
#endif
@ -250,7 +250,7 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
const int bw = 4 * num_4x4_w;
const int bh = 4 * num_4x4_h;
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8) {
if (xd->mi[0]->sb_type < BLOCK_8X8) {
int i = 0, x, y;
assert(bsize == BLOCK_8X8);
for (y = 0; y < num_4x4_h; ++y)

View File

@ -42,7 +42,7 @@ static INLINE const scan_order *get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size,
PLANE_TYPE type, int block_idx) {
const MODE_INFO *const mi = xd->mi[0];
if (is_inter_block(&mi->mbmi) || type != PLANE_TYPE_Y || xd->lossless) {
if (is_inter_block(mi) || type != PLANE_TYPE_Y || xd->lossless) {
return &vp9_default_scan_orders[tx_size];
} else {
const PREDICTION_MODE mode = get_y_mode(mi, block_idx);

View File

@ -365,16 +365,16 @@ static void inverse_transform_block_intra(MACROBLOCKD* xd, int plane,
static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd,
vpx_reader *r,
MB_MODE_INFO *const mbmi,
MODE_INFO *const mi,
int plane,
int row, int col,
TX_SIZE tx_size) {
struct macroblockd_plane *const pd = &xd->plane[plane];
PREDICTION_MODE mode = (plane == 0) ? mbmi->mode : mbmi->uv_mode;
PREDICTION_MODE mode = (plane == 0) ? mi->mode : mi->uv_mode;
uint8_t *dst;
dst = &pd->dst.buf[4 * row * pd->dst.stride + 4 * col];
if (mbmi->sb_type < BLOCK_8X8)
if (mi->sb_type < BLOCK_8X8)
if (plane == 0)
mode = xd->mi[0]->bmi[(row << 1) + col].as_mode;
@ -382,25 +382,25 @@ static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd,
dst, pd->dst.stride, dst, pd->dst.stride,
col, row, plane);
if (!mbmi->skip) {
if (!mi->skip) {
const TX_TYPE tx_type = (plane || xd->lossless) ?
DCT_DCT : intra_mode_to_tx_type_lookup[mode];
const scan_order *sc = (plane || xd->lossless) ?
&vp9_default_scan_orders[tx_size] : &vp9_scan_orders[tx_size][tx_type];
const int eob = vp9_decode_block_tokens(xd, plane, sc, col, row, tx_size,
r, mbmi->segment_id);
r, mi->segment_id);
inverse_transform_block_intra(xd, plane, tx_type, tx_size,
dst, pd->dst.stride, eob);
}
}
static int reconstruct_inter_block(MACROBLOCKD *const xd, vpx_reader *r,
MB_MODE_INFO *const mbmi, int plane,
MODE_INFO *const mi, int plane,
int row, int col, TX_SIZE tx_size) {
struct macroblockd_plane *const pd = &xd->plane[plane];
const scan_order *sc = &vp9_default_scan_orders[tx_size];
const int eob = vp9_decode_block_tokens(xd, plane, sc, col, row, tx_size, r,
mbmi->segment_id);
mi->segment_id);
inverse_transform_block_inter(xd, plane, tx_size,
&pd->dst.buf[4 * row * pd->dst.stride + 4 * col],
@ -588,8 +588,8 @@ static void dec_build_inter_predictors(VP9Decoder *const pbi, MACROBLOCKD *xd,
int x_start = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x));
int y_start = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y));
#if CONFIG_BETTER_HW_COMPATIBILITY
assert(xd->mi[0]->mbmi.sb_type != BLOCK_4X8 &&
xd->mi[0]->mbmi.sb_type != BLOCK_8X4);
assert(xd->mi[0]->sb_type != BLOCK_4X8 &&
xd->mi[0]->sb_type != BLOCK_8X4);
assert(mv_q4.row == mv->row * (1 << (1 - pd->subsampling_y)) &&
mv_q4.col == mv->col * (1 << (1 - pd->subsampling_x)));
#endif
@ -716,13 +716,13 @@ static void dec_build_inter_predictors_sb(VP9Decoder *const pbi,
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
const MODE_INFO *mi = xd->mi[0];
const InterpKernel *kernel = vp9_filter_kernels[mi->mbmi.interp_filter];
const BLOCK_SIZE sb_type = mi->mbmi.sb_type;
const int is_compound = has_second_ref(&mi->mbmi);
const InterpKernel *kernel = vp9_filter_kernels[mi->interp_filter];
const BLOCK_SIZE sb_type = mi->sb_type;
const int is_compound = has_second_ref(mi);
int ref;
for (ref = 0; ref < 1 + is_compound; ++ref) {
const MV_REFERENCE_FRAME frame = mi->mbmi.ref_frame[ref];
const MV_REFERENCE_FRAME frame = mi->ref_frame[ref];
RefBuffer *ref_buf = &pbi->common.frame_refs[frame - LAST_FRAME];
xd->block_refs[ref] = ref_buf;
@ -762,7 +762,7 @@ static void dec_build_inter_predictors_sb(VP9Decoder *const pbi,
}
}
} else {
const MV mv = mi->mbmi.mv[ref].as_mv;
const MV mv = mi->mv[ref].as_mv;
dec_build_inter_predictors(pbi, xd, plane, n4w_x4, n4h_x4,
0, 0, n4w_x4, n4h_x4, mi_x, mi_y, kernel,
sf, pre_buf, dst_buf, &mv, ref_frame_buf,
@ -772,11 +772,11 @@ static void dec_build_inter_predictors_sb(VP9Decoder *const pbi,
}
}
static INLINE TX_SIZE dec_get_uv_tx_size(const MB_MODE_INFO *mbmi,
static INLINE TX_SIZE dec_get_uv_tx_size(const MODE_INFO *mi,
int n4_wl, int n4_hl) {
// get minimum log2 num4x4s dimension
const int x = VPXMIN(n4_wl, n4_hl);
return VPXMIN(mbmi->tx_size, x);
return VPXMIN(mi->tx_size, x);
}
static INLINE void dec_reset_skip_context(MACROBLOCKD *xd) {
@ -799,10 +799,10 @@ static void set_plane_n4(MACROBLOCKD *const xd, int bw, int bh, int bwl,
}
}
static MB_MODE_INFO *set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd,
BLOCK_SIZE bsize, int mi_row, int mi_col,
int bw, int bh, int x_mis, int y_mis,
int bwl, int bhl) {
static MODE_INFO *set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd,
BLOCK_SIZE bsize, int mi_row, int mi_col,
int bw, int bh, int x_mis, int y_mis,
int bwl, int bhl) {
const int offset = mi_row * cm->mi_stride + mi_col;
int x, y;
const TileInfo *const tile = &xd->tile;
@ -811,7 +811,7 @@ static MB_MODE_INFO *set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd,
xd->mi[0] = &cm->mi[offset];
// TODO(slavarnway): Generate sb_type based on bwl and bhl, instead of
// passing bsize from decode_partition().
xd->mi[0]->mbmi.sb_type = bsize;
xd->mi[0]->sb_type = bsize;
for (y = 0; y < y_mis; ++y)
for (x = !y; x < x_mis; ++x) {
xd->mi[y * cm->mi_stride + x] = xd->mi[0];
@ -826,7 +826,7 @@ static MB_MODE_INFO *set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd,
set_mi_row_col(xd, tile, mi_row, bh, mi_col, bw, cm->mi_rows, cm->mi_cols);
vp9_setup_dst_planes(xd->plane, get_frame_new_buffer(cm), mi_row, mi_col);
return &xd->mi[0]->mbmi;
return xd->mi[0];
}
static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
@ -840,8 +840,8 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
const int x_mis = VPXMIN(bw, cm->mi_cols - mi_col);
const int y_mis = VPXMIN(bh, cm->mi_rows - mi_row);
MB_MODE_INFO *mbmi = set_offsets(cm, xd, bsize, mi_row, mi_col,
bw, bh, x_mis, y_mis, bwl, bhl);
MODE_INFO *mi = set_offsets(cm, xd, bsize, mi_row, mi_col,
bw, bh, x_mis, y_mis, bwl, bhl);
if (bsize >= BLOCK_8X8 && (cm->subsampling_x || cm->subsampling_y)) {
const BLOCK_SIZE uv_subsize =
@ -853,17 +853,17 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
vpx_read_mode_info(pbi, xd, mi_row, mi_col, r, x_mis, y_mis);
if (mbmi->skip) {
if (mi->skip) {
dec_reset_skip_context(xd);
}
if (!is_inter_block(mbmi)) {
if (!is_inter_block(mi)) {
int plane;
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE tx_size =
plane ? dec_get_uv_tx_size(mbmi, pd->n4_wl, pd->n4_hl)
: mbmi->tx_size;
plane ? dec_get_uv_tx_size(mi, pd->n4_wl, pd->n4_hl)
: mi->tx_size;
const int num_4x4_w = pd->n4_w;
const int num_4x4_h = pd->n4_h;
const int step = (1 << tx_size);
@ -875,7 +875,7 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
for (row = 0; row < max_blocks_high; row += step)
for (col = 0; col < max_blocks_wide; col += step)
predict_and_reconstruct_intra_block(xd, r, mbmi, plane,
predict_and_reconstruct_intra_block(xd, r, mi, plane,
row, col, tx_size);
}
} else {
@ -883,15 +883,15 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
dec_build_inter_predictors_sb(pbi, xd, mi_row, mi_col);
// Reconstruction
if (!mbmi->skip) {
if (!mi->skip) {
int eobtotal = 0;
int plane;
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE tx_size =
plane ? dec_get_uv_tx_size(mbmi, pd->n4_wl, pd->n4_hl)
: mbmi->tx_size;
plane ? dec_get_uv_tx_size(mi, pd->n4_wl, pd->n4_hl)
: mi->tx_size;
const int num_4x4_w = pd->n4_w;
const int num_4x4_h = pd->n4_h;
const int step = (1 << tx_size);
@ -903,19 +903,19 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
for (row = 0; row < max_blocks_high; row += step)
for (col = 0; col < max_blocks_wide; col += step)
eobtotal += reconstruct_inter_block(xd, r, mbmi, plane, row, col,
eobtotal += reconstruct_inter_block(xd, r, mi, plane, row, col,
tx_size);
}
if (!less8x8 && eobtotal == 0)
mbmi->skip = 1; // skip loopfilter
mi->skip = 1; // skip loopfilter
}
}
xd->corrupted |= vpx_reader_has_error(r);
if (cm->lf.filter_level) {
vp9_build_mask(cm, mbmi, mi_row, mi_col, bw, bh);
vp9_build_mask(cm, mi, mi_row, mi_col, bw, bh);
}
}

View File

@ -84,7 +84,7 @@ static TX_SIZE read_selected_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd,
static TX_SIZE read_tx_size(VP9_COMMON *cm, MACROBLOCKD *xd,
int allow_select, vpx_reader *r) {
TX_MODE tx_mode = cm->tx_mode;
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
BLOCK_SIZE bsize = xd->mi[0]->sb_type;
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
if (allow_select && tx_mode == TX_MODE_SELECT && bsize >= BLOCK_8X8)
return read_selected_tx_size(cm, xd, max_tx_size, r);
@ -151,7 +151,7 @@ static int read_intra_segment_id(VP9_COMMON *const cm, int mi_offset,
static int read_inter_segment_id(VP9_COMMON *const cm, MACROBLOCKD *const xd,
int mi_row, int mi_col, vpx_reader *r) {
struct segmentation *const seg = &cm->seg;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MODE_INFO *const mi = xd->mi[0];
int predicted_segment_id, segment_id;
const int mi_offset = mi_row * cm->mi_cols + mi_col;
const int bw = xd->plane[0].n4_w >> 1;
@ -176,9 +176,9 @@ static int read_inter_segment_id(VP9_COMMON *const cm, MACROBLOCKD *const xd,
if (seg->temporal_update) {
const vpx_prob pred_prob = vp9_get_pred_prob_seg_id(seg, xd);
mbmi->seg_id_predicted = vpx_read(r, pred_prob);
segment_id = mbmi->seg_id_predicted ? predicted_segment_id
: read_segment_id(r, seg);
mi->seg_id_predicted = vpx_read(r, pred_prob);
segment_id = mi->seg_id_predicted ? predicted_segment_id
: read_segment_id(r, seg);
} else {
segment_id = read_segment_id(r, seg);
}
@ -204,10 +204,9 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm,
MACROBLOCKD *const xd,
int mi_row, int mi_col, vpx_reader *r) {
MODE_INFO *const mi = xd->mi[0];
MB_MODE_INFO *const mbmi = &mi->mbmi;
const MODE_INFO *above_mi = xd->above_mi;
const MODE_INFO *left_mi = xd->left_mi;
const BLOCK_SIZE bsize = mbmi->sb_type;
const BLOCK_SIZE bsize = mi->sb_type;
int i;
const int mi_offset = mi_row * cm->mi_cols + mi_col;
const int bw = xd->plane[0].n4_w >> 1;
@ -217,37 +216,37 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm,
const int x_mis = VPXMIN(cm->mi_cols - mi_col, bw);
const int y_mis = VPXMIN(cm->mi_rows - mi_row, bh);
mbmi->segment_id = read_intra_segment_id(cm, mi_offset, x_mis, y_mis, r);
mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
mbmi->tx_size = read_tx_size(cm, xd, 1, r);
mbmi->ref_frame[0] = INTRA_FRAME;
mbmi->ref_frame[1] = NONE;
mi->segment_id = read_intra_segment_id(cm, mi_offset, x_mis, y_mis, r);
mi->skip = read_skip(cm, xd, mi->segment_id, r);
mi->tx_size = read_tx_size(cm, xd, 1, r);
mi->ref_frame[0] = INTRA_FRAME;
mi->ref_frame[1] = NONE;
switch (bsize) {
case BLOCK_4X4:
for (i = 0; i < 4; ++i)
mi->bmi[i].as_mode =
read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, i));
mbmi->mode = mi->bmi[3].as_mode;
mi->mode = mi->bmi[3].as_mode;
break;
case BLOCK_4X8:
mi->bmi[0].as_mode = mi->bmi[2].as_mode =
read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, 0));
mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode =
mi->bmi[1].as_mode = mi->bmi[3].as_mode = mi->mode =
read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, 1));
break;
case BLOCK_8X4:
mi->bmi[0].as_mode = mi->bmi[1].as_mode =
read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, 0));
mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode =
mi->bmi[2].as_mode = mi->bmi[3].as_mode = mi->mode =
read_intra_mode(r, get_y_mode_probs(mi, above_mi, left_mi, 2));
break;
default:
mbmi->mode = read_intra_mode(r,
get_y_mode_probs(mi, above_mi, left_mi, 0));
mi->mode = read_intra_mode(r,
get_y_mode_probs(mi, above_mi, left_mi, 0));
}
mbmi->uv_mode = read_intra_mode(r, vp9_kf_uv_mode_prob[mbmi->mode]);
mi->uv_mode = read_intra_mode(r, vp9_kf_uv_mode_prob[mi->mode]);
}
static int read_mv_component(vpx_reader *r,
@ -381,36 +380,35 @@ static INLINE INTERP_FILTER read_switchable_interp_filter(
static void read_intra_block_mode_info(VP9_COMMON *const cm,
MACROBLOCKD *const xd, MODE_INFO *mi,
vpx_reader *r) {
MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
const BLOCK_SIZE bsize = mi->sb_type;
int i;
mbmi->ref_frame[0] = INTRA_FRAME;
mbmi->ref_frame[1] = NONE;
mi->ref_frame[0] = INTRA_FRAME;
mi->ref_frame[1] = NONE;
switch (bsize) {
case BLOCK_4X4:
for (i = 0; i < 4; ++i)
mi->bmi[i].as_mode = read_intra_mode_y(cm, xd, r, 0);
mbmi->mode = mi->bmi[3].as_mode;
mi->mode = mi->bmi[3].as_mode;
break;
case BLOCK_4X8:
mi->bmi[0].as_mode = mi->bmi[2].as_mode = read_intra_mode_y(cm, xd,
r, 0);
mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode =
mi->bmi[1].as_mode = mi->bmi[3].as_mode = mi->mode =
read_intra_mode_y(cm, xd, r, 0);
break;
case BLOCK_8X4:
mi->bmi[0].as_mode = mi->bmi[1].as_mode = read_intra_mode_y(cm, xd,
r, 0);
mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode =
mi->bmi[2].as_mode = mi->bmi[3].as_mode = mi->mode =
read_intra_mode_y(cm, xd, r, 0);
break;
default:
mbmi->mode = read_intra_mode_y(cm, xd, r, size_group_lookup[bsize]);
mi->mode = read_intra_mode_y(cm, xd, r, size_group_lookup[bsize]);
}
mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
mi->uv_mode = read_intra_mode_uv(cm, xd, r, mi->mode);
}
static INLINE int is_mv_valid(const MV *mv) {
@ -547,8 +545,8 @@ static int dec_find_mv_refs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
const TileInfo *const tile = &xd->tile;
// If mode is nearestmv or newmv (uses nearestmv as a reference) then stop
// searching after the first mv is found.
const int early_break = (mi->mbmi.mode == NEARESTMV) ||
(mi->mbmi.mode == NEWMV);
const int early_break = (mi->mode == NEARESTMV) ||
(mi->mode == NEWMV);
// Blank the reference vector list
memset(mv_ref_list, 0, sizeof(*mv_ref_list) * MAX_MV_REF_CANDIDATES);
@ -559,8 +557,8 @@ static int dec_find_mv_refs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
for (i = 0; i < MVREF_NEIGHBOURS; ++i) {
const POSITION *const mv_ref = &mv_ref_search[i];
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
const MB_MODE_INFO *const candidate =
&xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
const MODE_INFO *const candidate =
xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride];
different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame)
@ -601,8 +599,8 @@ static int dec_find_mv_refs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
for (i = 0; i < MVREF_NEIGHBOURS; ++i) {
const POSITION *mv_ref = &mv_ref_search[i];
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
const MB_MODE_INFO *const candidate =
&xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]->mbmi;
const MODE_INFO *const candidate =
xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride];
// If the candidate is INTRA we don't want to consider its mv.
IF_DIFF_REF_FRAME_ADD_MV_EB(candidate, ref_frame, ref_sign_bias,
@ -637,7 +635,7 @@ static int dec_find_mv_refs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
}
}
if (mi->mbmi.mode == NEARMV)
if (mi->mode == NEARMV)
refmv_count = MAX_MV_REF_CANDIDATES;
else
// we only care about the nearestmv for the remaining modes
@ -662,9 +660,8 @@ static uint8_t get_mode_context(const VP9_COMMON *cm, const MACROBLOCKD *xd,
for (i = 0; i < 2; ++i) {
const POSITION *const mv_ref = &mv_ref_search[i];
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row *
xd->mi_stride];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
const MODE_INFO *const candidate =
xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride];
// Keep counts for entropy encoding.
context_counter += mode_2_counter[candidate->mode];
}
@ -678,20 +675,19 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
MODE_INFO *const mi,
int mi_row, int mi_col, vpx_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
const BLOCK_SIZE bsize = mi->sb_type;
const int allow_hp = cm->allow_high_precision_mv;
int_mv nearestmv[2], nearmv[2];
int ref, is_compound;
uint8_t inter_mode_ctx;
const POSITION *const mv_ref_search = mv_ref_blocks[bsize];
read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame);
is_compound = has_second_ref(mbmi);
read_ref_frames(cm, xd, r, mi->segment_id, mi->ref_frame);
is_compound = has_second_ref(mi);
inter_mode_ctx = get_mode_context(cm, xd, mv_ref_search, mi_row, mi_col);
if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
mbmi->mode = ZEROMV;
if (segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP)) {
mi->mode = ZEROMV;
if (bsize < BLOCK_8X8) {
vpx_internal_error(xd->error_info, VPX_CODEC_UNSUP_BITSTREAM,
"Invalid usage of segement feature on small blocks");
@ -699,18 +695,18 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
}
} else {
if (bsize >= BLOCK_8X8)
mbmi->mode = read_inter_mode(cm, xd, r, inter_mode_ctx);
mi->mode = read_inter_mode(cm, xd, r, inter_mode_ctx);
else
// Sub 8x8 blocks use the nearestmv as a ref_mv if the b_mode is NEWMV.
// Setting mode to NEARESTMV forces the search to stop after the nearestmv
// has been found. After b_modes have been read, mode will be overwritten
// by the last b_mode.
mbmi->mode = NEARESTMV;
mi->mode = NEARESTMV;
if (mbmi->mode != ZEROMV) {
if (mi->mode != ZEROMV) {
for (ref = 0; ref < 1 + is_compound; ++ref) {
int_mv ref_mvs[MAX_MV_REF_CANDIDATES];
const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
const MV_REFERENCE_FRAME frame = mi->ref_frame[ref];
int refmv_count;
refmv_count = dec_find_mv_refs(cm, xd, mi, frame, mv_ref_search,
@ -723,7 +719,7 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
}
}
mbmi->interp_filter = (cm->interp_filter == SWITCHABLE)
mi->interp_filter = (cm->interp_filter == SWITCHABLE)
? read_switchable_interp_filter(cm, xd, r)
: cm->interp_filter;
@ -766,12 +762,12 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
}
}
mi->mbmi.mode = b_mode;
mi->mode = b_mode;
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
mi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
mi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
} else {
xd->corrupted |= !assign_mv(cm, xd, mbmi->mode, mbmi->mv, nearestmv,
xd->corrupted |= !assign_mv(cm, xd, mi->mode, mi->mv, nearestmv,
nearestmv, nearmv, is_compound, allow_hp, r);
}
}
@ -781,15 +777,14 @@ static void read_inter_frame_mode_info(VP9Decoder *const pbi,
int mi_row, int mi_col, vpx_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MODE_INFO *const mi = xd->mi[0];
MB_MODE_INFO *const mbmi = &mi->mbmi;
int inter_block;
mbmi->mv[0].as_int = 0;
mbmi->mv[1].as_int = 0;
mbmi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
inter_block = read_is_inter_block(cm, xd, mbmi->segment_id, r);
mbmi->tx_size = read_tx_size(cm, xd, !mbmi->skip || !inter_block, r);
mi->mv[0].as_int = 0;
mi->mv[1].as_int = 0;
mi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
mi->skip = read_skip(cm, xd, mi->segment_id, r);
inter_block = read_is_inter_block(cm, xd, mi->segment_id, r);
mi->tx_size = read_tx_size(cm, xd, !mi->skip || !inter_block, r);
if (inter_block)
read_inter_block_mode_info(pbi, xd, mi, mi_row, mi_col, r);
@ -814,10 +809,10 @@ void vpx_read_mode_info(VP9Decoder *const pbi, MACROBLOCKD *xd,
MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
for (w = 0; w < x_mis; ++w) {
MV_REF *const mv = frame_mv + w;
mv->ref_frame[0] = mi->mbmi.ref_frame[0];
mv->ref_frame[1] = mi->mbmi.ref_frame[1];
mv->mv[0].as_int = mi->mbmi.mv[0].as_int;
mv->mv[1].as_int = mi->mbmi.mv[1].as_int;
mv->ref_frame[0] = mi->ref_frame[0];
mv->ref_frame[1] = mi->ref_frame[1];
mv->mv[0].as_int = mi->mv[0].as_int;
mv->mv[1].as_int = mi->mv[1].as_int;
}
}
}

View File

@ -53,7 +53,7 @@ static int decode_coefs(const MACROBLOCKD *xd,
FRAME_COUNTS *counts = xd->counts;
const int max_eob = 16 << (tx_size << 1);
const FRAME_CONTEXT *const fc = xd->fc;
const int ref = is_inter_block(&xd->mi[0]->mbmi);
const int ref = is_inter_block(xd->mi[0]);
int band, c = 0;
const vpx_prob (*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size][type][ref];

View File

@ -85,11 +85,11 @@ static int apply_cyclic_refresh_bitrate(const VP9_COMMON *cm,
// size of the coding block (i.e., below min_block size rejected), coding
// mode, and rate/distortion.
static int candidate_refresh_aq(const CYCLIC_REFRESH *cr,
const MB_MODE_INFO *mbmi,
const MODE_INFO *mi,
int64_t rate,
int64_t dist,
int bsize) {
MV mv = mbmi->mv[0].as_mv;
MV mv = mi->mv[0].as_mv;
// Reject the block for lower-qp coding if projected distortion
// is above the threshold, and any of the following is true:
// 1) mode uses large mv
@ -98,12 +98,12 @@ static int candidate_refresh_aq(const CYCLIC_REFRESH *cr,
if (dist > cr->thresh_dist_sb &&
(mv.row > cr->motion_thresh || mv.row < -cr->motion_thresh ||
mv.col > cr->motion_thresh || mv.col < -cr->motion_thresh ||
!is_inter_block(mbmi)))
!is_inter_block(mi)))
return CR_SEGMENT_ID_BASE;
else if (bsize >= BLOCK_16X16 &&
rate < cr->thresh_rate_sb &&
is_inter_block(mbmi) &&
mbmi->mv[0].as_int == 0 &&
is_inter_block(mi) &&
mi->mv[0].as_int == 0 &&
cr->rate_boost_fac > 10)
// More aggressive delta-q for bigger blocks with zero motion.
return CR_SEGMENT_ID_BOOST2;
@ -186,7 +186,7 @@ int vp9_cyclic_refresh_rc_bits_per_mb(const VP9_COMP *cpi, int i,
// check if we should reset the segment_id, and update the cyclic_refresh map
// and segmentation map.
void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi,
MB_MODE_INFO *const mbmi,
MODE_INFO *const mi,
int mi_row, int mi_col,
BLOCK_SIZE bsize,
int64_t rate,
@ -200,7 +200,7 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi,
const int xmis = VPXMIN(cm->mi_cols - mi_col, bw);
const int ymis = VPXMIN(cm->mi_rows - mi_row, bh);
const int block_index = mi_row * cm->mi_cols + mi_col;
int refresh_this_block = candidate_refresh_aq(cr, mbmi, rate, dist, bsize);
int refresh_this_block = candidate_refresh_aq(cr, mi, rate, dist, bsize);
// Default is to not update the refresh map.
int new_map_value = cr->map[block_index];
int x = 0; int y = 0;
@ -221,18 +221,18 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi,
// If this block is labeled for refresh, check if we should reset the
// segment_id.
if (cyclic_refresh_segment_id_boosted(mbmi->segment_id)) {
mbmi->segment_id = refresh_this_block;
if (cyclic_refresh_segment_id_boosted(mi->segment_id)) {
mi->segment_id = refresh_this_block;
// Reset segment_id if it will be skipped.
if (skip)
mbmi->segment_id = CR_SEGMENT_ID_BASE;
mi->segment_id = CR_SEGMENT_ID_BASE;
}
// Update the cyclic refresh map, to be used for setting segmentation map
// for the next frame. If the block will be refreshed this frame, mark it
// as clean. The magnitude of the -ve influences how long before we consider
// it for refresh again.
if (cyclic_refresh_segment_id_boosted(mbmi->segment_id)) {
if (cyclic_refresh_segment_id_boosted(mi->segment_id)) {
new_map_value = -cr->time_for_refresh;
} else if (refresh_this_block) {
// Else if it is accepted as candidate for refresh, and has not already
@ -251,17 +251,17 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi,
for (x = 0; x < xmis; x++) {
int map_offset = block_index + y * cm->mi_cols + x;
cr->map[map_offset] = new_map_value;
cpi->segmentation_map[map_offset] = mbmi->segment_id;
cpi->segmentation_map[map_offset] = mi->segment_id;
}
}
void vp9_cyclic_refresh_update_sb_postencode(VP9_COMP *const cpi,
const MB_MODE_INFO *const mbmi,
const MODE_INFO *const mi,
int mi_row, int mi_col,
BLOCK_SIZE bsize) {
const VP9_COMMON *const cm = &cpi->common;
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
MV mv = mbmi->mv[0].as_mv;
MV mv = mi->mv[0].as_mv;
const int bw = num_8x8_blocks_wide_lookup[bsize];
const int bh = num_8x8_blocks_high_lookup[bsize];
const int xmis = VPXMIN(cm->mi_cols - mi_col, bw);
@ -275,18 +275,18 @@ void vp9_cyclic_refresh_update_sb_postencode(VP9_COMP *const cpi,
// don't update the map for them. For cases where motion is non-zero or
// the reference frame isn't the previous frame, the previous value in
// the map for this spatial location is not entirely correct.
if ((!is_inter_block(mbmi) || !mbmi->skip) &&
mbmi->segment_id <= CR_SEGMENT_ID_BOOST2) {
if ((!is_inter_block(mi) || !mi->skip) &&
mi->segment_id <= CR_SEGMENT_ID_BOOST2) {
cr->last_coded_q_map[map_offset] = clamp(
cm->base_qindex + cr->qindex_delta[mbmi->segment_id], 0, MAXQ);
} else if (is_inter_block(mbmi) && mbmi->skip &&
mbmi->segment_id <= CR_SEGMENT_ID_BOOST2) {
cm->base_qindex + cr->qindex_delta[mi->segment_id], 0, MAXQ);
} else if (is_inter_block(mi) && mi->skip &&
mi->segment_id <= CR_SEGMENT_ID_BOOST2) {
cr->last_coded_q_map[map_offset] = VPXMIN(
clamp(cm->base_qindex + cr->qindex_delta[mbmi->segment_id],
clamp(cm->base_qindex + cr->qindex_delta[mi->segment_id],
0, MAXQ),
cr->last_coded_q_map[map_offset]);
// Update the consecutive zero/low_mv count.
if (is_inter_block(mbmi) && (abs(mv.row) < 8 && abs(mv.col) < 8)) {
if (is_inter_block(mi) && (abs(mv.row) < 8 && abs(mv.col) < 8)) {
if (cr->consec_zero_mv[map_offset] < 255)
cr->consec_zero_mv[map_offset]++;
} else {
@ -347,10 +347,10 @@ void vp9_cyclic_refresh_check_golden_update(VP9_COMP *const cpi) {
for (mi_row = 0; mi_row < rows; mi_row++) {
for (mi_col = 0; mi_col < cols; mi_col++) {
int16_t abs_mvr = mi[0]->mbmi.mv[0].as_mv.row >= 0 ?
mi[0]->mbmi.mv[0].as_mv.row : -1 * mi[0]->mbmi.mv[0].as_mv.row;
int16_t abs_mvc = mi[0]->mbmi.mv[0].as_mv.col >= 0 ?
mi[0]->mbmi.mv[0].as_mv.col : -1 * mi[0]->mbmi.mv[0].as_mv.col;
int16_t abs_mvr = mi[0]->mv[0].as_mv.row >= 0 ?
mi[0]->mv[0].as_mv.row : -1 * mi[0]->mv[0].as_mv.row;
int16_t abs_mvc = mi[0]->mv[0].as_mv.col >= 0 ?
mi[0]->mv[0].as_mv.col : -1 * mi[0]->mv[0].as_mv.col;
// Calculate the motion of the background.
if (abs_mvr <= 16 && abs_mvc <= 16) {

View File

@ -93,13 +93,13 @@ int vp9_cyclic_refresh_rc_bits_per_mb(const struct VP9_COMP *cpi, int i,
// check if we should reset the segment_id, and update the cyclic_refresh map
// and segmentation map.
void vp9_cyclic_refresh_update_segment(struct VP9_COMP *const cpi,
MB_MODE_INFO *const mbmi,
MODE_INFO *const mi,
int mi_row, int mi_col, BLOCK_SIZE bsize,
int64_t rate, int64_t dist, int skip,
struct macroblock_plane *const p);
void vp9_cyclic_refresh_update_sb_postencode(struct VP9_COMP *const cpi,
const MB_MODE_INFO *const mbmi,
const MODE_INFO *const mi,
int mi_row, int mi_col,
BLOCK_SIZE bsize);

View File

@ -79,8 +79,8 @@ static void prob_diff_update(const vpx_tree_index *tree,
static void write_selected_tx_size(const VP9_COMMON *cm,
const MACROBLOCKD *xd, vpx_writer *w) {
TX_SIZE tx_size = xd->mi[0]->mbmi.tx_size;
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
TX_SIZE tx_size = xd->mi[0]->tx_size;
BLOCK_SIZE bsize = xd->mi[0]->sb_type;
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
const vpx_prob *const tx_probs = get_tx_probs2(max_tx_size, xd,
&cm->fc->tx_probs);
@ -97,7 +97,7 @@ static int write_skip(const VP9_COMMON *cm, const MACROBLOCKD *xd,
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) {
return 1;
} else {
const int skip = mi->mbmi.skip;
const int skip = mi->skip;
vpx_write(w, skip, vp9_get_skip_prob(cm, xd));
return skip;
}
@ -194,15 +194,15 @@ static void write_segment_id(vpx_writer *w, const struct segmentation *seg,
// This function encodes the reference frame
static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd,
vpx_writer *w) {
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const int is_compound = has_second_ref(mbmi);
const int segment_id = mbmi->segment_id;
const MODE_INFO *const mi = xd->mi[0];
const int is_compound = has_second_ref(mi);
const int segment_id = mi->segment_id;
// If segment level coding of this signal is disabled...
// or the segment allows multiple reference frame options
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
assert(!is_compound);
assert(mbmi->ref_frame[0] ==
assert(mi->ref_frame[0] ==
get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME));
} else {
// does the feature use compound prediction or not
@ -214,13 +214,13 @@ static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd,
}
if (is_compound) {
vpx_write(w, mbmi->ref_frame[0] == GOLDEN_FRAME,
vpx_write(w, mi->ref_frame[0] == GOLDEN_FRAME,
vp9_get_pred_prob_comp_ref_p(cm, xd));
} else {
const int bit0 = mbmi->ref_frame[0] != LAST_FRAME;
const int bit0 = mi->ref_frame[0] != LAST_FRAME;
vpx_write(w, bit0, vp9_get_pred_prob_single_ref_p1(cm, xd));
if (bit0) {
const int bit1 = mbmi->ref_frame[0] != GOLDEN_FRAME;
const int bit1 = mi->ref_frame[0] != GOLDEN_FRAME;
vpx_write(w, bit1, vp9_get_pred_prob_single_ref_p2(cm, xd));
}
}
@ -234,19 +234,18 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
const MACROBLOCK *const x = &cpi->td.mb;
const MACROBLOCKD *const xd = &x->e_mbd;
const struct segmentation *const seg = &cm->seg;
const MB_MODE_INFO *const mbmi = &mi->mbmi;
const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
const PREDICTION_MODE mode = mbmi->mode;
const int segment_id = mbmi->segment_id;
const BLOCK_SIZE bsize = mbmi->sb_type;
const PREDICTION_MODE mode = mi->mode;
const int segment_id = mi->segment_id;
const BLOCK_SIZE bsize = mi->sb_type;
const int allow_hp = cm->allow_high_precision_mv;
const int is_inter = is_inter_block(mbmi);
const int is_compound = has_second_ref(mbmi);
const int is_inter = is_inter_block(mi);
const int is_compound = has_second_ref(mi);
int skip, ref;
if (seg->update_map) {
if (seg->temporal_update) {
const int pred_flag = mbmi->seg_id_predicted;
const int pred_flag = mi->seg_id_predicted;
vpx_prob pred_prob = vp9_get_pred_prob_seg_id(seg, xd);
vpx_write(w, pred_flag, pred_prob);
if (!pred_flag)
@ -280,9 +279,9 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
}
}
}
write_intra_mode(w, mbmi->uv_mode, cm->fc->uv_mode_prob[mode]);
write_intra_mode(w, mi->uv_mode, cm->fc->uv_mode_prob[mode]);
} else {
const int mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]];
const int mode_ctx = mbmi_ext->mode_context[mi->ref_frame[0]];
const vpx_prob *const inter_probs = cm->fc->inter_mode_probs[mode_ctx];
write_ref_frames(cm, xd, w);
@ -297,10 +296,10 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
const int ctx = vp9_get_pred_context_switchable_interp(xd);
vp9_write_token(w, vp9_switchable_interp_tree,
cm->fc->switchable_interp_prob[ctx],
&switchable_interp_encodings[mbmi->interp_filter]);
++cpi->interp_filter_selected[0][mbmi->interp_filter];
&switchable_interp_encodings[mi->interp_filter]);
++cpi->interp_filter_selected[0][mi->interp_filter];
} else {
assert(mbmi->interp_filter == cm->interp_filter);
assert(mi->interp_filter == cm->interp_filter);
}
if (bsize < BLOCK_8X8) {
@ -315,7 +314,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
if (b_mode == NEWMV) {
for (ref = 0; ref < 1 + is_compound; ++ref)
vp9_encode_mv(cpi, w, &mi->bmi[j].as_mv[ref].as_mv,
&mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0].as_mv,
&mbmi_ext->ref_mvs[mi->ref_frame[ref]][0].as_mv,
nmvc, allow_hp);
}
}
@ -323,8 +322,8 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
} else {
if (mode == NEWMV) {
for (ref = 0; ref < 1 + is_compound; ++ref)
vp9_encode_mv(cpi, w, &mbmi->mv[ref].as_mv,
&mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0].as_mv, nmvc,
vp9_encode_mv(cpi, w, &mi->mv[ref].as_mv,
&mbmi_ext->ref_mvs[mi->ref_frame[ref]][0].as_mv, nmvc,
allow_hp);
}
}
@ -337,19 +336,18 @@ static void write_mb_modes_kf(const VP9_COMMON *cm, const MACROBLOCKD *xd,
const MODE_INFO *const mi = mi_8x8[0];
const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi;
const MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
const BLOCK_SIZE bsize = mi->sb_type;
if (seg->update_map)
write_segment_id(w, seg, mbmi->segment_id);
write_segment_id(w, seg, mi->segment_id);
write_skip(cm, xd, mbmi->segment_id, mi, w);
write_skip(cm, xd, mi->segment_id, mi, w);
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT)
write_selected_tx_size(cm, xd, w);
if (bsize >= BLOCK_8X8) {
write_intra_mode(w, mbmi->mode, get_y_mode_probs(mi, above_mi, left_mi, 0));
write_intra_mode(w, mi->mode, get_y_mode_probs(mi, above_mi, left_mi, 0));
} else {
const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
@ -364,7 +362,7 @@ static void write_mb_modes_kf(const VP9_COMMON *cm, const MACROBLOCKD *xd,
}
}
write_intra_mode(w, mbmi->uv_mode, vp9_kf_uv_mode_prob[mbmi->mode]);
write_intra_mode(w, mi->uv_mode, vp9_kf_uv_mode_prob[mi->mode]);
}
static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile,
@ -382,8 +380,8 @@ static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile,
(mi_row * cm->mi_cols + mi_col);
set_mi_row_col(xd, tile,
mi_row, num_8x8_blocks_high_lookup[m->mbmi.sb_type],
mi_col, num_8x8_blocks_wide_lookup[m->mbmi.sb_type],
mi_row, num_8x8_blocks_high_lookup[m->sb_type],
mi_col, num_8x8_blocks_wide_lookup[m->sb_type],
cm->mi_rows, cm->mi_cols);
if (frame_is_intra_only(cm)) {
write_mb_modes_kf(cm, xd, xd->mi, w);
@ -435,7 +433,7 @@ static void write_modes_sb(VP9_COMP *cpi,
m = cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col];
partition = partition_lookup[bsl][m->mbmi.sb_type];
partition = partition_lookup[bsl][m->sb_type];
write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w);
subsize = get_subsize(bsize, partition);
if (subsize < BLOCK_8X8) {

View File

@ -200,8 +200,8 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser,
int sse_diff = ctx->zeromv_sse - ctx->newmv_sse;
MV_REFERENCE_FRAME frame;
MACROBLOCKD *filter_mbd = &mb->e_mbd;
MB_MODE_INFO *mbmi = &filter_mbd->mi[0]->mbmi;
MB_MODE_INFO saved_mbmi;
MODE_INFO *mi = filter_mbd->mi[0];
MODE_INFO saved_mi;
int i, j;
struct buf_2d saved_dst[MAX_MB_PLANE];
struct buf_2d saved_pre[MAX_MB_PLANE][2]; // 2 pre buffers
@ -210,7 +210,7 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser,
mv_row = ctx->best_sse_mv.as_mv.row;
frame = ctx->best_reference_frame;
saved_mbmi = *mbmi;
saved_mi = *mi;
if (is_skin && motion_magnitude > 0)
return COPY_BLOCK;
@ -219,9 +219,9 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser,
// difference in sum-squared-error, use it.
if (frame != INTRA_FRAME &&
sse_diff > sse_diff_thresh(bs, increase_denoising, motion_magnitude)) {
mbmi->ref_frame[0] = ctx->best_reference_frame;
mbmi->mode = ctx->best_sse_inter_mode;
mbmi->mv[0] = ctx->best_sse_mv;
mi->ref_frame[0] = ctx->best_reference_frame;
mi->mode = ctx->best_sse_inter_mode;
mi->mv[0] = ctx->best_sse_mv;
} else {
// Otherwise, use the zero reference frame.
frame = ctx->best_zeromv_reference_frame;
@ -233,9 +233,9 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser,
frame = LAST_FRAME;
ctx->newmv_sse = ctx->zeromv_lastref_sse;
}
mbmi->ref_frame[0] = frame;
mbmi->mode = ZEROMV;
mbmi->mv[0].as_int = 0;
mi->ref_frame[0] = frame;
mi->mode = ZEROMV;
mi->mv[0].as_int = 0;
ctx->best_sse_inter_mode = ZEROMV;
ctx->best_sse_mv.as_int = 0;
*zeromv_filter = 1;
@ -243,13 +243,13 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser,
if (ctx->newmv_sse > sse_thresh(bs, increase_denoising)) {
// Restore everything to its original state
*mbmi = saved_mbmi;
*mi = saved_mi;
return COPY_BLOCK;
}
if (motion_magnitude >
(noise_motion_thresh(bs, increase_denoising) << 3)) {
// Restore everything to its original state
*mbmi = saved_mbmi;
*mi = saved_mi;
return COPY_BLOCK;
}
@ -302,7 +302,7 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser,
vp9_build_inter_predictors_sby(filter_mbd, mv_row, mv_col, bs);
// Restore everything to its original state
*mbmi = saved_mbmi;
*mi = saved_mi;
for (i = 0; i < MAX_MB_PLANE; ++i) {
for (j = 0; j < 2; ++j) {
filter_mbd->plane[i].pre[j] = saved_pre[i][j];
@ -461,22 +461,22 @@ void vp9_denoiser_reset_frame_stats(PICK_MODE_CONTEXT *ctx) {
ctx->zeromv_lastref_sse = UINT_MAX;
}
void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi, unsigned int sse,
void vp9_denoiser_update_frame_stats(MODE_INFO *mi, unsigned int sse,
PREDICTION_MODE mode,
PICK_MODE_CONTEXT *ctx) {
// TODO(tkopp): Use both MVs if possible
if (mbmi->mv[0].as_int == 0 && sse < ctx->zeromv_sse) {
if (mi->mv[0].as_int == 0 && sse < ctx->zeromv_sse) {
ctx->zeromv_sse = sse;
ctx->best_zeromv_reference_frame = mbmi->ref_frame[0];
if (mbmi->ref_frame[0] == LAST_FRAME)
ctx->best_zeromv_reference_frame = mi->ref_frame[0];
if (mi->ref_frame[0] == LAST_FRAME)
ctx->zeromv_lastref_sse = sse;
}
if (mbmi->mv[0].as_int != 0 && sse < ctx->newmv_sse) {
if (mi->mv[0].as_int != 0 && sse < ctx->newmv_sse) {
ctx->newmv_sse = sse;
ctx->best_sse_inter_mode = mode;
ctx->best_sse_mv = mbmi->mv[0];
ctx->best_reference_frame = mbmi->ref_frame[0];
ctx->best_sse_mv = mi->mv[0];
ctx->best_reference_frame = mi->ref_frame[0];
}
}

View File

@ -60,7 +60,7 @@ void vp9_denoiser_denoise(VP9_DENOISER *denoiser, MACROBLOCK *mb,
void vp9_denoiser_reset_frame_stats(PICK_MODE_CONTEXT *ctx);
void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi,
void vp9_denoiser_update_frame_stats(MODE_INFO *mi,
unsigned int sse, PREDICTION_MODE mode,
PICK_MODE_CONTEXT *ctx);

View File

@ -187,7 +187,7 @@ static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile,
BLOCK_SIZE bsize) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi;
MODE_INFO *mi;
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
const int mi_height = num_8x8_blocks_high_lookup[bsize];
const struct segmentation *const seg = &cm->seg;
@ -196,7 +196,7 @@ static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile,
set_mode_info_offsets(cm, x, xd, mi_row, mi_col);
mbmi = &xd->mi[0]->mbmi;
mi = xd->mi[0];
// Set up destination pointers.
vp9_setup_dst_planes(xd->plane, get_frame_new_buffer(cm), mi_row, mi_col);
@ -226,13 +226,13 @@ static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile,
cpi->oxcf.aq_mode != EQUATOR360_AQ) {
const uint8_t *const map = seg->update_map ? cpi->segmentation_map
: cm->last_frame_seg_map;
mbmi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
}
vp9_init_plane_quantizers(cpi, x);
x->encode_breakout = cpi->segment_encode_breakout[mbmi->segment_id];
x->encode_breakout = cpi->segment_encode_breakout[mi->segment_id];
} else {
mbmi->segment_id = 0;
mi->segment_id = 0;
x->encode_breakout = cpi->encode_breakout;
}
@ -260,7 +260,7 @@ static void set_block_size(VP9_COMP * const cpi,
BLOCK_SIZE bsize) {
if (cpi->common.mi_cols > mi_col && cpi->common.mi_rows > mi_row) {
set_mode_info_offsets(&cpi->common, x, xd, mi_row, mi_col);
xd->mi[0]->mbmi.sb_type = bsize;
xd->mi[0]->sb_type = bsize;
}
}
@ -718,7 +718,7 @@ static int choose_partitioning(VP9_COMP *cpi,
// In the case of spatial/temporal scalable coding, the assumption here is
// that the temporal reference frame will always be of type LAST_FRAME.
// TODO(marpan): If that assumption is broken, we need to revisit this code.
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
MODE_INFO *mi = xd->mi[0];
unsigned int uv_sad;
const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
@ -749,21 +749,21 @@ static int choose_partitioning(VP9_COMP *cpi,
vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col,
&cm->frame_refs[LAST_FRAME - 1].sf);
mbmi->ref_frame[0] = LAST_FRAME;
mbmi->ref_frame[1] = NONE;
mbmi->sb_type = BLOCK_64X64;
mbmi->mv[0].as_int = 0;
mbmi->interp_filter = BILINEAR;
mi->ref_frame[0] = LAST_FRAME;
mi->ref_frame[1] = NONE;
mi->sb_type = BLOCK_64X64;
mi->mv[0].as_int = 0;
mi->interp_filter = BILINEAR;
y_sad = vp9_int_pro_motion_estimation(cpi, x, bsize, mi_row, mi_col);
if (y_sad_g < y_sad) {
vp9_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col,
&cm->frame_refs[GOLDEN_FRAME - 1].sf);
mbmi->ref_frame[0] = GOLDEN_FRAME;
mbmi->mv[0].as_int = 0;
mi->ref_frame[0] = GOLDEN_FRAME;
mi->mv[0].as_int = 0;
y_sad = y_sad_g;
} else {
x->pred_mv[LAST_FRAME] = mbmi->mv[0].as_mv;
x->pred_mv[LAST_FRAME] = mi->mv[0].as_mv;
}
vp9_build_inter_predictors_sb(xd, mi_row, mi_col, BLOCK_64X64);
@ -1012,11 +1012,11 @@ static void update_state(VP9_COMP *cpi, ThreadData *td,
struct macroblock_plane *const p = x->plane;
struct macroblockd_plane *const pd = xd->plane;
MODE_INFO *mi = &ctx->mic;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MODE_INFO *const xdmi = xd->mi[0];
MODE_INFO *mi_addr = xd->mi[0];
const struct segmentation *const seg = &cm->seg;
const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type];
const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type];
const int bw = num_8x8_blocks_wide_lookup[mi->sb_type];
const int bh = num_8x8_blocks_high_lookup[mi->sb_type];
const int x_mis = VPXMIN(bw, cm->mi_cols - mi_col);
const int y_mis = VPXMIN(bh, cm->mi_rows - mi_row);
MV_REF *const frame_mvs =
@ -1028,7 +1028,7 @@ static void update_state(VP9_COMP *cpi, ThreadData *td,
const int mi_height = num_8x8_blocks_high_lookup[bsize];
int max_plane;
assert(mi->mbmi.sb_type == bsize);
assert(mi->sb_type == bsize);
*mi_addr = *mi;
*x->mbmi_ext = ctx->mbmi_ext;
@ -1039,19 +1039,19 @@ static void update_state(VP9_COMP *cpi, ThreadData *td,
if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) {
const uint8_t *const map = seg->update_map ? cpi->segmentation_map
: cm->last_frame_seg_map;
mi_addr->mbmi.segment_id =
mi_addr->segment_id =
get_segment_id(cm, map, bsize, mi_row, mi_col);
}
// Else for cyclic refresh mode update the segment map, set the segment id
// and then update the quantizer.
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) {
vp9_cyclic_refresh_update_segment(cpi, &xd->mi[0]->mbmi, mi_row,
vp9_cyclic_refresh_update_segment(cpi, xd->mi[0], mi_row,
mi_col, bsize, ctx->rate, ctx->dist,
x->skip, p);
}
}
max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1;
max_plane = is_inter_block(xdmi) ? MAX_MB_PLANE : 1;
for (i = 0; i < max_plane; ++i) {
p[i].coeff = ctx->coeff_pbuf[i][1];
p[i].qcoeff = ctx->qcoeff_pbuf[i][1];
@ -1078,13 +1078,13 @@ static void update_state(VP9_COMP *cpi, ThreadData *td,
if (cpi->oxcf.aq_mode)
vp9_init_plane_quantizers(cpi, x);
if (is_inter_block(mbmi) && mbmi->sb_type < BLOCK_8X8) {
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
if (is_inter_block(xdmi) && xdmi->sb_type < BLOCK_8X8) {
xdmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
xdmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
}
x->skip = ctx->skip;
memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk,
memcpy(x->zcoeff_blk[xdmi->tx_size], ctx->zcoeff_blk,
sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk);
if (!output_enabled)
@ -1111,12 +1111,12 @@ static void update_state(VP9_COMP *cpi, ThreadData *td,
}
#endif
if (!frame_is_intra_only(cm)) {
if (is_inter_block(mbmi)) {
if (is_inter_block(xdmi)) {
vp9_update_mv_count(td);
if (cm->interp_filter == SWITCHABLE) {
const int ctx = vp9_get_pred_context_switchable_interp(xd);
++td->counts->switchable_interp[ctx][mbmi->interp_filter];
++td->counts->switchable_interp[ctx][xdmi->interp_filter];
}
}
@ -1132,10 +1132,10 @@ static void update_state(VP9_COMP *cpi, ThreadData *td,
MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
for (w = 0; w < x_mis; ++w) {
MV_REF *const mv = frame_mv + w;
mv->ref_frame[0] = mi->mbmi.ref_frame[0];
mv->ref_frame[1] = mi->mbmi.ref_frame[1];
mv->mv[0].as_int = mi->mbmi.mv[0].as_int;
mv->mv[1].as_int = mi->mbmi.mv[1].as_int;
mv->ref_frame[0] = mi->ref_frame[0];
mv->ref_frame[1] = mi->ref_frame[1];
mv->mv[0].as_int = mi->mv[0].as_int;
mv->mv[1].as_int = mi->mv[1].as_int;
}
}
}
@ -1158,26 +1158,26 @@ void vp9_setup_src_planes(MACROBLOCK *x, const YV12_BUFFER_CONFIG *src,
static void set_mode_info_seg_skip(MACROBLOCK *x, TX_MODE tx_mode,
RD_COST *rd_cost, BLOCK_SIZE bsize) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MODE_INFO *const mi = xd->mi[0];
INTERP_FILTER filter_ref;
if (xd->up_available)
filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter;
filter_ref = xd->mi[-xd->mi_stride]->interp_filter;
else if (xd->left_available)
filter_ref = xd->mi[-1]->mbmi.interp_filter;
filter_ref = xd->mi[-1]->interp_filter;
else
filter_ref = EIGHTTAP;
mbmi->sb_type = bsize;
mbmi->mode = ZEROMV;
mbmi->tx_size =
mi->sb_type = bsize;
mi->mode = ZEROMV;
mi->tx_size =
VPXMIN(max_txsize_lookup[bsize], tx_mode_to_biggest_tx_size[tx_mode]);
mbmi->skip = 1;
mbmi->uv_mode = DC_PRED;
mbmi->ref_frame[0] = LAST_FRAME;
mbmi->ref_frame[1] = NONE;
mbmi->mv[0].as_int = 0;
mbmi->interp_filter = filter_ref;
mi->skip = 1;
mi->uv_mode = DC_PRED;
mi->ref_frame[0] = LAST_FRAME;
mi->ref_frame[1] = NONE;
mi->mv[0].as_int = 0;
mi->interp_filter = filter_ref;
xd->mi[0]->bmi[0].as_mv[0].as_int = 0;
x->skip = 1;
@ -1206,7 +1206,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi,
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi;
MODE_INFO *mi;
struct macroblock_plane *const p = x->plane;
struct macroblockd_plane *const pd = xd->plane;
const AQ_MODE aq_mode = cpi->oxcf.aq_mode;
@ -1218,8 +1218,8 @@ static void rd_pick_sb_modes(VP9_COMP *cpi,
x->use_lp32x32fdct = 1;
set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize);
mbmi = &xd->mi[0]->mbmi;
mbmi->sb_type = bsize;
mi = xd->mi[0];
mi->sb_type = bsize;
for (i = 0; i < MAX_MB_PLANE; ++i) {
p[i].coeff = ctx->coeff_pbuf[i][0];
@ -1233,7 +1233,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi,
x->skip_recode = 0;
// Set to zero to make sure we do not use the previous encoded frame stats
mbmi->skip = 0;
mi->skip = 0;
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@ -1258,24 +1258,24 @@ static void rd_pick_sb_modes(VP9_COMP *cpi,
if (cm->frame_type == KEY_FRAME ||
cpi->refresh_alt_ref_frame ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
mbmi->segment_id = vp9_vaq_segment_id(energy);
mi->segment_id = vp9_vaq_segment_id(energy);
} else {
const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map
: cm->last_frame_seg_map;
mbmi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
}
x->rdmult = set_segment_rdmult(cpi, x, mbmi->segment_id);
x->rdmult = set_segment_rdmult(cpi, x, mi->segment_id);
} else if (aq_mode == EQUATOR360_AQ) {
if (cm->frame_type == KEY_FRAME) {
mbmi->segment_id = vp9_360aq_segment_id(mi_row, cm->mi_rows);
mi->segment_id = vp9_360aq_segment_id(mi_row, cm->mi_rows);
} else {
const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map
: cm->last_frame_seg_map;
mbmi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
}
x->rdmult = set_segment_rdmult(cpi, x, mbmi->segment_id);
x->rdmult = set_segment_rdmult(cpi, x, mi->segment_id);
} else if (aq_mode == COMPLEXITY_AQ) {
x->rdmult = set_segment_rdmult(cpi, x, mbmi->segment_id);
x->rdmult = set_segment_rdmult(cpi, x, mi->segment_id);
} else if (aq_mode == CYCLIC_REFRESH_AQ) {
const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map
: cm->last_frame_seg_map;
@ -1291,7 +1291,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi,
vp9_rd_pick_intra_mode_sb(cpi, x, rd_cost, bsize, ctx, best_rd);
} else {
if (bsize >= BLOCK_8X8) {
if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP))
if (segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP))
vp9_rd_pick_inter_mode_sb_seg_skip(cpi, tile_data, x, rd_cost, bsize,
ctx, best_rd);
else
@ -1328,14 +1328,13 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) {
const MACROBLOCK *x = &td->mb;
const MACROBLOCKD *const xd = &x->e_mbd;
const MODE_INFO *const mi = xd->mi[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
const BLOCK_SIZE bsize = mbmi->sb_type;
const BLOCK_SIZE bsize = mi->sb_type;
if (!frame_is_intra_only(cm)) {
FRAME_COUNTS *const counts = td->counts;
const int inter_block = is_inter_block(mbmi);
const int seg_ref_active = segfeature_active(&cm->seg, mbmi->segment_id,
const int inter_block = is_inter_block(mi);
const int seg_ref_active = segfeature_active(&cm->seg, mi->segment_id,
SEG_LVL_REF_FRAME);
if (!seg_ref_active) {
counts->intra_inter[vp9_get_intra_inter_context(xd)][inter_block]++;
@ -1343,12 +1342,12 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) {
// reference frame allowed for the segment so exclude it from
// the reference frame counts used to work out probabilities.
if (inter_block) {
const MV_REFERENCE_FRAME ref0 = mbmi->ref_frame[0];
const MV_REFERENCE_FRAME ref0 = mi->ref_frame[0];
if (cm->reference_mode == REFERENCE_MODE_SELECT)
counts->comp_inter[vp9_get_reference_mode_context(cm, xd)]
[has_second_ref(mbmi)]++;
[has_second_ref(mi)]++;
if (has_second_ref(mbmi)) {
if (has_second_ref(mi)) {
counts->comp_ref[vp9_get_pred_context_comp_ref_p(cm, xd)]
[ref0 == GOLDEN_FRAME]++;
} else {
@ -1361,10 +1360,10 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) {
}
}
if (inter_block &&
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
const int mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]];
!segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP)) {
const int mode_ctx = mbmi_ext->mode_context[mi->ref_frame[0]];
if (bsize >= BLOCK_8X8) {
const PREDICTION_MODE mode = mbmi->mode;
const PREDICTION_MODE mode = mi->mode;
++counts->inter_mode[mode_ctx][INTER_OFFSET(mode)];
} else {
const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
@ -1566,7 +1565,7 @@ static void set_partial_b64x64_partition(MODE_INFO *mi, int mis,
for (c = 0; c < MI_BLOCK_SIZE; c += bw) {
const int index = r * mis + c;
mi_8x8[index] = mi + index;
mi_8x8[index]->mbmi.sb_type = find_partition_size(bsize,
mi_8x8[index]->sb_type = find_partition_size(bsize,
row8x8_remaining - r, col8x8_remaining - c, &bh, &bw);
}
}
@ -1598,7 +1597,7 @@ static void set_fixed_partitioning(VP9_COMP *cpi, const TileInfo *const tile,
for (block_col = 0; block_col < MI_BLOCK_SIZE; block_col += bw) {
int index = block_row * mis + block_col;
mi_8x8[index] = mi_upper_left + index;
mi_8x8[index]->mbmi.sb_type = bsize;
mi_8x8[index]->sb_type = bsize;
}
}
} else {
@ -1663,7 +1662,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi,
index = b_mi_row * mis + b_mi_col;
mi_8x8[index] = mi_upper_left + index;
mi_8x8[index]->mbmi.sb_type = BLOCK_16X16;
mi_8x8[index]->sb_type = BLOCK_16X16;
// TODO(yunqingwang): If d16[j].var is very large, use 8x8 partition
// size to further improve quality.
@ -1685,7 +1684,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi,
index = coord_lookup[i*4].row * mis + coord_lookup[i*4].col;
mi_8x8[index] = mi_upper_left + index;
mi_8x8[index]->mbmi.sb_type = BLOCK_32X32;
mi_8x8[index]->sb_type = BLOCK_32X32;
}
}
@ -1697,7 +1696,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi,
// Use 64x64 partition
if (is_larger_better) {
mi_8x8[0] = mi_upper_left;
mi_8x8[0]->mbmi.sb_type = BLOCK_64X64;
mi_8x8[0]->sb_type = BLOCK_64X64;
}
}
} else { // partial in-image SB64
@ -1715,11 +1714,10 @@ static void update_state_rt(VP9_COMP *cpi, ThreadData *td,
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *const mi = xd->mi[0];
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
struct macroblock_plane *const p = x->plane;
const struct segmentation *const seg = &cm->seg;
const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type];
const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type];
const int bw = num_8x8_blocks_wide_lookup[mi->sb_type];
const int bh = num_8x8_blocks_high_lookup[mi->sb_type];
const int x_mis = VPXMIN(bw, cm->mi_cols - mi_col);
const int y_mis = VPXMIN(bh, cm->mi_rows - mi_row);
@ -1734,25 +1732,25 @@ static void update_state_rt(VP9_COMP *cpi, ThreadData *td,
cpi->oxcf.aq_mode == EQUATOR360_AQ) {
const uint8_t *const map = seg->update_map ? cpi->segmentation_map
: cm->last_frame_seg_map;
mbmi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
} else {
// Setting segmentation map for cyclic_refresh.
vp9_cyclic_refresh_update_segment(cpi, mbmi, mi_row, mi_col, bsize,
vp9_cyclic_refresh_update_segment(cpi, mi, mi_row, mi_col, bsize,
ctx->rate, ctx->dist, x->skip, p);
}
vp9_init_plane_quantizers(cpi, x);
}
if (is_inter_block(mbmi)) {
if (is_inter_block(mi)) {
vp9_update_mv_count(td);
if (cm->interp_filter == SWITCHABLE) {
const int pred_ctx = vp9_get_pred_context_switchable_interp(xd);
++td->counts->switchable_interp[pred_ctx][mbmi->interp_filter];
++td->counts->switchable_interp[pred_ctx][mi->interp_filter];
}
if (mbmi->sb_type < BLOCK_8X8) {
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
if (mi->sb_type < BLOCK_8X8) {
mi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
mi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
}
}
@ -1765,16 +1763,16 @@ static void update_state_rt(VP9_COMP *cpi, ThreadData *td,
MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
for (w = 0; w < x_mis; ++w) {
MV_REF *const mv = frame_mv + w;
mv->ref_frame[0] = mi->mbmi.ref_frame[0];
mv->ref_frame[1] = mi->mbmi.ref_frame[1];
mv->mv[0].as_int = mi->mbmi.mv[0].as_int;
mv->mv[1].as_int = mi->mbmi.mv[1].as_int;
mv->ref_frame[0] = mi->ref_frame[0];
mv->ref_frame[1] = mi->ref_frame[1];
mv->mv[0].as_int = mi->mv[0].as_int;
mv->mv[1].as_int = mi->mv[1].as_int;
}
}
}
x->skip = ctx->skip;
x->skip_txfm[0] = mbmi->segment_id ? 0 : ctx->skip_txfm[0];
x->skip_txfm[0] = mi->segment_id ? 0 : ctx->skip_txfm[0];
}
static void encode_b_rt(VP9_COMP *cpi, ThreadData *td,
@ -1814,7 +1812,7 @@ static void encode_sb_rt(VP9_COMP *cpi, ThreadData *td,
const int idx_str = xd->mi_stride * mi_row + mi_col;
MODE_INFO ** mi_8x8 = cm->mi_grid_visible + idx_str;
ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
subsize = mi_8x8[0]->mbmi.sb_type;
subsize = mi_8x8[0]->sb_type;
} else {
ctx = 0;
subsize = BLOCK_4X4;
@ -1889,7 +1887,7 @@ static void rd_use_partition(VP9_COMP *cpi,
RD_COST last_part_rdc, none_rdc, chosen_rdc;
BLOCK_SIZE sub_subsize = BLOCK_4X4;
int splits_below = 0;
BLOCK_SIZE bs_type = mi_8x8[0]->mbmi.sb_type;
BLOCK_SIZE bs_type = mi_8x8[0]->sb_type;
int do_partition_search = 1;
PICK_MODE_CONTEXT *ctx = &pc_tree->none;
@ -1924,7 +1922,7 @@ static void rd_use_partition(VP9_COMP *cpi,
for (i = 0; i < 4; i++) {
int jj = i >> 1, ii = i & 0x01;
MODE_INFO *this_mi = mi_8x8[jj * bss * mis + ii * bss];
if (this_mi && this_mi->mbmi.sb_type >= sub_subsize) {
if (this_mi && this_mi->sb_type >= sub_subsize) {
splits_below = 0;
}
}
@ -1948,7 +1946,7 @@ static void rd_use_partition(VP9_COMP *cpi,
}
restore_context(x, mi_row, mi_col, a, l, sa, sl, bsize);
mi_8x8[0]->mbmi.sb_type = bs_type;
mi_8x8[0]->sb_type = bs_type;
pc_tree->partitioning = partition;
}
}
@ -2106,7 +2104,7 @@ static void rd_use_partition(VP9_COMP *cpi,
// If last_part is better set the partitioning to that.
if (last_part_rdc.rdcost < chosen_rdc.rdcost) {
mi_8x8[0]->mbmi.sb_type = bsize;
mi_8x8[0]->sb_type = bsize;
if (bsize >= BLOCK_8X8)
pc_tree->partitioning = partition;
chosen_rdc = last_part_rdc;
@ -2172,7 +2170,7 @@ static void get_sb_partition_size_range(MACROBLOCKD *xd, MODE_INFO **mi_8x8,
for (i = 0; i < sb_height_in_blocks; ++i) {
for (j = 0; j < sb_width_in_blocks; ++j) {
MODE_INFO *mi = mi_8x8[index+j];
BLOCK_SIZE sb_type = mi ? mi->mbmi.sb_type : 0;
BLOCK_SIZE sb_type = mi ? mi->sb_type : 0;
bs_hist[sb_type]++;
*min_block_size = VPXMIN(*min_block_size, sb_type);
*max_block_size = VPXMAX(*max_block_size, sb_type);
@ -2288,7 +2286,7 @@ static void set_partition_range(VP9_COMMON *cm, MACROBLOCKD *xd,
for (idy = 0; idy < mi_height; ++idy) {
for (idx = 0; idx < mi_width; ++idx) {
mi = prev_mi[idy * cm->mi_stride + idx];
bs = mi ? mi->mbmi.sb_type : bsize;
bs = mi ? mi->sb_type : bsize;
min_size = VPXMIN(min_size, bs);
max_size = VPXMAX(max_size, bs);
}
@ -2298,7 +2296,7 @@ static void set_partition_range(VP9_COMMON *cm, MACROBLOCKD *xd,
if (xd->left_available) {
for (idy = 0; idy < mi_height; ++idy) {
mi = xd->mi[idy * cm->mi_stride - 1];
bs = mi ? mi->mbmi.sb_type : bsize;
bs = mi ? mi->sb_type : bsize;
min_size = VPXMIN(min_size, bs);
max_size = VPXMAX(max_size, bs);
}
@ -2307,7 +2305,7 @@ static void set_partition_range(VP9_COMMON *cm, MACROBLOCKD *xd,
if (xd->up_available) {
for (idx = 0; idx < mi_width; ++idx) {
mi = xd->mi[idx - cm->mi_stride];
bs = mi ? mi->mbmi.sb_type : bsize;
bs = mi ? mi->sb_type : bsize;
min_size = VPXMIN(min_size, bs);
max_size = VPXMAX(max_size, bs);
}
@ -2625,7 +2623,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td,
i = 4;
if (cpi->sf.adaptive_pred_interp_filter && partition_none_allowed)
pc_tree->leaf_split[0]->pred_interp_filter =
ctx->mic.mbmi.interp_filter;
ctx->mic.interp_filter;
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize,
pc_tree->leaf_split[0], best_rdc.rdcost);
if (sum_rdc.rate == INT_MAX)
@ -2696,7 +2694,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td,
if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
partition_none_allowed)
pc_tree->horizontal[0].pred_interp_filter =
ctx->mic.mbmi.interp_filter;
ctx->mic.interp_filter;
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize,
&pc_tree->horizontal[0], best_rdc.rdcost);
@ -2711,7 +2709,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td,
if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
partition_none_allowed)
pc_tree->horizontal[1].pred_interp_filter =
ctx->mic.mbmi.interp_filter;
ctx->mic.interp_filter;
rd_pick_sb_modes(cpi, tile_data, x, mi_row + mi_step, mi_col,
&this_rdc, subsize, &pc_tree->horizontal[1],
best_rdc.rdcost - sum_rdc.rdcost);
@ -2749,7 +2747,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td,
if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
partition_none_allowed)
pc_tree->vertical[0].pred_interp_filter =
ctx->mic.mbmi.interp_filter;
ctx->mic.interp_filter;
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize,
&pc_tree->vertical[0], best_rdc.rdcost);
if (sum_rdc.rdcost < best_rdc.rdcost && mi_col + mi_step < cm->mi_cols &&
@ -2763,7 +2761,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td,
if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
partition_none_allowed)
pc_tree->vertical[1].pred_interp_filter =
ctx->mic.mbmi.interp_filter;
ctx->mic.interp_filter;
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col + mi_step,
&this_rdc, subsize,
&pc_tree->vertical[1], best_rdc.rdcost - sum_rdc.rdcost);
@ -2935,8 +2933,8 @@ static void reset_skip_tx_size(VP9_COMMON *cm, TX_SIZE max_tx_size) {
for (mi_row = 0; mi_row < cm->mi_rows; ++mi_row, mi_ptr += mis) {
for (mi_col = 0; mi_col < cm->mi_cols; ++mi_col) {
if (mi_ptr[mi_col]->mbmi.tx_size > max_tx_size)
mi_ptr[mi_col]->mbmi.tx_size = max_tx_size;
if (mi_ptr[mi_col]->tx_size > max_tx_size)
mi_ptr[mi_col]->tx_size = max_tx_size;
}
}
}
@ -2983,18 +2981,18 @@ static void nonrd_pick_sb_modes(VP9_COMP *cpi,
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi;
MODE_INFO *mi;
set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize);
mbmi = &xd->mi[0]->mbmi;
mbmi->sb_type = bsize;
mi = xd->mi[0];
mi->sb_type = bsize;
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled)
if (cyclic_refresh_segment_id_boosted(mbmi->segment_id))
if (cyclic_refresh_segment_id_boosted(mi->segment_id))
x->rdmult = vp9_cyclic_refresh_get_rdmult(cpi->cyclic_refresh);
if (cm->frame_type == KEY_FRAME)
hybrid_intra_mode_search(cpi, x, rd_cost, bsize, ctx);
else if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP))
else if (segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP))
set_mode_info_seg_skip(x, cm->tx_mode, rd_cost, bsize);
else if (bsize >= BLOCK_8X8)
vp9_pick_inter_mode(cpi, x, tile_data, mi_row, mi_col,
@ -3154,7 +3152,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td,
if (partition_none_allowed) {
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col,
&this_rdc, bsize, ctx);
ctx->mic.mbmi = xd->mi[0]->mbmi;
ctx->mic = *xd->mi[0];
ctx->mbmi_ext = *x->mbmi_ext;
ctx->skip_txfm[0] = x->skip_txfm[0];
ctx->skip = x->skip;
@ -3237,7 +3235,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td,
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize,
&pc_tree->horizontal[0]);
pc_tree->horizontal[0].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->horizontal[0].mic = *xd->mi[0];
pc_tree->horizontal[0].mbmi_ext = *x->mbmi_ext;
pc_tree->horizontal[0].skip_txfm[0] = x->skip_txfm[0];
pc_tree->horizontal[0].skip = x->skip;
@ -3249,7 +3247,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td,
&this_rdc, subsize,
&pc_tree->horizontal[1]);
pc_tree->horizontal[1].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->horizontal[1].mic = *xd->mi[0];
pc_tree->horizontal[1].mbmi_ext = *x->mbmi_ext;
pc_tree->horizontal[1].skip_txfm[0] = x->skip_txfm[0];
pc_tree->horizontal[1].skip = x->skip;
@ -3282,7 +3280,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td,
pc_tree->vertical[0].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize,
&pc_tree->vertical[0]);
pc_tree->vertical[0].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->vertical[0].mic = *xd->mi[0];
pc_tree->vertical[0].mbmi_ext = *x->mbmi_ext;
pc_tree->vertical[0].skip_txfm[0] = x->skip_txfm[0];
pc_tree->vertical[0].skip = x->skip;
@ -3293,7 +3291,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td,
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col + ms,
&this_rdc, subsize,
&pc_tree->vertical[1]);
pc_tree->vertical[1].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->vertical[1].mic = *xd->mi[0];
pc_tree->vertical[1].mbmi_ext = *x->mbmi_ext;
pc_tree->vertical[1].skip_txfm[0] = x->skip_txfm[0];
pc_tree->vertical[1].skip = x->skip;
@ -3365,7 +3363,7 @@ static void nonrd_select_partition(VP9_COMP *cpi,
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
subsize = (bsize >= BLOCK_8X8) ? mi[0]->mbmi.sb_type : BLOCK_4X4;
subsize = (bsize >= BLOCK_8X8) ? mi[0]->sb_type : BLOCK_4X4;
partition = partition_lookup[bsl][subsize];
if (bsize == BLOCK_32X32 && subsize == BLOCK_32X32) {
@ -3390,7 +3388,7 @@ static void nonrd_select_partition(VP9_COMP *cpi,
pc_tree->none.pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, rd_cost,
subsize, &pc_tree->none);
pc_tree->none.mic.mbmi = xd->mi[0]->mbmi;
pc_tree->none.mic = *xd->mi[0];
pc_tree->none.mbmi_ext = *x->mbmi_ext;
pc_tree->none.skip_txfm[0] = x->skip_txfm[0];
pc_tree->none.skip = x->skip;
@ -3399,7 +3397,7 @@ static void nonrd_select_partition(VP9_COMP *cpi,
pc_tree->vertical[0].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, rd_cost,
subsize, &pc_tree->vertical[0]);
pc_tree->vertical[0].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->vertical[0].mic = *xd->mi[0];
pc_tree->vertical[0].mbmi_ext = *x->mbmi_ext;
pc_tree->vertical[0].skip_txfm[0] = x->skip_txfm[0];
pc_tree->vertical[0].skip = x->skip;
@ -3407,7 +3405,7 @@ static void nonrd_select_partition(VP9_COMP *cpi,
pc_tree->vertical[1].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col + hbs,
&this_rdc, subsize, &pc_tree->vertical[1]);
pc_tree->vertical[1].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->vertical[1].mic = *xd->mi[0];
pc_tree->vertical[1].mbmi_ext = *x->mbmi_ext;
pc_tree->vertical[1].skip_txfm[0] = x->skip_txfm[0];
pc_tree->vertical[1].skip = x->skip;
@ -3422,7 +3420,7 @@ static void nonrd_select_partition(VP9_COMP *cpi,
pc_tree->horizontal[0].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, rd_cost,
subsize, &pc_tree->horizontal[0]);
pc_tree->horizontal[0].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->horizontal[0].mic = *xd->mi[0];
pc_tree->horizontal[0].mbmi_ext = *x->mbmi_ext;
pc_tree->horizontal[0].skip_txfm[0] = x->skip_txfm[0];
pc_tree->horizontal[0].skip = x->skip;
@ -3430,7 +3428,7 @@ static void nonrd_select_partition(VP9_COMP *cpi,
pc_tree->horizontal[1].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row + hbs, mi_col,
&this_rdc, subsize, &pc_tree->horizontal[1]);
pc_tree->horizontal[1].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->horizontal[1].mic = *xd->mi[0];
pc_tree->horizontal[1].mbmi_ext = *x->mbmi_ext;
pc_tree->horizontal[1].skip_txfm[0] = x->skip_txfm[0];
pc_tree->horizontal[1].skip = x->skip;
@ -3502,7 +3500,7 @@ static void nonrd_use_partition(VP9_COMP *cpi,
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
subsize = (bsize >= BLOCK_8X8) ? mi[0]->mbmi.sb_type : BLOCK_4X4;
subsize = (bsize >= BLOCK_8X8) ? mi[0]->sb_type : BLOCK_4X4;
partition = partition_lookup[bsl][subsize];
if (output_enabled && bsize != BLOCK_4X4) {
@ -3515,7 +3513,7 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->none.pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, dummy_cost,
subsize, &pc_tree->none);
pc_tree->none.mic.mbmi = xd->mi[0]->mbmi;
pc_tree->none.mic = *xd->mi[0];
pc_tree->none.mbmi_ext = *x->mbmi_ext;
pc_tree->none.skip_txfm[0] = x->skip_txfm[0];
pc_tree->none.skip = x->skip;
@ -3526,7 +3524,7 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->vertical[0].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, dummy_cost,
subsize, &pc_tree->vertical[0]);
pc_tree->vertical[0].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->vertical[0].mic = *xd->mi[0];
pc_tree->vertical[0].mbmi_ext = *x->mbmi_ext;
pc_tree->vertical[0].skip_txfm[0] = x->skip_txfm[0];
pc_tree->vertical[0].skip = x->skip;
@ -3536,7 +3534,7 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->vertical[1].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col + hbs,
dummy_cost, subsize, &pc_tree->vertical[1]);
pc_tree->vertical[1].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->vertical[1].mic = *xd->mi[0];
pc_tree->vertical[1].mbmi_ext = *x->mbmi_ext;
pc_tree->vertical[1].skip_txfm[0] = x->skip_txfm[0];
pc_tree->vertical[1].skip = x->skip;
@ -3548,7 +3546,7 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->horizontal[0].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, dummy_cost,
subsize, &pc_tree->horizontal[0]);
pc_tree->horizontal[0].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->horizontal[0].mic = *xd->mi[0];
pc_tree->horizontal[0].mbmi_ext = *x->mbmi_ext;
pc_tree->horizontal[0].skip_txfm[0] = x->skip_txfm[0];
pc_tree->horizontal[0].skip = x->skip;
@ -3559,7 +3557,7 @@ static void nonrd_use_partition(VP9_COMP *cpi,
pc_tree->horizontal[1].pred_pixel_ready = 1;
nonrd_pick_sb_modes(cpi, tile_data, x, mi_row + hbs, mi_col,
dummy_cost, subsize, &pc_tree->horizontal[1]);
pc_tree->horizontal[1].mic.mbmi = xd->mi[0]->mbmi;
pc_tree->horizontal[1].mic = *xd->mi[0];
pc_tree->horizontal[1].mbmi_ext = *x->mbmi_ext;
pc_tree->horizontal[1].skip_txfm[0] = x->skip_txfm[0];
pc_tree->horizontal[1].skip = x->skip;
@ -3666,7 +3664,7 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi,
case REFERENCE_PARTITION:
set_offsets(cpi, tile_info, x, mi_row, mi_col, BLOCK_64X64);
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled &&
xd->mi[0]->mbmi.segment_id) {
xd->mi[0]->segment_id) {
// Use lower max_partition_size for low resoultions.
if (cm->width <= 352 && cm->height <= 288)
x->max_partition_size = BLOCK_32X32;
@ -4176,9 +4174,9 @@ void vp9_encode_frame(VP9_COMP *cpi) {
}
static void sum_intra_stats(FRAME_COUNTS *counts, const MODE_INFO *mi) {
const PREDICTION_MODE y_mode = mi->mbmi.mode;
const PREDICTION_MODE uv_mode = mi->mbmi.uv_mode;
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
const PREDICTION_MODE y_mode = mi->mode;
const PREDICTION_MODE uv_mode = mi->uv_mode;
const BLOCK_SIZE bsize = mi->sb_type;
if (bsize < BLOCK_8X8) {
int idx, idy;
@ -4203,14 +4201,13 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td,
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO **mi_8x8 = xd->mi;
MODE_INFO *mi = mi_8x8[0];
MB_MODE_INFO *mbmi = &mi->mbmi;
const int seg_skip = segfeature_active(&cm->seg, mbmi->segment_id,
const int seg_skip = segfeature_active(&cm->seg, mi->segment_id,
SEG_LVL_SKIP);
const int mis = cm->mi_stride;
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
const int mi_height = num_8x8_blocks_high_lookup[bsize];
x->skip_recode = !x->select_tx_size && mbmi->sb_type >= BLOCK_8X8 &&
x->skip_recode = !x->select_tx_size && mi->sb_type >= BLOCK_8X8 &&
cpi->oxcf.aq_mode != COMPLEXITY_AQ &&
cpi->oxcf.aq_mode != CYCLIC_REFRESH_AQ &&
cpi->sf.allow_skip_recode;
@ -4227,9 +4224,9 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td,
if (x->skip_encode)
return;
if (!is_inter_block(mbmi)) {
if (!is_inter_block(mi)) {
int plane;
mbmi->skip = 1;
mi->skip = 1;
for (plane = 0; plane < MAX_MB_PLANE; ++plane)
vp9_encode_intra_block_plane(x, VPXMAX(bsize, BLOCK_8X8), plane);
if (output_enabled)
@ -4237,11 +4234,11 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td,
vp9_tokenize_sb(cpi, td, t, !output_enabled, VPXMAX(bsize, BLOCK_8X8));
} else {
int ref;
const int is_compound = has_second_ref(mbmi);
set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]);
const int is_compound = has_second_ref(mi);
set_ref_ptrs(cm, xd, mi->ref_frame[0], mi->ref_frame[1]);
for (ref = 0; ref < 1 + is_compound; ++ref) {
YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi,
mbmi->ref_frame[ref]);
mi->ref_frame[ref]);
assert(cfg != NULL);
vp9_setup_pre_planes(xd, ref, cfg, mi_row, mi_col,
&xd->block_refs[ref]->sf);
@ -4259,29 +4256,29 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td,
if (output_enabled) {
if (cm->tx_mode == TX_MODE_SELECT &&
mbmi->sb_type >= BLOCK_8X8 &&
!(is_inter_block(mbmi) && (mbmi->skip || seg_skip))) {
mi->sb_type >= BLOCK_8X8 &&
!(is_inter_block(mi) && (mi->skip || seg_skip))) {
++get_tx_counts(max_txsize_lookup[bsize], get_tx_size_context(xd),
&td->counts->tx)[mbmi->tx_size];
&td->counts->tx)[mi->tx_size];
} else {
int x, y;
TX_SIZE tx_size;
// The new intra coding scheme requires no change of transform size
if (is_inter_block(&mi->mbmi)) {
if (is_inter_block(mi)) {
tx_size = VPXMIN(tx_mode_to_biggest_tx_size[cm->tx_mode],
max_txsize_lookup[bsize]);
} else {
tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4;
tx_size = (bsize >= BLOCK_8X8) ? mi->tx_size : TX_4X4;
}
for (y = 0; y < mi_height; y++)
for (x = 0; x < mi_width; x++)
if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows)
mi_8x8[mis * y + x]->mbmi.tx_size = tx_size;
mi_8x8[mis * y + x]->tx_size = tx_size;
}
++td->counts->tx.tx_totals[mbmi->tx_size];
++td->counts->tx.tx_totals[get_uv_tx_size(mbmi, &xd->plane[1])];
++td->counts->tx.tx_totals[mi->tx_size];
++td->counts->tx.tx_totals[get_uv_tx_size(mi, &xd->plane[1])];
if (cm->seg.enabled && cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
vp9_cyclic_refresh_update_sb_postencode(cpi, mbmi, mi_row, mi_col, bsize);
vp9_cyclic_refresh_update_sb_postencode(cpi, mi, mi_row, mi_col, bsize);
}
}

View File

@ -91,7 +91,7 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block,
MACROBLOCKD *const xd = &mb->e_mbd;
struct macroblock_plane *const p = &mb->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
const int ref = is_inter_block(&xd->mi[0]->mbmi);
const int ref = is_inter_block(xd->mi[0]);
vp9_token_state tokens[1025][2];
unsigned best_index[1025][2];
uint8_t token_cache[1024];
@ -736,11 +736,11 @@ void vp9_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize) {
void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
struct encode_b_args arg = {x, &ctx, &mbmi->skip};
MODE_INFO *mi = xd->mi[0];
struct encode_b_args arg = {x, &ctx, &mi->skip};
int plane;
mbmi->skip = 1;
mi->skip = 1;
if (x->skip)
return;
@ -751,7 +751,7 @@ void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
if (x->optimize && (!x->skip_recode || !x->skip_optimize)) {
const struct macroblockd_plane* const pd = &xd->plane[plane];
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
const TX_SIZE tx_size = plane ? get_uv_tx_size(mi, pd) : mi->tx_size;
vp9_get_entropy_contexts(bsize, tx_size, pd,
ctx.ta[plane], ctx.tl[plane]);
}
@ -766,7 +766,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
struct encode_b_args* const args = arg;
MACROBLOCK *const x = args->x;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
MODE_INFO *mi = xd->mi[0];
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *coeff = BLOCK_OFFSET(p->coeff, block);
@ -791,9 +791,9 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
if (tx_size == TX_4X4) {
tx_type = get_tx_type_4x4(get_plane_type(plane), xd, block);
scan_order = &vp9_scan_orders[TX_4X4][tx_type];
mode = plane == 0 ? get_y_mode(xd->mi[0], block) : mbmi->uv_mode;
mode = plane == 0 ? get_y_mode(xd->mi[0], block) : mi->uv_mode;
} else {
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
mode = plane == 0 ? mi->mode : mi->uv_mode;
if (tx_size == TX_32X32) {
scan_order = &vp9_default_scan_orders[TX_32X32];
} else {
@ -968,7 +968,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
void vp9_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
const MACROBLOCKD *const xd = &x->e_mbd;
struct encode_b_args arg = {x, NULL, &xd->mi[0]->mbmi.skip};
struct encode_b_args arg = {x, NULL, &xd->mi[0]->skip};
vp9_foreach_transformed_block_in_plane(xd, bsize, plane,
vp9_encode_block_intra, &arg);

View File

@ -230,13 +230,13 @@ void vp9_build_nmv_cost_table(int *mvjoint, int *mvcost[2],
build_nmv_component_cost_table(mvcost[1], &ctx->comps[1], usehp);
}
static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext,
static void inc_mvs(const MODE_INFO *mi, const MB_MODE_INFO_EXT *mbmi_ext,
const int_mv mvs[2],
nmv_context_counts *counts) {
int i;
for (i = 0; i < 1 + has_second_ref(mbmi); ++i) {
const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_mv;
for (i = 0; i < 1 + has_second_ref(mi); ++i) {
const MV *ref = &mbmi_ext->ref_mvs[mi->ref_frame[i]][0].as_mv;
const MV diff = {mvs[i].as_mv.row - ref->row,
mvs[i].as_mv.col - ref->col};
vp9_inc_mv(&diff, counts);
@ -246,24 +246,23 @@ static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext,
void vp9_update_mv_count(ThreadData *td) {
const MACROBLOCKD *xd = &td->mb.e_mbd;
const MODE_INFO *mi = xd->mi[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
const MB_MODE_INFO_EXT *mbmi_ext = td->mb.mbmi_ext;
if (mbmi->sb_type < BLOCK_8X8) {
const int num_4x4_w = num_4x4_blocks_wide_lookup[mbmi->sb_type];
const int num_4x4_h = num_4x4_blocks_high_lookup[mbmi->sb_type];
if (mi->sb_type < BLOCK_8X8) {
const int num_4x4_w = num_4x4_blocks_wide_lookup[mi->sb_type];
const int num_4x4_h = num_4x4_blocks_high_lookup[mi->sb_type];
int idx, idy;
for (idy = 0; idy < 2; idy += num_4x4_h) {
for (idx = 0; idx < 2; idx += num_4x4_w) {
const int i = idy * 2 + idx;
if (mi->bmi[i].as_mode == NEWMV)
inc_mvs(mbmi, mbmi_ext, mi->bmi[i].as_mv, &td->counts->mv);
inc_mvs(mi, mbmi_ext, mi->bmi[i].as_mv, &td->counts->mv);
}
}
} else {
if (mbmi->mode == NEWMV)
inc_mvs(mbmi, mbmi_ext, mbmi->mv, &td->counts->mv);
if (mi->mode == NEWMV)
inc_mvs(mi, mbmi_ext, mi->mv, &td->counts->mv);
}
}

View File

@ -609,7 +609,7 @@ static void update_reference_segmentation_map(VP9_COMP *cpi) {
MODE_INFO **mi_8x8 = mi_8x8_ptr;
uint8_t *cache = cache_ptr;
for (col = 0; col < cm->mi_cols; col++, mi_8x8++, cache++)
cache[0] = mi_8x8[0]->mbmi.segment_id;
cache[0] = mi_8x8[0]->segment_id;
mi_8x8_ptr += cm->mi_stride;
cache_ptr += cm->mi_cols;
}

View File

@ -396,7 +396,7 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
MV tmp_mv = {0, 0};
MV ref_mv_full = {ref_mv->row >> 3, ref_mv->col >> 3};
int num00, tmp_err, n;
const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
const BLOCK_SIZE bsize = xd->mi[0]->sb_type;
vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[bsize];
const int new_mv_mode_penalty = NEW_MV_MODE_PENALTY;
@ -663,8 +663,8 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
xd->plane[1].dst.buf = new_yv12->u_buffer + recon_uvoffset;
xd->plane[2].dst.buf = new_yv12->v_buffer + recon_uvoffset;
xd->left_available = (mb_col != 0);
xd->mi[0]->mbmi.sb_type = bsize;
xd->mi[0]->mbmi.ref_frame[0] = INTRA_FRAME;
xd->mi[0]->sb_type = bsize;
xd->mi[0]->ref_frame[0] = INTRA_FRAME;
set_mi_row_col(xd, &tile,
mb_row << 1, num_8x8_blocks_high_lookup[bsize],
mb_col << 1, num_8x8_blocks_wide_lookup[bsize],
@ -672,8 +672,8 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
// Do intra 16x16 prediction.
x->skip_encode = 0;
xd->mi[0]->mbmi.mode = DC_PRED;
xd->mi[0]->mbmi.tx_size = use_dc_pred ?
xd->mi[0]->mode = DC_PRED;
xd->mi[0]->tx_size = use_dc_pred ?
(bsize >= BLOCK_16X16 ? TX_16X16 : TX_8X8) : TX_4X4;
vp9_encode_intra_block_plane(x, bsize, 0);
this_error = vpx_get_mb_ss(x->plane[0].src_diff);
@ -897,11 +897,11 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
mv.row *= 8;
mv.col *= 8;
this_error = motion_error;
xd->mi[0]->mbmi.mode = NEWMV;
xd->mi[0]->mbmi.mv[0].as_mv = mv;
xd->mi[0]->mbmi.tx_size = TX_4X4;
xd->mi[0]->mbmi.ref_frame[0] = LAST_FRAME;
xd->mi[0]->mbmi.ref_frame[1] = NONE;
xd->mi[0]->mode = NEWMV;
xd->mi[0]->mv[0].as_mv = mv;
xd->mi[0]->tx_size = TX_4X4;
xd->mi[0]->ref_frame[0] = LAST_FRAME;
xd->mi[0]->ref_frame[1] = NONE;
vp9_build_inter_predictors_sby(xd, mb_row << 1, mb_col << 1, bsize);
vp9_encode_sby_pass1(x, bsize);
sum_mvr += mv.row;

View File

@ -69,8 +69,8 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
&distortion, &sse, NULL, 0, 0);
}
xd->mi[0]->mbmi.mode = NEWMV;
xd->mi[0]->mbmi.mv[0].as_mv = *dst_mv;
xd->mi[0]->mode = NEWMV;
xd->mi[0]->mv[0].as_mv = *dst_mv;
vp9_build_inter_predictors_sby(xd, mb_row, mb_col, BLOCK_16X16);
@ -147,7 +147,7 @@ static int find_best_16x16_intra(VP9_COMP *cpi, PREDICTION_MODE *pbest_mode) {
for (mode = DC_PRED; mode <= TM_PRED; mode++) {
unsigned int err;
xd->mi[0]->mbmi.mode = mode;
xd->mi[0]->mode = mode;
vp9_predict_intra_block(xd, 2, TX_16X16, mode,
x->plane[0].src.buf, x->plane[0].src.stride,
xd->plane[0].dst.buf, xd->plane[0].dst.stride,
@ -254,9 +254,9 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi,
xd->plane[0].pre[0].stride = buf->y_stride;
xd->plane[1].dst.stride = buf->uv_stride;
xd->mi[0] = &mi_local;
mi_local.mbmi.sb_type = BLOCK_16X16;
mi_local.mbmi.ref_frame[0] = LAST_FRAME;
mi_local.mbmi.ref_frame[1] = NONE;
mi_local.sb_type = BLOCK_16X16;
mi_local.ref_frame[0] = LAST_FRAME;
mi_local.ref_frame[1] = NONE;
for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) {
MV gld_left_mv = gld_top_mv;

View File

@ -1825,7 +1825,7 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize,
int mi_row, int mi_col) {
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
MODE_INFO *mi = xd->mi[0];
struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0, 0}};
DECLARE_ALIGNED(16, int16_t, hbuf[128]);
DECLARE_ALIGNED(16, int16_t, vbuf[128]);
@ -1839,12 +1839,12 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
const int src_stride = x->plane[0].src.stride;
const int ref_stride = xd->plane[0].pre[0].stride;
uint8_t const *ref_buf, *src_buf;
MV *tmp_mv = &xd->mi[0]->mbmi.mv[0].as_mv;
MV *tmp_mv = &xd->mi[0]->mv[0].as_mv;
unsigned int best_sad, tmp_sad, this_sad[4];
MV this_mv;
const int norm_factor = 3 + (bw >> 5);
const YV12_BUFFER_CONFIG *scaled_ref_frame =
vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[0]);
vp9_get_scaled_ref_frame(cpi, mi->ref_frame[0]);
if (scaled_ref_frame) {
int i;

View File

@ -49,7 +49,7 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCK *x,
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 POSITION *const mv_ref_search = mv_ref_blocks[mi->sb_type];
int different_ref_found = 0;
int context_counter = 0;
@ -66,12 +66,11 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCK *x,
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row *
xd->mi_stride];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
// Keep counts for entropy encoding.
context_counter += mode_2_counter[candidate->mode];
context_counter += mode_2_counter[candidate_mi->mode];
different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame)
if (candidate_mi->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, -1),
refmv_count, mv_ref_list, Done);
}
@ -85,12 +84,12 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCK *x,
for (; i < MVREF_NEIGHBOURS && !refmv_count; ++i) {
const POSITION *const mv_ref = &mv_ref_search[i];
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
const MB_MODE_INFO *const candidate = &xd->mi[mv_ref->col + mv_ref->row *
xd->mi_stride]->mbmi;
const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row *
xd->mi_stride];
different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(candidate->mv[0], refmv_count, mv_ref_list, Done);
if (candidate_mi->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(candidate_mi->mv[0], refmv_count, mv_ref_list, Done);
}
}
@ -101,11 +100,11 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCK *x,
for (i = 0; i < MVREF_NEIGHBOURS; ++i) {
const POSITION *mv_ref = &mv_ref_search[i];
if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) {
const MB_MODE_INFO *const candidate = &xd->mi[mv_ref->col + mv_ref->row
* xd->mi_stride]->mbmi;
const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row
* xd->mi_stride];
// If the candidate is INTRA we don't want to consider its mv.
IF_DIFF_REF_FRAME_ADD_MV(candidate, ref_frame, ref_sign_bias,
IF_DIFF_REF_FRAME_ADD_MV(candidate_mi, ref_frame, ref_sign_bias,
refmv_count, mv_ref_list, Done);
}
}
@ -127,12 +126,12 @@ static int combined_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int_mv *tmp_mv, int *rate_mv,
int64_t best_rd_sofar) {
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
MODE_INFO *mi = xd->mi[0];
struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0, 0}};
const int step_param = cpi->sf.mv.fullpel_search_step_param;
const int sadpb = x->sadperbit16;
MV mvp_full;
const int ref = mbmi->ref_frame[0];
const int ref = mi->ref_frame[0];
const MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv;
int dis;
int rate_mode;
@ -300,7 +299,7 @@ static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize,
tx_size = TX_8X8;
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ &&
cyclic_refresh_segment_id_boosted(xd->mi[0]->mbmi.segment_id))
cyclic_refresh_segment_id_boosted(xd->mi[0]->segment_id))
tx_size = TX_8X8;
else if (tx_size > TX_16X16)
tx_size = TX_16X16;
@ -310,7 +309,7 @@ static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize,
}
assert(tx_size >= TX_8X8);
xd->mi[0]->mbmi.tx_size = tx_size;
xd->mi[0]->tx_size = tx_size;
// Evaluate if the partition block is a skippable block in Y plane.
{
@ -379,7 +378,7 @@ static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize,
for (i = 1; i <= 2; i++) {
struct macroblock_plane *const p = &x->plane[i];
struct macroblockd_plane *const pd = &xd->plane[i];
const TX_SIZE uv_tx_size = get_uv_tx_size(&xd->mi[0]->mbmi, pd);
const TX_SIZE uv_tx_size = get_uv_tx_size(xd->mi[0], pd);
const BLOCK_SIZE unit_size = txsize_to_bsize[uv_tx_size];
const BLOCK_SIZE uv_bsize = get_plane_block_size(bsize, pd);
const int uv_bw = b_width_log2_lookup[uv_bsize];
@ -475,19 +474,19 @@ static void model_rd_for_sb_y(VP9_COMP *cpi, BLOCK_SIZE bsize,
if (cpi->common.tx_mode == TX_MODE_SELECT) {
if (sse > (var << 2))
xd->mi[0]->mbmi.tx_size =
xd->mi[0]->tx_size =
VPXMIN(max_txsize_lookup[bsize],
tx_mode_to_biggest_tx_size[cpi->common.tx_mode]);
else
xd->mi[0]->mbmi.tx_size = TX_8X8;
xd->mi[0]->tx_size = TX_8X8;
if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ &&
cyclic_refresh_segment_id_boosted(xd->mi[0]->mbmi.segment_id))
xd->mi[0]->mbmi.tx_size = TX_8X8;
else if (xd->mi[0]->mbmi.tx_size > TX_16X16)
xd->mi[0]->mbmi.tx_size = TX_16X16;
cyclic_refresh_segment_id_boosted(xd->mi[0]->segment_id))
xd->mi[0]->tx_size = TX_8X8;
else if (xd->mi[0]->tx_size > TX_16X16)
xd->mi[0]->tx_size = TX_16X16;
} else {
xd->mi[0]->mbmi.tx_size =
xd->mi[0]->tx_size =
VPXMIN(max_txsize_lookup[bsize],
tx_mode_to_biggest_tx_size[cpi->common.tx_mode]);
}
@ -495,7 +494,7 @@ static void model_rd_for_sb_y(VP9_COMP *cpi, BLOCK_SIZE bsize,
// Evaluate if the partition block is a skippable block in Y plane.
{
const BLOCK_SIZE unit_size =
txsize_to_bsize[xd->mi[0]->mbmi.tx_size];
txsize_to_bsize[xd->mi[0]->tx_size];
const unsigned int num_blk_log2 =
(b_width_log2_lookup[bsize] - b_width_log2_lookup[unit_size]) +
(b_height_log2_lookup[bsize] - b_height_log2_lookup[unit_size]);
@ -779,7 +778,7 @@ static void encode_breakout_test(VP9_COMP *cpi, MACROBLOCK *x,
struct buf_2d yv12_mb[][MAX_MB_PLANE],
int *rate, int64_t *dist) {
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MODE_INFO *const mi = xd->mi[0];
const BLOCK_SIZE uv_size = get_plane_block_size(bsize, &xd->plane[1]);
unsigned int var = var_y, sse = sse_y;
// Skipping threshold for ac.
@ -787,10 +786,10 @@ static void encode_breakout_test(VP9_COMP *cpi, MACROBLOCK *x,
// Skipping threshold for dc.
unsigned int thresh_dc;
int motion_low = 1;
if (mbmi->mv[0].as_mv.row > 64 ||
mbmi->mv[0].as_mv.row < -64 ||
mbmi->mv[0].as_mv.col > 64 ||
mbmi->mv[0].as_mv.col < -64)
if (mi->mv[0].as_mv.row > 64 ||
mi->mv[0].as_mv.row < -64 ||
mi->mv[0].as_mv.col > 64 ||
mi->mv[0].as_mv.col < -64)
motion_low = 0;
if (x->encode_breakout > 0 && motion_low == 1) {
// Set a maximum for threshold to avoid big PSNR loss in low bit rate
@ -981,7 +980,7 @@ static INLINE void update_thresh_freq_fact(VP9_COMP *cpi,
void vp9_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost,
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MODE_INFO *const mi = xd->mi[0];
RD_COST this_rdc, best_rdc;
PREDICTION_MODE this_mode;
struct estimate_block_intra_args args = { cpi, x, DC_PRED, 0, 0 };
@ -1000,9 +999,9 @@ void vp9_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost,
vp9_rd_cost_reset(&best_rdc);
vp9_rd_cost_reset(&this_rdc);
mbmi->ref_frame[0] = INTRA_FRAME;
mbmi->mv[0].as_int = INVALID_MV;
mbmi->uv_mode = DC_PRED;
mi->ref_frame[0] = INTRA_FRAME;
mi->mv[0].as_int = INVALID_MV;
mi->uv_mode = DC_PRED;
memset(x->skip_txfm, 0, sizeof(x->skip_txfm));
// Change the limit of this loop to add other intra prediction
@ -1011,7 +1010,7 @@ void vp9_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost,
args.mode = this_mode;
args.rate = 0;
args.dist = 0;
mbmi->tx_size = intra_tx_size;
mi->tx_size = intra_tx_size;
vp9_foreach_transformed_block_in_plane(xd, bsize, 0,
estimate_block_intra, &args);
this_rdc.rate = args.rate;
@ -1022,7 +1021,7 @@ void vp9_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost,
if (this_rdc.rdcost < best_rdc.rdcost) {
best_rdc = this_rdc;
mbmi->mode = this_mode;
mi->mode = this_mode;
}
}
@ -1097,7 +1096,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
const SVC *const svc = &cpi->svc;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MODE_INFO *const mi = xd->mi[0];
struct macroblockd_plane *const pd = &xd->plane[0];
PREDICTION_MODE best_mode = ZEROMV;
MV_REFERENCE_FRAME ref_frame, best_ref_frame = LAST_FRAME;
@ -1116,7 +1115,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
const int intra_cost_penalty = set_intra_cost_penalty(cpi, bsize);
const int64_t inter_mode_thresh = RDCOST(x->rdmult, x->rddiv,
intra_cost_penalty, 0);
const int *const rd_threshes = cpi->rd.threshes[mbmi->segment_id][bsize];
const int *const rd_threshes = cpi->rd.threshes[mi->segment_id][bsize];
const int *const rd_thresh_freq_fact = tile_data->thresh_freq_fact[bsize];
INTERP_FILTER filter_ref;
const int bsl = mi_width_log2_lookup[bsize];
@ -1174,20 +1173,20 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
x->skip = 0;
if (xd->up_available)
filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter;
filter_ref = xd->mi[-xd->mi_stride]->interp_filter;
else if (xd->left_available)
filter_ref = xd->mi[-1]->mbmi.interp_filter;
filter_ref = xd->mi[-1]->interp_filter;
else
filter_ref = cm->interp_filter;
// initialize mode decisions
vp9_rd_cost_reset(&best_rdc);
vp9_rd_cost_reset(rd_cost);
mbmi->sb_type = bsize;
mbmi->ref_frame[0] = NONE;
mbmi->ref_frame[1] = NONE;
mbmi->tx_size = VPXMIN(max_txsize_lookup[bsize],
tx_mode_to_biggest_tx_size[cm->tx_mode]);
mi->sb_type = bsize;
mi->ref_frame[0] = NONE;
mi->ref_frame[1] = NONE;
mi->tx_size = VPXMIN(max_txsize_lookup[bsize],
tx_mode_to_biggest_tx_size[cm->tx_mode]);
#if CONFIG_VP9_TEMPORAL_DENOISING
vp9_denoiser_reset_frame_stats(ctx);
@ -1289,7 +1288,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
for (i = 0; i < MAX_MB_PLANE; i++)
xd->plane[i].pre[0] = yv12_mb[ref_frame][i];
mbmi->ref_frame[0] = ref_frame;
mi->ref_frame[0] = ref_frame;
set_ref_ptrs(cm, xd, ref_frame, NONE);
mode_index = mode_idx[ref_frame][INTER_OFFSET(this_mode)];
@ -1314,7 +1313,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (tmp_sad + (num_pels_log2_lookup[bsize] << 4) > best_pred_sad)
continue;
frame_mv[NEWMV][ref_frame].as_int = mbmi->mv[0].as_int;
frame_mv[NEWMV][ref_frame].as_int = mi->mv[0].as_int;
rate_mv = vp9_mv_bit_cost(&frame_mv[NEWMV][ref_frame].as_mv,
&x->mbmi_ext->ref_mvs[ref_frame][0].as_mv,
x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
@ -1369,8 +1368,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
frame_mv[NEARESTMV][ref_frame].as_int)
continue;
mbmi->mode = this_mode;
mbmi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int;
mi->mode = this_mode;
mi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int;
// Search for the best prediction filter type, when the resulting
// motion vector is at sub-pixel accuracy level for luma component, i.e.,
@ -1388,7 +1387,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if ((this_mode == NEWMV || filter_ref == SWITCHABLE) && pred_filter_search
&& (ref_frame == LAST_FRAME ||
(ref_frame == GOLDEN_FRAME && cpi->use_svc))
&& (((mbmi->mv[0].as_mv.row | mbmi->mv[0].as_mv.col) & 0x07) != 0)) {
&& (((mi->mv[0].as_mv.row | mi->mv[0].as_mv.col) & 0x07) != 0)) {
int pf_rate[3];
int64_t pf_dist[3];
unsigned int pf_var[3];
@ -1400,13 +1399,13 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
for (filter = EIGHTTAP; filter <= EIGHTTAP_SMOOTH; ++filter) {
int64_t cost;
mbmi->interp_filter = filter;
mi->interp_filter = filter;
vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize);
model_rd_for_sb_y(cpi, bsize, x, xd, &pf_rate[filter], &pf_dist[filter],
&pf_var[filter], &pf_sse[filter]);
pf_rate[filter] += vp9_get_switchable_rate(cpi, xd);
cost = RDCOST(x->rdmult, x->rddiv, pf_rate[filter], pf_dist[filter]);
pf_tx_size[filter] = mbmi->tx_size;
pf_tx_size[filter] = mi->tx_size;
if (cost < best_cost) {
best_filter = filter;
best_cost = cost;
@ -1430,8 +1429,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (reuse_inter_pred && this_mode_pred != current_pred)
free_pred_buffer(current_pred);
mbmi->interp_filter = best_filter;
mbmi->tx_size = pf_tx_size[best_filter];
mi->interp_filter = best_filter;
mi->tx_size = pf_tx_size[best_filter];
this_rdc.rate = pf_rate[best_filter];
this_rdc.dist = pf_dist[best_filter];
var_y = pf_var[best_filter];
@ -1442,12 +1441,12 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
pd->dst.stride = this_mode_pred->stride;
}
} else {
mbmi->interp_filter = (filter_ref == SWITCHABLE) ? EIGHTTAP : filter_ref;
mi->interp_filter = (filter_ref == SWITCHABLE) ? EIGHTTAP : filter_ref;
vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize);
// For large partition blocks, extra testing is done.
if (bsize > BLOCK_32X32 &&
!cyclic_refresh_segment_id_boosted(xd->mi[0]->mbmi.segment_id) &&
!cyclic_refresh_segment_id_boosted(xd->mi[0]->segment_id) &&
cm->base_qindex) {
model_rd_for_sb_y_large(cpi, bsize, x, xd, &this_rdc.rate,
&this_rdc.dist, &var_y, &sse_y, mi_row, mi_col,
@ -1461,7 +1460,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (!this_early_term) {
this_sse = (int64_t)sse_y;
block_yrd(cpi, x, &this_rdc.rate, &this_rdc.dist, &is_skippable,
&this_sse, 0, bsize, VPXMIN(mbmi->tx_size, TX_16X16));
&this_sse, 0, bsize, VPXMIN(mi->tx_size, TX_16X16));
x->skip_txfm[0] = is_skippable;
if (is_skippable) {
this_rdc.rate = vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1);
@ -1477,7 +1476,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
}
if (cm->interp_filter == SWITCHABLE) {
if ((mbmi->mv[0].as_mv.row | mbmi->mv[0].as_mv.col) & 0x07)
if ((mi->mv[0].as_mv.row | mi->mv[0].as_mv.col) & 0x07)
this_rdc.rate += vp9_get_switchable_rate(cpi, xd);
}
} else {
@ -1548,7 +1547,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
#if CONFIG_VP9_TEMPORAL_DENOISING
if (cpi->oxcf.noise_sensitivity > 0) {
vp9_denoiser_update_frame_stats(mbmi, sse_y, this_mode, ctx);
vp9_denoiser_update_frame_stats(mi, sse_y, this_mode, ctx);
// Keep track of zero_last cost.
if (ref_frame == LAST_FRAME && frame_mv[this_mode][ref_frame].as_int == 0)
zero_last_cost_orig = this_rdc.rdcost;
@ -1560,8 +1559,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (this_rdc.rdcost < best_rdc.rdcost || x->skip) {
best_rdc = this_rdc;
best_mode = this_mode;
best_pred_filter = mbmi->interp_filter;
best_tx_size = mbmi->tx_size;
best_pred_filter = mi->interp_filter;
best_tx_size = mi->tx_size;
best_ref_frame = ref_frame;
best_mode_skip_txfm = x->skip_txfm[0];
best_early_term = this_early_term;
@ -1586,12 +1585,12 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
}
}
mbmi->mode = best_mode;
mbmi->interp_filter = best_pred_filter;
mbmi->tx_size = best_tx_size;
mbmi->ref_frame[0] = best_ref_frame;
mbmi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int;
xd->mi[0]->bmi[0].as_mv[0].as_int = mbmi->mv[0].as_int;
mi->mode = best_mode;
mi->interp_filter = best_pred_filter;
mi->tx_size = best_tx_size;
mi->ref_frame[0] = best_ref_frame;
mi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int;
xd->mi[0]->bmi[0].as_mv[0].as_int = mi->mv[0].as_int;
x->skip_txfm[0] = best_mode_skip_txfm;
// Perform intra prediction search, if the best SAD is above a certain
@ -1642,12 +1641,12 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
rd_thresh_freq_fact[mode_index]))
continue;
mbmi->mode = this_mode;
mbmi->ref_frame[0] = INTRA_FRAME;
mi->mode = this_mode;
mi->ref_frame[0] = INTRA_FRAME;
args.mode = this_mode;
args.rate = 0;
args.dist = 0;
mbmi->tx_size = intra_tx_size;
mi->tx_size = intra_tx_size;
vp9_foreach_transformed_block_in_plane(xd, bsize, 0,
estimate_block_intra, &args);
// Inter and intra RD will mismatch in scale for non-screen content.
@ -1670,29 +1669,29 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (this_rdc.rdcost < best_rdc.rdcost) {
best_rdc = this_rdc;
best_mode = this_mode;
best_intra_tx_size = mbmi->tx_size;
best_intra_tx_size = mi->tx_size;
best_ref_frame = INTRA_FRAME;
mbmi->uv_mode = this_mode;
mbmi->mv[0].as_int = INVALID_MV;
mi->uv_mode = this_mode;
mi->mv[0].as_int = INVALID_MV;
best_mode_skip_txfm = x->skip_txfm[0];
}
}
// Reset mb_mode_info to the best inter mode.
if (best_ref_frame != INTRA_FRAME) {
mbmi->tx_size = best_tx_size;
mi->tx_size = best_tx_size;
} else {
mbmi->tx_size = best_intra_tx_size;
mi->tx_size = best_intra_tx_size;
}
}
pd->dst = orig_dst;
mbmi->mode = best_mode;
mbmi->ref_frame[0] = best_ref_frame;
mi->mode = best_mode;
mi->ref_frame[0] = best_ref_frame;
x->skip_txfm[0] = best_mode_skip_txfm;
if (reuse_inter_pred && best_pred != NULL) {
if (best_pred->data != orig_dst.buf && is_inter_mode(mbmi->mode)) {
if (best_pred->data != orig_dst.buf && is_inter_mode(mi->mode)) {
#if CONFIG_VP9_HIGHBITDEPTH
if (cm->use_highbitdepth)
vpx_highbd_convolve_copy(best_pred->data, best_pred->stride,
@ -1727,11 +1726,11 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
// Check if we should pick ZEROMV on denoised signal.
int rate = 0;
int64_t dist = 0;
mbmi->mode = ZEROMV;
mbmi->ref_frame[0] = LAST_FRAME;
mbmi->ref_frame[1] = NONE;
mbmi->mv[0].as_int = 0;
mbmi->interp_filter = EIGHTTAP;
mi->mode = ZEROMV;
mi->ref_frame[0] = LAST_FRAME;
mi->ref_frame[1] = NONE;
mi->mv[0].as_int = 0;
mi->interp_filter = EIGHTTAP;
xd->plane[0].pre[0] = yv12_mb[LAST_FRAME][0];
vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize);
model_rd_for_sb_y(cpi, bsize, x, xd, &rate, &dist, &var_y, &sse_y);
@ -1744,19 +1743,19 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
// is lower than best_ref mode (on original source).
if (this_rdc.rdcost > best_rdc.rdcost) {
this_rdc = best_rdc;
mbmi->mode = best_mode;
mbmi->ref_frame[0] = best_ref_frame;
mbmi->interp_filter = best_pred_filter;
mi->mode = best_mode;
mi->ref_frame[0] = best_ref_frame;
mi->interp_filter = best_pred_filter;
if (best_ref_frame == INTRA_FRAME)
mbmi->mv[0].as_int = INVALID_MV;
mi->mv[0].as_int = INVALID_MV;
else if (best_ref_frame == GOLDEN_FRAME) {
mbmi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int;
mi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int;
if (reuse_inter_pred) {
xd->plane[0].pre[0] = yv12_mb[GOLDEN_FRAME][0];
vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize);
}
}
mbmi->tx_size = best_tx_size;
mi->tx_size = best_tx_size;
x->skip_txfm[0] = best_mode_skip_txfm;
} else {
best_ref_frame = LAST_FRAME;
@ -1767,7 +1766,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
#endif
if (cpi->sf.adaptive_rd_thresh) {
THR_MODES best_mode_idx = mode_idx[best_ref_frame][mode_offset(mbmi->mode)];
THR_MODES best_mode_idx = mode_idx[best_ref_frame][mode_offset(mi->mode)];
if (best_ref_frame == INTRA_FRAME) {
// Only consider the modes that are included in the intra_mode_list.
@ -1801,12 +1800,12 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
VP9_COMMON *const cm = &cpi->common;
SPEED_FEATURES *const sf = &cpi->sf;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MODE_INFO *const mi = xd->mi[0];
MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
const struct segmentation *const seg = &cm->seg;
MV_REFERENCE_FRAME ref_frame, second_ref_frame = NONE;
MV_REFERENCE_FRAME best_ref_frame = NONE;
unsigned char segment_id = mbmi->segment_id;
unsigned char segment_id = mi->segment_id;
struct buf_2d yv12_mb[4][MAX_MB_PLANE];
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
VP9_ALT_FLAG };
@ -1841,13 +1840,13 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
}
}
mbmi->sb_type = bsize;
mbmi->tx_size = TX_4X4;
mbmi->uv_mode = DC_PRED;
mbmi->ref_frame[0] = LAST_FRAME;
mbmi->ref_frame[1] = NONE;
mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP
: cm->interp_filter;
mi->sb_type = bsize;
mi->tx_size = TX_4X4;
mi->uv_mode = DC_PRED;
mi->ref_frame[0] = LAST_FRAME;
mi->ref_frame[1] = NONE;
mi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP
: cm->interp_filter;
for (ref_frame = LAST_FRAME; ref_frame <= GOLDEN_FRAME; ++ref_frame) {
int64_t this_rd = 0;
@ -1875,7 +1874,7 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
get_segdata(seg, segment_id, SEG_LVL_REF_FRAME) != (int)ref_frame)
continue;
mbmi->ref_frame[0] = ref_frame;
mi->ref_frame[0] = ref_frame;
x->skip = 0;
set_ref_ptrs(cm, xd, ref_frame, second_ref_frame);
@ -1992,7 +1991,7 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
&xd->block_refs[0]->sf,
4 * num_4x4_blocks_wide,
4 * num_4x4_blocks_high, 0,
vp9_filter_kernels[mbmi->interp_filter],
vp9_filter_kernels[mi->interp_filter],
MV_PRECISION_Q3,
mi_col * MI_SIZE + 4 * (i & 0x01),
mi_row * MI_SIZE + 4 * (i >> 1), xd->bd);
@ -2004,7 +2003,7 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
&xd->block_refs[0]->sf,
4 * num_4x4_blocks_wide,
4 * num_4x4_blocks_high, 0,
vp9_filter_kernels[mbmi->interp_filter],
vp9_filter_kernels[mi->interp_filter],
MV_PRECISION_Q3,
mi_col * MI_SIZE + 4 * (i & 0x01),
mi_row * MI_SIZE + 4 * (i >> 1));
@ -2046,8 +2045,8 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
}
} // reference frames
mbmi->tx_size = TX_4X4;
mbmi->ref_frame[0] = best_ref_frame;
mi->tx_size = TX_4X4;
mi->ref_frame[0] = best_ref_frame;
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
const int block = idy * 2 + idx;
@ -2058,7 +2057,7 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
xd->mi[0]->bmi[block + 2] = bsi[best_ref_frame][block];
}
}
mbmi->mode = xd->mi[0]->bmi[3].as_mode;
mi->mode = xd->mi[0]->bmi[3].as_mode;
ctx->mic = *(xd->mi[0]);
ctx->mbmi_ext = *x->mbmi_ext;
ctx->skip_txfm[0] = SKIP_TXFM_NONE;

View File

@ -308,7 +308,7 @@ void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) {
const VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
QUANTS *const quants = &cpi->quants;
const int segment_id = xd->mi[0]->mbmi.segment_id;
const int segment_id = xd->mi[0]->segment_id;
const int qindex = vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex);
const int rdmult = vp9_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q);
int i;

View File

@ -557,10 +557,10 @@ YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi,
}
int vp9_get_switchable_rate(const VP9_COMP *cpi, const MACROBLOCKD *const xd) {
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const MODE_INFO *const mi = xd->mi[0];
const int ctx = vp9_get_pred_context_switchable_interp(xd);
return SWITCHABLE_INTERP_RATE_FACTOR *
cpi->switchable_interp_costs[ctx][mbmi->interp_filter];
cpi->switchable_interp_costs[ctx][mi->interp_filter];
}
void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {

File diff suppressed because it is too large Load Diff

View File

@ -118,7 +118,7 @@ static void count_segs(const VP9_COMMON *cm, MACROBLOCKD *xd,
return;
xd->mi = mi;
segment_id = xd->mi[0]->mbmi.segment_id;
segment_id = xd->mi[0]->segment_id;
set_mi_row_col(xd, tile, mi_row, bh, mi_col, bw, cm->mi_rows, cm->mi_cols);
@ -127,7 +127,7 @@ static void count_segs(const VP9_COMMON *cm, MACROBLOCKD *xd,
// Temporal prediction not allowed on key frames
if (cm->frame_type != KEY_FRAME) {
const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
const BLOCK_SIZE bsize = xd->mi[0]->sb_type;
// Test to see if the segment id matches the predicted value.
const int pred_segment_id = get_segment_id(cm, cm->last_frame_seg_map,
bsize, mi_row, mi_col);
@ -136,7 +136,7 @@ static void count_segs(const VP9_COMMON *cm, MACROBLOCKD *xd,
// Store the prediction status for this mb and update counts
// as appropriate
xd->mi[0]->mbmi.seg_id_predicted = pred_flag;
xd->mi[0]->seg_id_predicted = pred_flag;
temporal_predictor_count[pred_context][pred_flag]++;
// Update the "unpredicted" segment count
@ -159,8 +159,8 @@ static void count_segs_sb(const VP9_COMMON *cm, MACROBLOCKD *xd,
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
bw = num_8x8_blocks_wide_lookup[mi[0]->mbmi.sb_type];
bh = num_8x8_blocks_high_lookup[mi[0]->mbmi.sb_type];
bw = num_8x8_blocks_wide_lookup[mi[0]->sb_type];
bh = num_8x8_blocks_high_lookup[mi[0]->sb_type];
if (bw == bs && bh == bs) {
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,

View File

@ -46,7 +46,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd,
const int which_mv = 0;
const MV mv = { mv_row, mv_col };
const InterpKernel *const kernel =
vp9_filter_kernels[xd->mi[0]->mbmi.interp_filter];
vp9_filter_kernels[xd->mi[0]->interp_filter];
enum mv_precision mv_precision_uv;
int uv_stride;

View File

@ -468,17 +468,17 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
uint8_t token_cache[32 * 32];
struct macroblock_plane *p = &x->plane[plane];
struct macroblockd_plane *pd = &xd->plane[plane];
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
MODE_INFO *mi = xd->mi[0];
int pt; /* near block/prev token context index */
int c;
TOKENEXTRA *t = *tp; /* store tokens starting here */
int eob = p->eobs[block];
const PLANE_TYPE type = get_plane_type(plane);
const tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
const int segment_id = mbmi->segment_id;
const int segment_id = mi->segment_id;
const int16_t *scan, *nb;
const scan_order *so;
const int ref = is_inter_block(mbmi);
const int ref = is_inter_block(mi);
unsigned int (*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
td->rd_counts.coef_counts[tx_size][type][ref];
vpx_prob (*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
@ -585,12 +585,12 @@ void vp9_tokenize_sb(VP9_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MODE_INFO *const mi = xd->mi[0];
const int ctx = vp9_get_skip_context(xd);
const int skip_inc = !segfeature_active(&cm->seg, mbmi->segment_id,
const int skip_inc = !segfeature_active(&cm->seg, mi->segment_id,
SEG_LVL_SKIP);
struct tokenize_b_args arg = {cpi, td, t};
if (mbmi->skip) {
if (mi->skip) {
if (!dry_run)
td->counts->skip[ctx][1] += skip_inc;
reset_skip_context(xd, bsize);