These copies occurred for each macroblock in the encoder and decoder.
Thetemp MB_MODE_INFO mbmi was removed from MACROBLOCKD. As a result,
a large number compile errors had to be fixed.
Change-Id: I4cf0ffae3ce244f6db04a4c217d52dd256382cf3
{
DECLARE_ALIGNED(16, short, diff[400]); // from idct diff
DECLARE_ALIGNED(16, unsigned char, predictor[384]);
- DECLARE_ALIGNED(16, short, reference[384]);
+//not used DECLARE_ALIGNED(16, short, reference[384]);
DECLARE_ALIGNED(16, short, qcoeff[400]);
DECLARE_ALIGNED(16, short, dqcoeff[400]);
FRAME_TYPE frame_type;
- MB_MODE_INFO mbmi;
-
int up_available;
int left_available;
{
int i;
- if (x->mbmi.mode != B_PRED && x->mbmi.mode != SPLITMV)
+ if (x->mode_info_context->mbmi.mode != B_PRED &&
+ x->mode_info_context->mbmi.mode != SPLITMV)
{
// do 2nd order transform on the dc block
{
int i;
- if (x->mbmi.ref_frame != INTRA_FRAME && x->mbmi.mode != SPLITMV)
+ if (x->mode_info_context->mbmi.ref_frame != INTRA_FRAME &&
+ x->mode_info_context->mbmi.mode != SPLITMV)
{
unsigned char *uptr, *vptr;
unsigned char *upred_ptr = &x->predictor[256];
}
}
-
+//encoder only
void vp8_build_inter_predictors_mby(MACROBLOCKD *x)
{
- if (x->mbmi.ref_frame != INTRA_FRAME && x->mbmi.mode != SPLITMV)
+
+ if (x->mode_info_context->mbmi.ref_frame != INTRA_FRAME &&
+ x->mode_info_context->mbmi.mode != SPLITMV)
{
unsigned char *ptr_base;
unsigned char *ptr;
unsigned char *pred_ptr = x->predictor;
- int mv_row = x->mbmi.mv.as_mv.row;
- int mv_col = x->mbmi.mv.as_mv.col;
+ int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
+ int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
int pre_stride = x->block[0].pre_stride;
ptr_base = x->pre.y_buffer;
{
int i;
- if (x->mbmi.partitioning < 3)
+ if (x->mode_info_context->mbmi.partitioning < 3)
{
for (i = 0; i < 4; i++)
{
void vp8_build_inter_predictors_mb(MACROBLOCKD *x)
{
- if (x->mbmi.ref_frame != INTRA_FRAME && x->mbmi.mode != SPLITMV)
+
+ if (x->mode_info_context->mbmi.ref_frame != INTRA_FRAME &&
+ x->mode_info_context->mbmi.mode != SPLITMV)
{
int offset;
unsigned char *ptr_base;
unsigned char *upred_ptr = &x->predictor[256];
unsigned char *vpred_ptr = &x->predictor[320];
- int mv_row = x->mbmi.mv.as_mv.row;
- int mv_col = x->mbmi.mv.as_mv.col;
+ int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
+ int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
int pre_stride = x->block[0].pre_stride;
ptr_base = x->pre.y_buffer;
{
int i;
- if (x->mbmi.partitioning < 3)
+ if (x->mode_info_context->mbmi.partitioning < 3)
{
for (i = 0; i < 4; i++)
{
{
int i, j;
- if (x->mbmi.mode == SPLITMV)
+ if (x->mode_info_context->mbmi.mode == SPLITMV)
{
for (i = 0; i < 2; i++)
{
}
else
{
- int mvrow = x->mbmi.mv.as_mv.row;
- int mvcol = x->mbmi.mv.as_mv.col;
+ int mvrow = x->mode_info_context->mbmi.mv.as_mv.row;
+ int mvcol = x->mode_info_context->mbmi.mv.as_mv.col;
if (mvrow < 0)
mvrow -= 1;
unsigned char *pred_ptr = x->predictor;
unsigned char *dst_ptr = x->dst.y_buffer;
- if (x->mbmi.mode != SPLITMV)
+ if (x->mode_info_context->mbmi.mode != SPLITMV)
{
int offset;
unsigned char *ptr_base;
unsigned char *udst_ptr = x->dst.u_buffer;
unsigned char *vdst_ptr = x->dst.v_buffer;
- int mv_row = x->mbmi.mv.as_mv.row;
- int mv_col = x->mbmi.mv.as_mv.col;
+ int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
+ int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
int pre_stride = x->dst.y_stride; //x->block[0].pre_stride;
ptr_base = x->pre.y_buffer;
//if sth is wrong, go back to what it is in build_inter_predictors_mb.
int i;
- if (x->mbmi.partitioning < 3)
+ if (x->mode_info_context->mbmi.partitioning < 3)
{
for (i = 0; i < 4; i++)
{
}
// for Y
- switch (x->mbmi.mode)
+ switch (x->mode_info_context->mbmi.mode)
{
case DC_PRED:
{
}
// for Y
- switch (x->mbmi.mode)
+ switch (x->mode_info_context->mbmi.mode)
{
case DC_PRED:
{
vleft_col[i] = x->dst.v_buffer [i* x->dst.uv_stride -1];
}
- switch (x->mbmi.uv_mode)
+ switch (x->mode_info_context->mbmi.uv_mode)
{
case DC_PRED:
{
vleft_col[i] = x->dst.v_buffer [i* x->dst.uv_stride -1];
}
- switch (x->mbmi.uv_mode)
+ switch (x->mode_info_context->mbmi.uv_mode)
{
case DC_PRED:
{
// to dst buffer, we can write the result directly to dst buffer. This eliminates unnecessary copy.
static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd)
{
- if (xd->frame_type == KEY_FRAME || xd->mbmi.ref_frame == INTRA_FRAME)
+ if (xd->frame_type == KEY_FRAME || xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
{
vp8_build_intra_predictors_mbuv_s(xd);
static void clamp_mvs(MACROBLOCKD *xd)
{
- if (xd->mbmi.mode == SPLITMV)
+ if (xd->mode_info_context->mbmi.mode == SPLITMV)
{
int i;
}
else
{
- clamp_mv_to_umv_border(&xd->mbmi.mv.as_mv, xd);
+ clamp_mv_to_umv_border(&xd->mode_info_context->mbmi.mv.as_mv, xd);
clamp_uvmv_to_umv_border(&xd->block[16].bmi.mv.as_mv, xd);
}
void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd)
{
int eobtotal = 0;
- MV orig_mvs[24];
- int i, do_clamp = xd->mbmi.need_to_clamp_mvs;
+ int i, do_clamp = xd->mode_info_context->mbmi.need_to_clamp_mvs;
- if (xd->mbmi.mb_skip_coeff)
+ if (xd->mode_info_context->mbmi.mb_skip_coeff)
{
vp8_reset_mb_tokens_context(xd);
}
/* Perform temporary clamping of the MV to be used for prediction */
if (do_clamp)
{
- if (xd->mbmi.mode == SPLITMV)
- for (i=0; i<24; i++)
- orig_mvs[i] = xd->block[i].bmi.mv.as_mv;
- else
- {
- orig_mvs[0] = xd->mbmi.mv.as_mv;
- orig_mvs[1] = xd->block[16].bmi.mv.as_mv;
- }
clamp_mvs(xd);
}
xd->mode_info_context->mbmi.dc_diff = 1;
- if (xd->mbmi.mode != B_PRED && xd->mbmi.mode != SPLITMV && eobtotal == 0)
+ if (xd->mode_info_context->mbmi.mode != B_PRED && xd->mode_info_context->mbmi.mode != SPLITMV && eobtotal == 0)
{
xd->mode_info_context->mbmi.dc_diff = 0;
skip_recon_mb(pbi, xd);
mb_init_dequantizer(pbi, xd);
// do prediction
- if (xd->frame_type == KEY_FRAME || xd->mbmi.ref_frame == INTRA_FRAME)
+ if (xd->frame_type == KEY_FRAME || xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
{
vp8_build_intra_predictors_mbuv(xd);
- if (xd->mbmi.mode != B_PRED)
+ if (xd->mode_info_context->mbmi.mode != B_PRED)
{
vp8_build_intra_predictors_mby_ptr(xd);
} else {
}
// dequantization and idct
- if (xd->mbmi.mode != B_PRED && xd->mbmi.mode != SPLITMV)
+ if (xd->mode_info_context->mbmi.mode != B_PRED && xd->mode_info_context->mbmi.mode != SPLITMV)
{
BLOCKD *b = &xd->block[24];
DEQUANT_INVOKE(&pbi->dequant, block)(b);
}
}
}
- else if ((xd->frame_type == KEY_FRAME || xd->mbmi.ref_frame == INTRA_FRAME) && xd->mbmi.mode == B_PRED)
+ else if ((xd->frame_type == KEY_FRAME || xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) && xd->mode_info_context->mbmi.mode == B_PRED)
{
for (i = 0; i < 16; i++)
{
for (mb_col = 0; mb_col < pc->mb_cols; mb_col++)
{
- // Take a copy of the mode and Mv information for this macroblock into the xd->mbmi
- // the partition_bmi array is unused in the decoder, so don't copy it.
- vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi,
- sizeof(MB_MODE_INFO) - sizeof(xd->mbmi.partition_bmi));
- if (xd->mbmi.mode == SPLITMV || xd->mbmi.mode == B_PRED)
+ if (xd->mode_info_context->mbmi.mode == SPLITMV || xd->mode_info_context->mbmi.mode == B_PRED)
{
for (i = 0; i < 16; i++)
{
xd->left_available = (mb_col != 0);
// Select the appropriate reference frame for this MB
- if (xd->mbmi.ref_frame == LAST_FRAME)
+ if (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)
ref_fb_idx = pc->lst_fb_idx;
- else if (xd->mbmi.ref_frame == GOLDEN_FRAME)
+ else if (xd->mode_info_context->mbmi.ref_frame == GOLDEN_FRAME)
ref_fb_idx = pc->gld_fb_idx;
else
ref_fb_idx = pc->alt_fb_idx;
xd->left_context = pc->left_context;
xd->mode_info_context = pc->mi;
xd->frame_type = pc->frame_type;
- xd->mbmi.mode = DC_PRED;
+ xd->mode_info_context->mbmi.mode = DC_PRED;
xd->mode_info_stride = pc->mode_info_stride;
}
*(l+1) = 0;
/* Clear entropy contexts for Y2 blocks */
- if (x->mbmi.mode != B_PRED && x->mbmi.mode != SPLITMV)
+ if (x->mode_info_context->mbmi.mode != B_PRED && x->mode_info_context->mbmi.mode != SPLITMV)
{
a = A[Y2CONTEXT];
l = L[Y2CONTEXT];
i = 0;
stop = 16;
- if (x->mbmi.mode != B_PRED && x->mbmi.mode != SPLITMV)
+ if (x->mode_info_context->mbmi.mode != B_PRED && x->mode_info_context->mbmi.mode != SPLITMV)
{
i = 24;
stop = 24;
mbd->mb_segement_abs_delta = xd->mb_segement_abs_delta;
vpx_memcpy(mbd->segment_feature_data, xd->segment_feature_data, sizeof(xd->segment_feature_data));
- mbd->mbmi.mode = DC_PRED;
- mbd->mbmi.uv_mode = DC_PRED;
-
mbd->current_bc = &pbi->bc2;
for (j = 0; j < 25; j++)
}
}
- // Take a copy of the mode and Mv information for this macroblock into the xd->mbmi
- // the partition_bmi array is unused in the decoder, so don't copy it.
- vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi,
- sizeof(MB_MODE_INFO) - sizeof(xd->mbmi.partition_bmi));
-
- if (xd->mbmi.mode == SPLITMV || xd->mbmi.mode == B_PRED)
+ if (xd->mode_info_context->mbmi.mode == SPLITMV || xd->mode_info_context->mbmi.mode == B_PRED)
{
for (i = 0; i < 16; i++)
{
xd->left_available = (mb_col != 0);
// Select the appropriate reference frame for this MB
- if (xd->mbmi.ref_frame == LAST_FRAME)
+ if (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)
ref_fb_idx = pc->lst_fb_idx;
- else if (xd->mbmi.ref_frame == GOLDEN_FRAME)
+ else if (xd->mode_info_context->mbmi.ref_frame == GOLDEN_FRAME)
ref_fb_idx = pc->gld_fb_idx;
else
ref_fb_idx = pc->alt_fb_idx;
}
- // Take a copy of the mode and Mv information for this macroblock into the xd->mbmi
- // the partition_bmi array is unused in the decoder, so don't copy it.
- vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi,
- sizeof(MB_MODE_INFO) - sizeof(xd->mbmi.partition_bmi));
-
- if (xd->mbmi.mode == SPLITMV || xd->mbmi.mode == B_PRED)
+ if (xd->mode_info_context->mbmi.mode == SPLITMV || xd->mode_info_context->mbmi.mode == B_PRED)
{
for (i = 0; i < 16; i++)
{
xd->left_available = (mb_col != 0);
// Select the appropriate reference frame for this MB
- if (xd->mbmi.ref_frame == LAST_FRAME)
+ if (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)
ref_fb_idx = pc->lst_fb_idx;
- else if (xd->mbmi.ref_frame == GOLDEN_FRAME)
+ else if (xd->mode_info_context->mbmi.ref_frame == GOLDEN_FRAME)
ref_fb_idx = pc->gld_fb_idx;
else
ref_fb_idx = pc->alt_fb_idx;
int i;
int QIndex;
MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO *mbmi = &xd->mbmi;
int zbin_extra;
// Select the baseline MB Q index.
{
// Abs Value
if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
- QIndex = xd->segment_feature_data[MB_LVL_ALT_Q][mbmi->segment_id];
+ QIndex = xd->segment_feature_data[MB_LVL_ALT_Q][xd->mode_info_context->mbmi.segment_id];
// Delta Value
else
{
- QIndex = cpi->common.base_qindex + xd->segment_feature_data[MB_LVL_ALT_Q][mbmi->segment_id];
+ QIndex = cpi->common.base_qindex + xd->segment_feature_data[MB_LVL_ALT_Q][xd->mode_info_context->mbmi.segment_id];
QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0; // Clamp to valid range
}
}
{
// Code to set segment id in xd->mbmi.segment_id for current MB (with range checking)
if (cpi->segmentation_map[seg_map_index+mb_col] <= 3)
- xd->mbmi.segment_id = cpi->segmentation_map[seg_map_index+mb_col];
+ xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[seg_map_index+mb_col];
else
- xd->mbmi.segment_id = 0;
+ xd->mode_info_context->mbmi.segment_id = 0;
vp8cx_mb_init_quantizer(cpi, x);
}
else
- xd->mbmi.segment_id = 0; // Set to Segment 0 by default
+ xd->mode_info_context->mbmi.segment_id = 0; // Set to Segment 0 by default
x->active_ptr = cpi->active_map + seg_map_index + mb_col;
#endif
// Count of last ref frame 0,0 useage
- if ((xd->mbmi.mode == ZEROMV) && (xd->mbmi.ref_frame == LAST_FRAME))
+ if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
cpi->inter_zz_count ++;
// Special case code for cyclic refresh
// during vp8cx_encode_inter_macroblock()) back into the global sgmentation map
if (cpi->cyclic_refresh_mode_enabled && xd->segmentation_enabled)
{
- cpi->segmentation_map[seg_map_index+mb_col] = xd->mbmi.segment_id;
+ cpi->segmentation_map[seg_map_index+mb_col] = xd->mode_info_context->mbmi.segment_id;
// If the block has been refreshed mark it as clean (the magnitude of the -ve influences how long it will be before we consider another refresh):
// Else if it was coded (last frame 0,0) and has not already been refreshed then mark it as a candidate for cleanup next time (marked 0)
// else mark it as dirty (1).
- if (xd->mbmi.segment_id)
+ if (xd->mode_info_context->mbmi.segment_id)
cpi->cyclic_refresh_map[seg_map_index+mb_col] = -1;
- else if ((xd->mbmi.mode == ZEROMV) && (xd->mbmi.ref_frame == LAST_FRAME))
+ else if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
{
if (cpi->cyclic_refresh_map[seg_map_index+mb_col] == 1)
cpi->cyclic_refresh_map[seg_map_index+mb_col] = 0;
x->gf_active_ptr++; // Increment pointer into gf useage flags structure for next mb
- // store macroblock mode info into context array
- vpx_memcpy(&xd->mode_info_context->mbmi, &xd->mbmi, sizeof(xd->mbmi));
-
for (i = 0; i < 16; i++)
vpx_memcpy(&xd->mode_info_context->bmi[i], &xd->block[i].bmi, sizeof(xd->block[i].bmi));
recon_uvoffset += 8;
// Keep track of segment useage
- segment_counts[xd->mbmi.segment_id] ++;
+ segment_counts[xd->mode_info_context->mbmi.segment_id] ++;
// skip to next mb
xd->mode_info_context++;
//x->rdmult = (int)(cpi->RDMULT * pow( (cpi->rate_correction_factor * 2.0), 0.75 ));
#endif
- xd->mbmi.mode = DC_PRED;
- xd->mbmi.uv_mode = DC_PRED;
+ xd->mode_info_context->mbmi.mode = DC_PRED;
+ xd->mode_info_context->mbmi.uv_mode = DC_PRED;
xd->left_context = cm->left_context;
static void sum_intra_stats(VP8_COMP *cpi, MACROBLOCK *x)
{
const MACROBLOCKD *xd = & x->e_mbd;
- const MB_PREDICTION_MODE m = xd->mbmi.mode;
- const MB_PREDICTION_MODE uvm = xd->mbmi.uv_mode;
+ const MB_PREDICTION_MODE m = xd->mode_info_context->mbmi.mode;
+ const MB_PREDICTION_MODE uvm = xd->mode_info_context->mbmi.uv_mode;
#ifdef MODE_STATS
const int is_key = cpi->common.frame_type == KEY_FRAME;
int rateuv_tokenonly = 0;
int i;
- x->e_mbd.mbmi.ref_frame = INTRA_FRAME;
+ x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
#if !(CONFIG_REALTIME_ONLY)
error_uv = vp8_rd_pick_intra_mbuv_mode(cpi, x, &rateuv, &rateuv_tokenonly, &distuv);
- x->e_mbd.mbmi.mb_skip_coeff = (cpi->common.mb_no_coeff_skip) ? 1 : 0;
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = (cpi->common.mb_no_coeff_skip) ? 1 : 0;
vp8_encode_intra16x16mbuv(IF_RTCD(&cpi->rtcd), x);
rate += rateuv;
if (Error4x4 < Error16x16)
{
rate += rate4x4;
- x->e_mbd.mbmi.mode = B_PRED;
+ x->e_mbd.mode_info_context->mbmi.mode = B_PRED;
// get back the intra block modes
for (i = 0; i < 16; i++)
for (mode = DC_PRED; mode <= TM_PRED; mode ++)
{
- x->e_mbd.mbmi.mode = mode;
+ x->e_mbd.mode_info_context->mbmi.mode = mode;
vp8_build_intra_predictors_mby_ptr(&x->e_mbd);
distortion2 = VARIANCE_INVOKE(&cpi->rtcd.variance, get16x16prederror)(x->src.y_buffer, x->src.y_stride, x->e_mbd.predictor, 16, 0x7fffffff);
rate2 = x->mbmode_cost[x->e_mbd.frame_type][mode];
else
Error4x4 = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2);
- x->e_mbd.mbmi.mb_skip_coeff = (cpi->common.mb_no_coeff_skip) ? 1 : 0;
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = (cpi->common.mb_no_coeff_skip) ? 1 : 0;
if (Error4x4 < Error16x16)
{
- x->e_mbd.mbmi.mode = B_PRED;
+ x->e_mbd.mode_info_context->mbmi.mode = B_PRED;
vp8_encode_intra4x4mby(IF_RTCD(&cpi->rtcd), x);
cpi->prediction_error += Error4x4;
}
else
{
- x->e_mbd.mbmi.mode = best_mode;
+ x->e_mbd.mode_info_context->mbmi.mode = best_mode;
vp8_encode_intra16x16mby(IF_RTCD(&cpi->rtcd), x);
cpi->prediction_error += Error16x16;
}
x->skip = 0;
if (xd->segmentation_enabled)
- x->encode_breakout = cpi->segment_encode_breakout[xd->mbmi.segment_id];
+ x->encode_breakout = cpi->segment_encode_breakout[xd->mode_info_context->mbmi.segment_id];
else
x->encode_breakout = cpi->oxcf.encode_breakout;
if (cpi->cyclic_refresh_mode_enabled)
{
// Clear segment_id back to 0 if not coded (last frame 0,0)
- if ((xd->mbmi.segment_id == 1) &&
- ((xd->mbmi.ref_frame != LAST_FRAME) || (xd->mbmi.mode != ZEROMV)))
+ if ((xd->mode_info_context->mbmi.segment_id == 1) &&
+ ((xd->mode_info_context->mbmi.ref_frame != LAST_FRAME) || (xd->mode_info_context->mbmi.mode != ZEROMV)))
{
- xd->mbmi.segment_id = 0;
+ xd->mode_info_context->mbmi.segment_id = 0;
}
}
// Experimental code. Special case for gf and arf zeromv modes. Increase zbin size to supress noise
if (cpi->zbin_mode_boost_enabled)
{
- if ((xd->mbmi.mode == ZEROMV) && (xd->mbmi.ref_frame != LAST_FRAME))
+ if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame != LAST_FRAME))
cpi->zbin_mode_boost = GF_ZEROMV_ZBIN_BOOST;
else
cpi->zbin_mode_boost = 0;
vp8cx_mb_init_quantizer(cpi, x);
}
- cpi->count_mb_ref_frame_usage[xd->mbmi.ref_frame] ++;
+ cpi->count_mb_ref_frame_usage[xd->mode_info_context->mbmi.ref_frame] ++;
- if (xd->mbmi.ref_frame == INTRA_FRAME)
+ if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
{
- x->e_mbd.mbmi.mb_skip_coeff = (cpi->common.mb_no_coeff_skip) ? 1 : 0;
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = (cpi->common.mb_no_coeff_skip) ? 1 : 0;
vp8_encode_intra16x16mbuv(IF_RTCD(&cpi->rtcd), x);
- if (xd->mbmi.mode == B_PRED)
+ if (xd->mode_info_context->mbmi.mode == B_PRED)
{
vp8_encode_intra4x4mby(IF_RTCD(&cpi->rtcd), x);
}
int ref_fb_idx;
vp8_find_near_mvs(xd, xd->mode_info_context,
- &nearest, &nearby, &best_ref_mv, mdcounts, xd->mbmi.ref_frame, cpi->common.ref_frame_sign_bias);
+ &nearest, &nearby, &best_ref_mv, mdcounts, xd->mode_info_context->mbmi.ref_frame, cpi->common.ref_frame_sign_bias);
vp8_build_uvmvs(xd, cpi->common.full_pixel);
- if (xd->mbmi.ref_frame == LAST_FRAME)
+ if (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)
ref_fb_idx = cpi->common.lst_fb_idx;
- else if (xd->mbmi.ref_frame == GOLDEN_FRAME)
+ else if (xd->mode_info_context->mbmi.ref_frame == GOLDEN_FRAME)
ref_fb_idx = cpi->common.gld_fb_idx;
else
ref_fb_idx = cpi->common.alt_fb_idx;
xd->pre.u_buffer = cpi->common.yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
xd->pre.v_buffer = cpi->common.yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
- if (xd->mbmi.mode == SPLITMV)
+ if (xd->mode_info_context->mbmi.mode == SPLITMV)
{
int i;
}
}
}
- else if (xd->mbmi.mode == NEWMV)
+ else if (xd->mode_info_context->mbmi.mode == NEWMV)
{
cpi->MVcount[0][mv_max+((xd->block[0].bmi.mv.as_mv.row - best_ref_mv.row) >> 1)]++;
cpi->MVcount[1][mv_max+((xd->block[0].bmi.mv.as_mv.col - best_ref_mv.col) >> 1)]++;
}
- if (!x->skip && !x->e_mbd.mbmi.force_no_skip)
+ if (!x->skip && !x->e_mbd.mode_info_context->mbmi.force_no_skip)
{
vp8_encode_inter16x16(IF_RTCD(&cpi->rtcd), x);
// Clear mb_skip_coeff if mb_no_coeff_skip is not set
if (!cpi->common.mb_no_coeff_skip)
- xd->mbmi.mb_skip_coeff = 0;
+ xd->mode_info_context->mbmi.mb_skip_coeff = 0;
}
else
{
if (cpi->common.mb_no_coeff_skip)
{
- if (xd->mbmi.mode != B_PRED && xd->mbmi.mode != SPLITMV)
- xd->mbmi.dc_diff = 0;
+ if (xd->mode_info_context->mbmi.mode != B_PRED && xd->mode_info_context->mbmi.mode != SPLITMV)
+ xd->mode_info_context->mbmi.dc_diff = 0;
else
- xd->mbmi.dc_diff = 1;
+ xd->mode_info_context->mbmi.dc_diff = 1;
- xd->mbmi.mb_skip_coeff = 1;
+ xd->mode_info_context->mbmi.mb_skip_coeff = 1;
cpi->skip_true_count ++;
vp8_fix_contexts(cpi, xd);
}
else
{
vp8_stuff_mb(cpi, xd, t);
- xd->mbmi.mb_skip_coeff = 0;
+ xd->mode_info_context->mbmi.mb_skip_coeff = 0;
cpi->skip_false_count ++;
}
}
x->quantize_b(be, b);
- x->e_mbd.mbmi.mb_skip_coeff &= (!b->eob);
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff &= (!b->eob);
vp8_inverse_transform_b(IF_RTCD(&rtcd->common->idct), b, 32);
x->quantize_b(be, b);
- x->e_mbd.mbmi.mb_skip_coeff &= (!b->eob);
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff &= (!b->eob);
IDCT_INVOKE(&rtcd->common->idct, idct16)(b->dqcoeff, b->diff, 32);
{
BLOCKD *d = &x->e_mbd.block[b];
- switch (x->e_mbd.mbmi.mode)
+ switch (x->e_mbd.mode_info_context->mbmi.mode)
{
case DC_PRED:
vp8_transform_intra_mby(x);
- x->e_mbd.mbmi.mb_skip_coeff = 1;
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = 1;
vp8_quantize_mby(x);
{
BLOCKD *d = &x->e_mbd.block[b];
- switch (x->e_mbd.mbmi.mode)
+ switch (x->e_mbd.mode_info_context->mbmi.mode)
{
case DC_PRED:
for (i = 16; i < 24; i += 2)
{
- x->vp8_short_fdct8x4(&x->block[i].src_diff[0],
+ x->vp8_short_fdct8x4(&x->block[i].src_diff[0],
&x->block[i].coeff[0], 16);
}
}
}
// build dc block from 16 y dc values
- if (x->e_mbd.mbmi.mode != SPLITMV)
+ if (x->e_mbd.mode_info_context->mbmi.mode != SPLITMV)
vp8_build_dcblock(x);
for (i = 16; i < 24; i += 2)
}
// do 2nd order transform on the dc block
- if (x->e_mbd.mbmi.mode != SPLITMV)
+ if (x->e_mbd.mode_info_context->mbmi.mode != SPLITMV)
x->short_walsh4x4(&x->block[24].src_diff[0],
&x->block[24].coeff[0], 8);
}
// build dc block from 16 y dc values
- if (x->e_mbd.mbmi.mode != SPLITMV)
+ if (x->e_mbd.mode_info_context->mbmi.mode != SPLITMV)
{
vp8_build_dcblock(x);
x->short_walsh4x4(&x->block[24].src_diff[0],
vp8_setup_temp_context(&t, x->e_mbd.above_context[Y1CONTEXT],
x->e_mbd.left_context[Y1CONTEXT], 4);
- has_2nd_order = (x->e_mbd.mbmi.mode != B_PRED
- && x->e_mbd.mbmi.mode != SPLITMV);
+ has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
+ && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
type = has_2nd_order ? 0 : 3;
for (b = 0; b < 16; b++)
{
int i;
- x->e_mbd.mbmi.mb_skip_coeff = 1;
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = 1;
- if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV)
+ if (x->e_mbd.mode_info_context->mbmi.mode != B_PRED && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV)
{
for (i = 0; i < 16; i++)
{
- x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
}
for (i = 16; i < 25; i++)
{
- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
}
}
else
{
for (i = 0; i < 24; i++)
{
- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
}
}
}
return;
vp8_setup_temp_context(&t, x->e_mbd.above_context[Y1CONTEXT],
x->e_mbd.left_context[Y1CONTEXT], 4);
- has_2nd_order = (x->e_mbd.mbmi.mode != B_PRED
- && x->e_mbd.mbmi.mode != SPLITMV);
+ has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
+ && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
type = has_2nd_order ? 0 : 3;
for (b = 0; b < 16; b++)
{
// Code to set segment id in xd->mbmi.segment_id for current MB (with range checking)
if (cpi->segmentation_map[seg_map_index+mb_col] <= 3)
- xd->mbmi.segment_id = cpi->segmentation_map[seg_map_index+mb_col];
+ xd->mode_info_context->mbmi.segment_id = cpi->segmentation_map[seg_map_index+mb_col];
else
- xd->mbmi.segment_id = 0;
+ xd->mode_info_context->mbmi.segment_id = 0;
vp8cx_mb_init_quantizer(cpi, x);
}
else
- xd->mbmi.segment_id = 0; // Set to Segment 0 by default
+ xd->mode_info_context->mbmi.segment_id = 0; // Set to Segment 0 by default
if (cm->frame_type == KEY_FRAME)
#endif
// Count of last ref frame 0,0 useage
- if ((xd->mbmi.mode == ZEROMV) && (xd->mbmi.ref_frame == LAST_FRAME))
+ if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
cpi->inter_zz_count ++;
}
x->gf_active_ptr++; // Increment pointer into gf useage flags structure for next mb
- // store macroblock mode info into context array
- vpx_memcpy(&xd->mode_info_context->mbmi, &xd->mbmi, sizeof(xd->mbmi));
-
for (i = 0; i < 16; i++)
vpx_memcpy(&xd->mode_info_context->bmi[i], &xd->block[i].bmi, sizeof(xd->block[i].bmi));
recon_uvoffset += 8;
// Keep track of segment useage
- segment_counts[xd->mbmi.segment_id] ++;
+ segment_counts[xd->mode_info_context->mbmi.segment_id] ++;
// skip to next mb
xd->mode_info_context++;
mb->rddiv = cpi->RDDIV;
mb->rdmult = cpi->RDMULT;
- mbd->mbmi.mode = DC_PRED;
- mbd->mbmi.uv_mode = DC_PRED;
-
mbd->left_context = cm->left_context;
mb->mvc = cm->fc.mvc;
if (use_dc_pred)
{
- x->e_mbd.mbmi.mode = DC_PRED;
- x->e_mbd.mbmi.uv_mode = DC_PRED;
- x->e_mbd.mbmi.ref_frame = INTRA_FRAME;
+ x->e_mbd.mode_info_context->mbmi.mode = DC_PRED;
+ x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
+ x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
vp8_encode_intra16x16mby(IF_RTCD(&cpi->rtcd), x);
}
xd->pre = *lst_yv12;
xd->dst = *new_yv12;
+ xd->mode_info_context = cm->mi;
+
vp8_build_block_offsets(x);
vp8_setup_block_dptrs(&x->e_mbd);
}
- mb->e_mbd.mbmi.uv_mode = best_mode;
+ mb->e_mbd.mode_info_context->mbmi.uv_mode = best_mode;
return best_error;
}
best_rd = INT_MAX;
- x->e_mbd.mbmi.ref_frame = INTRA_FRAME;
+ x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
// if we encode a new mv this is important
// find the best new motion vector
if (best_rd <= cpi->rd_threshes[mode_index])
continue;
- x->e_mbd.mbmi.ref_frame = vp8_ref_frame_order[mode_index];
+ x->e_mbd.mode_info_context->mbmi.ref_frame = vp8_ref_frame_order[mode_index];
- if (skip_mode[x->e_mbd.mbmi.ref_frame])
+ if (skip_mode[x->e_mbd.mode_info_context->mbmi.ref_frame])
continue;
// Check to see if the testing frequency for this mode is at its max
// Experimental debug code.
//all_rds[mode_index] = -1;
- x->e_mbd.mbmi.mode = this_mode;
- x->e_mbd.mbmi.uv_mode = DC_PRED;
+ x->e_mbd.mode_info_context->mbmi.mode = this_mode;
+ x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
// Work out the cost assosciated with selecting the reference frame
- frame_cost = ref_frame_cost[x->e_mbd.mbmi.ref_frame];
+ frame_cost = ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
rate2 += frame_cost;
// everything but intra
- if (x->e_mbd.mbmi.ref_frame)
+ if (x->e_mbd.mode_info_context->mbmi.ref_frame)
{
- x->e_mbd.pre.y_buffer = y_buffer[x->e_mbd.mbmi.ref_frame];
- x->e_mbd.pre.u_buffer = u_buffer[x->e_mbd.mbmi.ref_frame];
- x->e_mbd.pre.v_buffer = v_buffer[x->e_mbd.mbmi.ref_frame];
- mode_mv[NEARESTMV] = nearest_mv[x->e_mbd.mbmi.ref_frame];
- mode_mv[NEARMV] = near_mv[x->e_mbd.mbmi.ref_frame];
- best_ref_mv1 = best_ref_mv[x->e_mbd.mbmi.ref_frame];
- memcpy(mdcounts, MDCounts[x->e_mbd.mbmi.ref_frame], sizeof(mdcounts));
+ x->e_mbd.pre.y_buffer = y_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame];
+ x->e_mbd.pre.u_buffer = u_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame];
+ x->e_mbd.pre.v_buffer = v_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame];
+ mode_mv[NEARESTMV] = nearest_mv[x->e_mbd.mode_info_context->mbmi.ref_frame];
+ mode_mv[NEARMV] = near_mv[x->e_mbd.mode_info_context->mbmi.ref_frame];
+ best_ref_mv1 = best_ref_mv[x->e_mbd.mode_info_context->mbmi.ref_frame];
+ memcpy(mdcounts, MDCounts[x->e_mbd.mode_info_context->mbmi.ref_frame], sizeof(mdcounts));
}
//Only consider ZEROMV/ALTREF_FRAME for alt ref frame.
if (cpi->is_src_frame_alt_ref)
{
- if (this_mode != ZEROMV || x->e_mbd.mbmi.ref_frame != ALTREF_FRAME)
+ if (this_mode != ZEROMV || x->e_mbd.mode_info_context->mbmi.ref_frame != ALTREF_FRAME)
continue;
}
case TM_PRED:
vp8_build_intra_predictors_mby_ptr(&x->e_mbd);
distortion2 = VARIANCE_INVOKE(&cpi->rtcd.variance, get16x16prederror)(x->src.y_buffer, x->src.y_stride, x->e_mbd.predictor, 16, 0x7fffffff);
- rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mbmi.mode];
+ rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
this_rd = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, distortion2);
if (this_rd < best_intra_rd)
continue;
rate2 += vp8_cost_mv_ref(this_mode, mdcounts);
- x->e_mbd.mbmi.mode = this_mode;
- x->e_mbd.mbmi.mv.as_mv = mode_mv[this_mode];
+ x->e_mbd.mode_info_context->mbmi.mode = this_mode;
+ x->e_mbd.mode_info_context->mbmi.mv.as_mv = mode_mv[this_mode];
x->e_mbd.block[0].bmi.mode = this_mode;
- x->e_mbd.block[0].bmi.mv.as_int = x->e_mbd.mbmi.mv.as_int;
+ x->e_mbd.block[0].bmi.mv.as_int = x->e_mbd.mode_info_context->mbmi.mv.as_int;
distortion2 = get_inter_mbpred_error(x, cpi->fn_ptr.svf, cpi->fn_ptr.vf, (unsigned int *)(&sse));
*returnrate = rate2;
*returndistortion = distortion2;
best_rd = this_rd;
- vpx_memcpy(&best_mbmode, &x->e_mbd.mbmi, sizeof(MB_MODE_INFO));
+ vpx_memcpy(&best_mbmode, &x->e_mbd.mode_info_context->mbmi, sizeof(MB_MODE_INFO));
if (this_mode == B_PRED || this_mode == SPLITMV)
for (i = 0; i < 16; i++)
if (best_mbmode.mode <= B_PRED)
{
- x->e_mbd.mbmi.ref_frame = INTRA_FRAME;
+ x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
vp8_pick_intra_mbuv_mode(x);
- best_mbmode.uv_mode = x->e_mbd.mbmi.uv_mode;
+ best_mbmode.uv_mode = x->e_mbd.mode_info_context->mbmi.uv_mode;
}
best_mbmode.partitioning = 0;
best_mbmode.dc_diff = 0;
- vpx_memcpy(&x->e_mbd.mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
+ vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
for (i = 0; i < 16; i++)
{
vpx_memset(&x->e_mbd.block[i].bmi, 0, sizeof(B_MODE_INFO));
}
- x->e_mbd.mbmi.mv.as_int = 0;
+ x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
return best_rd;
}
// macroblock modes
- vpx_memcpy(&x->e_mbd.mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
+ vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
- if (x->e_mbd.mbmi.mode == B_PRED || x->e_mbd.mbmi.mode == SPLITMV)
+ if (x->e_mbd.mode_info_context->mbmi.mode == B_PRED || x->e_mbd.mode_info_context->mbmi.mode == SPLITMV)
for (i = 0; i < 16; i++)
{
vpx_memcpy(&x->e_mbd.block[i].bmi, &best_bmodes[i], sizeof(B_MODE_INFO));
}
else
{
- vp8_set_mbmode_and_mvs(x, x->e_mbd.mbmi.mode, &best_bmodes[0].mv.as_mv);
+ vp8_set_mbmode_and_mvs(x, x->e_mbd.mode_info_context->mbmi.mode, &best_bmodes[0].mv.as_mv);
}
- x->e_mbd.mbmi.mv.as_mv = x->e_mbd.block[15].bmi.mv.as_mv;
+ x->e_mbd.mode_info_context->mbmi.mv.as_mv = x->e_mbd.block[15].bmi.mv.as_mv;
return best_rd;
}
void vp8_quantize_mby(MACROBLOCK *x)
{
int i;
- int has_2nd_order = (x->e_mbd.mbmi.mode != B_PRED
- && x->e_mbd.mbmi.mode != SPLITMV);
+ int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
+ && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
for (i = 0; i < 16; i++)
{
x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
- x->e_mbd.mbmi.mb_skip_coeff &=
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff &=
(x->e_mbd.block[i].eob <= has_2nd_order);
}
if(has_2nd_order)
{
x->quantize_b(&x->block[24], &x->e_mbd.block[24]);
- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[24].eob);
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff &= (!x->e_mbd.block[24].eob);
}
}
void vp8_quantize_mb(MACROBLOCK *x)
{
int i;
- int has_2nd_order=(x->e_mbd.mbmi.mode != B_PRED
- && x->e_mbd.mbmi.mode != SPLITMV);
+ int has_2nd_order=(x->e_mbd.mode_info_context->mbmi.mode != B_PRED
+ && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
- x->e_mbd.mbmi.mb_skip_coeff = 1;
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = 1;
for (i = 0; i < 24+has_2nd_order; i++)
{
x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
- x->e_mbd.mbmi.mb_skip_coeff &=
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff &=
(x->e_mbd.block[i].eob <= (has_2nd_order && i<16));
}
}
for (i = 16; i < 24; i++)
{
x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
+ x->e_mbd.mode_info_context->mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
}
}
int i, j;
int berror;
- dc = !(mb->e_mbd.mbmi.mode == B_PRED || mb->e_mbd.mbmi.mode == SPLITMV);
+ dc = !(mb->e_mbd.mode_info_context->mbmi.mode == B_PRED || mb->e_mbd.mode_info_context->mbmi.mode == SPLITMV);
for (i = 0; i < 16; i++)
{
vp8_setup_temp_context(&t, x->above_context[Y1CONTEXT], x->left_context[Y1CONTEXT], 4);
vp8_setup_temp_context(&t2, x->above_context[Y2CONTEXT], x->left_context[Y2CONTEXT], 1);
- if (x->mbmi.mode == SPLITMV)
+ if (x->mode_info_context->mbmi.mode == SPLITMV)
type = 3;
for (b = 0; b < 16; b++)
cost += cost_coeffs(mb, x->block + b, type,
t.a + vp8_block2above[b], t.l + vp8_block2left[b]);
- if (x->mbmi.mode != SPLITMV)
+ if (x->mode_info_context->mbmi.mode != SPLITMV)
cost += cost_coeffs(mb, x->block + 24, 1,
t2.a + vp8_block2above[24], t2.l + vp8_block2left[24]);
int dummy;
rate = 0;
- x->e_mbd.mbmi.mode = mode;
+ x->e_mbd.mode_info_context->mbmi.mode = mode;
- rate += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mbmi.mode];
+ rate += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
vp8_encode_intra16x16mbyrd(IF_RTCD(&cpi->rtcd), x);
}
}
- x->e_mbd.mbmi.mode = mode_selected;
+ x->e_mbd.mode_info_context->mbmi.mode = mode_selected;
return best_rd;
}
int distortion;
int this_rd;
- x->e_mbd.mbmi.uv_mode = mode;
+ x->e_mbd.mode_info_context->mbmi.uv_mode = mode;
vp8_encode_intra16x16mbuvrd(IF_RTCD(&cpi->rtcd), x);
rate_to = rd_cost_mbuv(x);
- rate = rate_to + x->intra_uv_mode_cost[x->e_mbd.frame_type][x->e_mbd.mbmi.uv_mode];
+ rate = rate_to + x->intra_uv_mode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.uv_mode];
distortion = vp8_get_mbuvrecon_error(IF_RTCD(&cpi->rtcd.variance), x);
*rate = r;
*distortion = d;
- x->e_mbd.mbmi.uv_mode = mode_selected;
+ x->e_mbd.mode_info_context->mbmi.uv_mode = mode_selected;
return best_rd;
}
#endif
{
int i;
- x->e_mbd.mbmi.mode = mb;
- x->e_mbd.mbmi.mv.as_mv.row = mv->row;
- x->e_mbd.mbmi.mv.as_mv.col = mv->col;
+ x->e_mbd.mode_info_context->mbmi.mode = mb;
+ x->e_mbd.mode_info_context->mbmi.mv.as_mv.row = mv->row;
+ x->e_mbd.mode_info_context->mbmi.mv.as_mv.col = mv->col;
for (i = 0; i < 16; i++)
{
}
// 2nd order fdct
- if (x->mbmi.mode != SPLITMV)
+ if (x->mode_info_context->mbmi.mode != SPLITMV)
{
mb->short_walsh4x4(mb_y2->src_diff, mb_y2->coeff, 8);
}
}
// DC predication and Quantization of 2nd Order block
- if (x->mbmi.mode != SPLITMV)
+ if (x->mode_info_context->mbmi.mode != SPLITMV)
{
{
}
// Distortion
- if (x->mbmi.mode == SPLITMV)
+ if (x->mode_info_context->mbmi.mode == SPLITMV)
d = ENCODEMB_INVOKE(rtcd, mberr)(mb, 0) << 2;
else
{
// save partitions
labels = vp8_mbsplits[best_seg];
- x->e_mbd.mbmi.partitioning = best_seg;
- x->e_mbd.mbmi.partition_count = vp8_count_labels(labels);
+ x->e_mbd.mode_info_context->mbmi.partitioning = best_seg;
+ x->e_mbd.mode_info_context->mbmi.partition_count = vp8_count_labels(labels);
- for (i = 0; i < x->e_mbd.mbmi.partition_count; i++)
+ for (i = 0; i < x->e_mbd.mode_info_context->mbmi.partition_count; i++)
{
int j;
break;
}
- x->e_mbd.mbmi.partition_bmi[i].mode = x->e_mbd.block[j].bmi.mode;
- x->e_mbd.mbmi.partition_bmi[i].mv.as_mv = x->e_mbd.block[j].bmi.mv.as_mv;
+ x->e_mbd.mode_info_context->mbmi.partition_bmi[i].mode = x->e_mbd.block[j].bmi.mode;
+ x->e_mbd.mode_info_context->mbmi.partition_bmi[i].mv.as_mv = x->e_mbd.block[j].bmi.mv.as_mv;
}
return best_segment_rd;
vpx_memset(mode_mv, 0, sizeof(mode_mv));
- x->e_mbd.mbmi.ref_frame = INTRA_FRAME;
+ x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
vp8_rd_pick_intra_mbuv_mode(cpi, x, &uv_intra_rate, &uv_intra_rate_tokenonly, &uv_intra_distortion);
- uv_intra_mode = x->e_mbd.mbmi.uv_mode;
+ uv_intra_mode = x->e_mbd.mode_info_context->mbmi.uv_mode;
{
uvintra_eob = 0;
this_mode = vp8_mode_order[mode_index];
- x->e_mbd.mbmi.mode = this_mode;
- x->e_mbd.mbmi.uv_mode = DC_PRED;
- x->e_mbd.mbmi.ref_frame = vp8_ref_frame_order[mode_index];
+ x->e_mbd.mode_info_context->mbmi.mode = this_mode;
+ x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
+ x->e_mbd.mode_info_context->mbmi.ref_frame = vp8_ref_frame_order[mode_index];
//Only consider ZEROMV/ALTREF_FRAME for alt ref frame.
if (cpi->is_src_frame_alt_ref)
{
- if (this_mode != ZEROMV || x->e_mbd.mbmi.ref_frame != ALTREF_FRAME)
+ if (this_mode != ZEROMV || x->e_mbd.mode_info_context->mbmi.ref_frame != ALTREF_FRAME)
continue;
}
- if (x->e_mbd.mbmi.ref_frame == LAST_FRAME)
+ if (x->e_mbd.mode_info_context->mbmi.ref_frame == LAST_FRAME)
{
YV12_BUFFER_CONFIG *lst_yv12 = &cpi->common.yv12_fb[cpi->common.lst_fb_idx];
x->e_mbd.pre.u_buffer = lst_yv12->u_buffer + recon_uvoffset;
x->e_mbd.pre.v_buffer = lst_yv12->v_buffer + recon_uvoffset;
}
- else if (x->e_mbd.mbmi.ref_frame == GOLDEN_FRAME)
+ else if (x->e_mbd.mode_info_context->mbmi.ref_frame == GOLDEN_FRAME)
{
YV12_BUFFER_CONFIG *gld_yv12 = &cpi->common.yv12_fb[cpi->common.gld_fb_idx];
x->e_mbd.pre.u_buffer = gld_yv12->u_buffer + recon_uvoffset;
x->e_mbd.pre.v_buffer = gld_yv12->v_buffer + recon_uvoffset;
}
- else if (x->e_mbd.mbmi.ref_frame == ALTREF_FRAME)
+ else if (x->e_mbd.mode_info_context->mbmi.ref_frame == ALTREF_FRAME)
{
YV12_BUFFER_CONFIG *alt_yv12 = &cpi->common.yv12_fb[cpi->common.alt_fb_idx];
vp8_find_near_mvs(&x->e_mbd,
x->e_mbd.mode_info_context,
&mode_mv[NEARESTMV], &mode_mv[NEARMV], &best_ref_mv,
- mdcounts, x->e_mbd.mbmi.ref_frame, cpi->common.ref_frame_sign_bias);
+ mdcounts, x->e_mbd.mode_info_context->mbmi.ref_frame, cpi->common.ref_frame_sign_bias);
// Estimate the reference frame signaling cost and add it to the rolling cost variable.
- frame_cost = ref_frame_cost[x->e_mbd.mbmi.ref_frame];
+ frame_cost = ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
rate2 += frame_cost;
if (this_mode <= B_PRED)
int breakout_rd = best_rd - frame_cost_rd;
int tmp_rd;
- if (x->e_mbd.mbmi.ref_frame == LAST_FRAME)
+ if (x->e_mbd.mode_info_context->mbmi.ref_frame == LAST_FRAME)
tmp_rd = vp8_rd_pick_best_mbsegmentation(cpi, x, &best_ref_mv, breakout_rd, mdcounts, &rate, &rate_y, &distortion, cpi->compressor_speed, x->mvcost, cpi->rd_threshes[THR_NEWMV], cpi->common.full_pixel) ;
- else if (x->e_mbd.mbmi.ref_frame == GOLDEN_FRAME)
+ else if (x->e_mbd.mode_info_context->mbmi.ref_frame == GOLDEN_FRAME)
tmp_rd = vp8_rd_pick_best_mbsegmentation(cpi, x, &best_ref_mv, breakout_rd, mdcounts, &rate, &rate_y, &distortion, cpi->compressor_speed, x->mvcost, cpi->rd_threshes[THR_NEWG], cpi->common.full_pixel) ;
else
tmp_rd = vp8_rd_pick_best_mbsegmentation(cpi, x, &best_ref_mv, breakout_rd, mdcounts, &rate, &rate_y, &distortion, cpi->compressor_speed, x->mvcost, cpi->rd_threshes[THR_NEWA], cpi->common.full_pixel) ;
if (0)//x->e_mbd.mbmi.partition_count == 4)
{
- if (x->e_mbd.mbmi.partition_bmi[0].mv.as_int == x->e_mbd.mbmi.partition_bmi[1].mv.as_int
- && x->e_mbd.mbmi.partition_bmi[2].mv.as_int == x->e_mbd.mbmi.partition_bmi[3].mv.as_int)
+ if (x->e_mbd.mode_info_context->mbmi.partition_bmi[0].mv.as_int == x->e_mbd.mode_info_context->mbmi.partition_bmi[1].mv.as_int
+ && x->e_mbd.mode_info_context->mbmi.partition_bmi[2].mv.as_int == x->e_mbd.mode_info_context->mbmi.partition_bmi[3].mv.as_int)
{
const int *labels = vp8_mbsplits[2];
- x->e_mbd.mbmi.partitioning = 0;
+ x->e_mbd.mode_info_context->mbmi.partitioning = 0;
rate -= vp8_cost_token(vp8_mbsplit_tree, vp8_mbsplit_probs, vp8_mbsplit_encodings + 2);
rate += vp8_cost_token(vp8_mbsplit_tree, vp8_mbsplit_probs, vp8_mbsplit_encodings);
//rate -= x->inter_bmode_costs[ x->e_mbd.mbmi.partition_bmi[1]];
//rate -= x->inter_bmode_costs[ x->e_mbd.mbmi.partition_bmi[3]];
- x->e_mbd.mbmi.partition_bmi[1] = x->e_mbd.mbmi.partition_bmi[2];
+ x->e_mbd.mode_info_context->mbmi.partition_bmi[1] = x->e_mbd.mode_info_context->mbmi.partition_bmi[2];
}
}
case V_PRED:
case H_PRED:
case TM_PRED:
- x->e_mbd.mbmi.ref_frame = INTRA_FRAME;
+ x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
vp8_build_intra_predictors_mby_ptr(&x->e_mbd);
{
macro_block_yrd(x, &rate, &distortion, IF_RTCD(&cpi->rtcd.encodemb)) ;
rate2 += rate;
rate_y = rate;
distortion2 += distortion;
- rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mbmi.mode];
+ rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
rate2 += uv_intra_rate;
rate_uv = uv_intra_rate_tokenonly;
distortion2 += uv_intra_distortion;
//all_rates[mode_index] = rate2;
//all_dist[mode_index] = distortion2;
- if ((x->e_mbd.mbmi.ref_frame == INTRA_FRAME) && (this_rd < *returnintra))
+ if ((x->e_mbd.mode_info_context->mbmi.ref_frame == INTRA_FRAME) && (this_rd < *returnintra))
{
*returnintra = this_rd ;
}
{
// Note index of best mode so far
best_mode_index = mode_index;
- x->e_mbd.mbmi.force_no_skip = force_no_skip;
+ x->e_mbd.mode_info_context->mbmi.force_no_skip = force_no_skip;
if (this_mode <= B_PRED)
{
- x->e_mbd.mbmi.uv_mode = uv_intra_mode;
+ x->e_mbd.mode_info_context->mbmi.uv_mode = uv_intra_mode;
}
*returnrate = rate2;
*returndistortion = distortion2;
best_rd = this_rd;
- vpx_memcpy(&best_mbmode, &x->e_mbd.mbmi, sizeof(MB_MODE_INFO));
+ vpx_memcpy(&best_mbmode, &x->e_mbd.mode_info_context->mbmi, sizeof(MB_MODE_INFO));
for (i = 0; i < 16; i++)
{
best_mbmode.partitioning = 0;
best_mbmode.dc_diff = 0;
- vpx_memcpy(&x->e_mbd.mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
+ vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
for (i = 0; i < 16; i++)
{
vpx_memset(&x->e_mbd.block[i].bmi, 0, sizeof(B_MODE_INFO));
}
- x->e_mbd.mbmi.mv.as_int = 0;
+ x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
return best_rd;
}
// macroblock modes
- vpx_memcpy(&x->e_mbd.mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
+ vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
for (i = 0; i < 16; i++)
{
vpx_memcpy(&x->e_mbd.block[i].bmi, &best_bmodes[i], sizeof(B_MODE_INFO));
}
- x->e_mbd.mbmi.mv.as_mv = x->e_mbd.block[15].bmi.mv.as_mv;
+ x->e_mbd.mode_info_context->mbmi.mv.as_mv = x->e_mbd.block[15].bmi.mv.as_mv;
return best_rd;
}
TOKENEXTRA *start = *t;
TOKENEXTRA *tp = *t;
- x->mbmi.dc_diff = 1;
+ x->mode_info_context->mbmi.dc_diff = 1;
#if 0
#if 1
- if (x->mbmi.mb_skip_coeff)
+ if (x->mode_info_context->mbmi.mb_skip_coeff)
{
cpi->skip_true_count++;
vp8_fix_contexts(cpi, x);
}
- if (x->mbmi.mode != B_PRED && x->mbmi.mode != SPLITMV)
- x->mbmi.dc_diff = 0;
+ if (x->mode_info_context->mbmi.mode != B_PRED && x->mode_info_context->mbmi.mode != SPLITMV)
+ x->mode_info_context->mbmi.dc_diff = 0;
else
- x->mbmi.dc_diff = 1;
+ x->mode_info_context->mbmi.dc_diff = 1;
return;
vpx_memcpy(cpi->coef_counts_backup, cpi->coef_counts, sizeof(cpi->coef_counts));
#endif
- if (x->mbmi.mode == B_PRED || x->mbmi.mode == SPLITMV)
+ if (x->mode_info_context->mbmi.mode == B_PRED || x->mode_info_context->mbmi.mode == SPLITMV)
{
plane_type = 3;
}
plane_type = 0;
- if (x->mbmi.mode != B_PRED && x->mbmi.mode != SPLITMV)
- x->mbmi.dc_diff = 0;
+ if (x->mode_info_context->mbmi.mode != B_PRED && x->mode_info_context->mbmi.mode != SPLITMV)
+ x->mode_info_context->mbmi.dc_diff = 0;
else
- x->mbmi.dc_diff = 1;
+ x->mode_info_context->mbmi.dc_diff = 1;
for (b = 0; b < 16; b++)
x->above_context[UCONTEXT][1] = 0;
x->above_context[VCONTEXT][1] = 0;
- if (x->mbmi.mode != B_PRED && x->mbmi.mode != SPLITMV)
+ if (x->mode_info_context->mbmi.mode != B_PRED && x->mode_info_context->mbmi.mode != SPLITMV)
{
x->left_context[Y2CONTEXT][0] = 0;
x->above_context[Y2CONTEXT][0] = 0;