Merge changes I6226456d,I97925178,I766c4b74

* changes:
  Use a separate MODE_INFO stream for each tile column
  Get rid of "this_mi", use "mi_8x8[0]" everywhere instead
  Make the static_segmentation feature work again
This commit is contained in:
Guillaume Martres 2013-10-16 17:05:39 -07:00 committed by Gerrit Code Review
commit 7fd2561d64
20 changed files with 155 additions and 150 deletions

View File

@ -196,11 +196,8 @@ typedef struct macroblockd {
struct scale_factors scale_factor[2];
MODE_INFO *last_mi;
MODE_INFO *this_mi;
int mode_info_stride;
MODE_INFO *mic_stream_ptr;
// A NULL indicates that the 8x8 is not part of the image
MODE_INFO **mi_8x8;
MODE_INFO **prev_mi_8x8;
@ -311,7 +308,7 @@ extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT];
static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
const MACROBLOCKD *xd, int ib) {
const MODE_INFO *const mi = xd->this_mi;
const MODE_INFO *const mi = xd->mi_8x8[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
if (plane_type != PLANE_TYPE_Y_WITH_DC ||
@ -326,13 +323,13 @@ static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
return plane_type == PLANE_TYPE_Y_WITH_DC ?
mode2txfm_map[xd->this_mi->mbmi.mode] : DCT_DCT;
mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] : DCT_DCT;
}
static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
return plane_type == PLANE_TYPE_Y_WITH_DC ?
mode2txfm_map[xd->this_mi->mbmi.mode] : DCT_DCT;
mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] : DCT_DCT;
}
static void setup_block_dptrs(MACROBLOCKD *xd, int ss_x, int ss_y) {
@ -381,7 +378,7 @@ static INLINE void foreach_transformed_block_in_plane(
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
foreach_transformed_block_visitor visit, void *arg) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const MB_MODE_INFO* mbmi = &xd->this_mi->mbmi;
const MB_MODE_INFO* mbmi = &xd->mi_8x8[0]->mbmi;
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way.

View File

@ -43,7 +43,7 @@ void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col) {
int_mv dst_list[MAX_MV_REF_CANDIDATES];
int_mv mv_list[MAX_MV_REF_CANDIDATES];
MODE_INFO *const mi = xd->this_mi;
MODE_INFO *const mi = xd->mi_8x8[0];
assert(ref_idx == 0 || ref_idx == 1);
assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier

View File

@ -389,7 +389,7 @@ unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd) {
}
void vp9_set_pred_flag_seg_id(MACROBLOCKD *xd, uint8_t pred_flag) {
xd->this_mi->mbmi.seg_id_predicted = pred_flag;
xd->mi_8x8[0]->mbmi.seg_id_predicted = pred_flag;
}
int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids,

View File

@ -49,7 +49,7 @@ static INLINE vp9_prob vp9_get_pred_prob_mbskip(const VP9_COMMON *cm,
}
static INLINE unsigned char vp9_get_pred_flag_mbskip(const MACROBLOCKD *xd) {
return xd->this_mi->mbmi.skip_coeff;
return xd->mi_8x8[0]->mbmi.skip_coeff;
}
unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd);

View File

@ -23,8 +23,8 @@
void vp9_setup_interp_filters(MACROBLOCKD *xd,
INTERPOLATIONFILTERTYPE mcomp_filter_type,
VP9_COMMON *cm) {
if (xd->mi_8x8 && xd->this_mi) {
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
if (xd->mi_8x8 && xd->mi_8x8[0]) {
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
set_scale_factors(xd, mbmi->ref_frame[0] - LAST_FRAME,
mbmi->ref_frame[1] - LAST_FRAME,
@ -120,7 +120,7 @@ static void build_inter_predictors(int plane, int block, BLOCK_SIZE bsize,
const int bh = plane_block_height(bsize, pd);
const int x = 4 * (block & ((1 << bwl) - 1));
const int y = 4 * (block >> bwl);
const MODE_INFO *mi = xd->this_mi;
const MODE_INFO *mi = xd->mi_8x8[0];
const int is_compound = has_second_ref(&mi->mbmi);
int ref;
@ -177,7 +177,7 @@ static INLINE void foreach_predicted_block_in_plane(
const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
const int bhl = b_height_log2(bsize) - xd->plane[plane].subsampling_y;
if (xd->this_mi->mbmi.sb_type < BLOCK_8X8) {
if (xd->mi_8x8[0]->mbmi.sb_type < BLOCK_8X8) {
int i = 0, x, y;
assert(bsize == BLOCK_8X8);
for (y = 0; y < 1 << bhl; ++y)

View File

@ -111,7 +111,7 @@ static int read_intra_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
vp9_reader *r) {
MACROBLOCKD *const xd = &pbi->mb;
struct segmentation *const seg = &pbi->common.seg;
const BLOCK_SIZE bsize = xd->this_mi->mbmi.sb_type;
const BLOCK_SIZE bsize = xd->mi_8x8[0]->mbmi.sb_type;
int segment_id;
if (!seg->enabled)
@ -130,7 +130,7 @@ static int read_inter_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
struct segmentation *const seg = &cm->seg;
const BLOCK_SIZE bsize = xd->this_mi->mbmi.sb_type;
const BLOCK_SIZE bsize = xd->mi_8x8[0]->mbmi.sb_type;
int pred_segment_id, segment_id;
if (!seg->enabled)
@ -661,7 +661,7 @@ void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) {
void vp9_read_mode_info(VP9D_COMP* pbi, int mi_row, int mi_col, vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
MODE_INFO *mi = xd->this_mi;
MODE_INFO *mi = xd->mi_8x8[0];
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
const int bw = 1 << mi_width_log2(bsize);
const int bh = 1 << mi_height_log2(bsize);

View File

@ -134,7 +134,7 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg) {
MACROBLOCKD* const xd = arg;
struct macroblockd_plane *const pd = &xd->plane[plane];
MODE_INFO *const mi = xd->this_mi;
MODE_INFO *const mi = xd->mi_8x8[0];
const int raster_block = txfrm_block_to_raster_block(plane_bsize, tx_size,
block);
uint8_t* const dst = raster_block_offset_uint8(plane_bsize, raster_block,
@ -158,7 +158,7 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
static int decode_tokens(VP9D_COMP *pbi, BLOCK_SIZE bsize, vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
if (mbmi->skip_coeff) {
reset_skip_context(xd, bsize);
@ -174,6 +174,7 @@ static int decode_tokens(VP9D_COMP *pbi, BLOCK_SIZE bsize, vp9_reader *r) {
}
static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE bsize,
int tile_col,
int mi_row, int mi_col) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
@ -187,10 +188,9 @@ static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE bsize,
xd->prev_mi_8x8 = cm->prev_mi_grid_visible + offset;
// we are using the mode info context stream here
xd->this_mi =
xd->mi_8x8[0] = xd->mic_stream_ptr;
xd->this_mi->mbmi.sb_type = bsize;
xd->mic_stream_ptr++;
xd->mi_8x8[0] = pbi->mi_streams[tile_col];
xd->mi_8x8[0]->mbmi.sb_type = bsize;
pbi->mi_streams[tile_col]++;
// Special case: if prev_mi is NULL, the previous mode info context
// cannot be used.
@ -209,7 +209,7 @@ static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE bsize,
static void set_ref(VP9D_COMP *pbi, int i, int mi_row, int mi_col) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
const int ref = mbmi->ref_frame[i] - LAST_FRAME;
const YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->active_ref_idx[ref]];
const struct scale_factors *sf = &cm->active_ref_scale[ref];
@ -222,7 +222,8 @@ static void set_ref(VP9D_COMP *pbi, int i, int mi_row, int mi_col) {
xd->corrupted |= cfg->corrupted;
}
static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
static void decode_modes_b(VP9D_COMP *pbi, int tile_col,
int mi_row, int mi_col,
vp9_reader *r, BLOCK_SIZE bsize) {
MACROBLOCKD *const xd = &pbi->mb;
const int less8x8 = bsize < BLOCK_8X8;
@ -233,14 +234,14 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
if (xd->ab_index > 0)
return;
set_offsets(pbi, bsize, mi_row, mi_col);
set_offsets(pbi, bsize, tile_col, mi_row, mi_col);
vp9_read_mode_info(pbi, mi_row, mi_col, r);
if (less8x8)
bsize = BLOCK_8X8;
// Has to be called after set_offsets
mbmi = &xd->this_mi->mbmi;
mbmi = &xd->mi_8x8[0]->mbmi;
eobtotal = decode_tokens(pbi, bsize, r);
if (!is_inter_block(mbmi)) {
@ -270,7 +271,8 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
xd->corrupted |= vp9_reader_has_error(r);
}
static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
static void decode_modes_sb(VP9D_COMP *pbi, int tile_col,
int mi_row, int mi_col,
vp9_reader* r, BLOCK_SIZE bsize) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
@ -308,26 +310,27 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
switch (partition) {
case PARTITION_NONE:
decode_modes_b(pbi, mi_row, mi_col, r, subsize);
decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize);
break;
case PARTITION_HORZ:
decode_modes_b(pbi, mi_row, mi_col, r, subsize);
decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize);
*get_sb_index(xd, subsize) = 1;
if (mi_row + hbs < cm->mi_rows)
decode_modes_b(pbi, mi_row + hbs, mi_col, r, subsize);
decode_modes_b(pbi, tile_col, mi_row + hbs, mi_col, r, subsize);
break;
case PARTITION_VERT:
decode_modes_b(pbi, mi_row, mi_col, r, subsize);
decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize);
*get_sb_index(xd, subsize) = 1;
if (mi_col + hbs < cm->mi_cols)
decode_modes_b(pbi, mi_row, mi_col + hbs, r, subsize);
decode_modes_b(pbi, tile_col, mi_row, mi_col + hbs, r, subsize);
break;
case PARTITION_SPLIT: {
int n;
for (n = 0; n < 4; n++) {
const int j = n >> 1, i = n & 1;
*get_sb_index(xd, subsize) = n;
decode_modes_sb(pbi, mi_row + j * hbs, mi_col + i * hbs, r, subsize);
decode_modes_sb(pbi, tile_col, mi_row + j * hbs, mi_col + i * hbs,
r, subsize);
}
} break;
default:
@ -583,7 +586,7 @@ static void setup_frame_size_with_refs(VP9D_COMP *pbi,
setup_display_size(cm, rb);
}
static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
static void decode_tile(VP9D_COMP *pbi, vp9_reader *r, int tile_col) {
const int num_threads = pbi->oxcf.max_threads;
VP9_COMMON *const cm = &pbi->common;
int mi_row, mi_col;
@ -608,7 +611,7 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
vp9_zero(cm->left_seg_context);
for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end;
mi_col += MI_BLOCK_SIZE)
decode_modes_sb(pbi, mi_row, mi_col, r, BLOCK_64X64);
decode_modes_sb(pbi, tile_col, mi_row, mi_col, r, BLOCK_64X64);
if (pbi->do_loopfilter_inline) {
// delay the loopfilter by 1 macroblock row.
@ -710,7 +713,7 @@ static const uint8_t *decode_tiles(VP9D_COMP *pbi, const uint8_t *data) {
setup_token_decoder(pbi, data_ptr2[tile_row][tile_col],
data_end - data_ptr2[tile_row][tile_col],
&residual_bc);
decode_tile(pbi, &residual_bc);
decode_tile(pbi, &residual_bc, tile_col);
if (tile_row == tile_rows - 1 && tile_col == tile_cols - 1)
bc_bak = residual_bc;
}
@ -739,7 +742,7 @@ static const uint8_t *decode_tiles(VP9D_COMP *pbi, const uint8_t *data) {
}
setup_token_decoder(pbi, data, size, &residual_bc);
decode_tile(pbi, &residual_bc);
decode_tile(pbi, &residual_bc, tile_col);
data += size;
}
}
@ -955,6 +958,8 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
const size_t first_partition_size = read_uncompressed_header(pbi, &rb);
const int keyframe = cm->frame_type == KEY_FRAME;
YV12_BUFFER_CONFIG *new_fb = &cm->yv12_fb[cm->new_fb_idx];
const int tile_cols = 1 << cm->log2_tile_cols;
int tile_col;
if (!first_partition_size) {
if (!keyframe) {
@ -983,9 +988,17 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
setup_plane_dequants(cm, &pbi->mb, cm->base_qindex);
xd->mi_8x8 = cm->mi_grid_visible;
xd->mic_stream_ptr = cm->mi;
xd->mode_info_stride = cm->mode_info_stride;
CHECK_MEM_ERROR(cm, pbi->mi_streams,
vpx_realloc(pbi->mi_streams, tile_cols *
sizeof(*pbi->mi_streams)));
for (tile_col = 0; tile_col < tile_cols; ++tile_col) {
vp9_get_tile_col_offsets(cm, tile_col);
pbi->mi_streams[tile_col] =
&cm->mi[cm->mi_rows * cm->cur_tile_mi_col_start];
}
cm->fc = cm->frame_contexts[cm->frame_context_idx];
vp9_zero(cm->counts);

View File

@ -91,7 +91,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
TX_SIZE tx_size, const int16_t *dq, int pt) {
const FRAME_CONTEXT *const fc = &cm->fc;
FRAME_COUNTS *const counts = &cm->counts;
const int ref = is_inter_block(&xd->this_mi->mbmi);
const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi);
int band, c = 0;
const vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size][type][ref];
@ -218,7 +218,7 @@ static void decode_block(int plane, int block, BLOCK_SIZE plane_bsize,
MACROBLOCKD *xd = &arg->pbi->mb;
struct segmentation *seg = &arg->pbi->common.seg;
struct macroblockd_plane* pd = &xd->plane[plane];
const int segment_id = xd->this_mi->mbmi.segment_id;
const int segment_id = xd->mi_8x8[0]->mbmi.segment_id;
const int seg_eob = get_tx_eob(seg, segment_id, tx_size);
int aoff, loff, eob, pt;

View File

@ -163,6 +163,7 @@ void vp9_remove_decompressor(VP9D_PTR ptr) {
vp9_remove_common(&pbi->common);
vp9_worker_end(&pbi->lf_worker);
vpx_free(pbi->lf_worker.data1);
vpx_free(pbi->mi_streams);
vpx_free(pbi);
}
@ -396,7 +397,6 @@ int vp9_receive_compressed_data(VP9D_PTR ptr,
pbi->mb.mi_8x8 = cm->mi_grid_visible;
pbi->mb.mi_8x8[0] = cm->mi;
pbi->mb.this_mi = cm->mi;
cm->current_video_frame++;
}

View File

@ -39,6 +39,10 @@ typedef struct VP9Decompressor {
int do_loopfilter_inline; // apply loopfilter to available rows immediately
VP9Worker lf_worker;
/* Each tile column has its own MODE_INFO stream. This array indexes them by
tile column index. */
MODE_INFO **mi_streams;
} VP9D_COMP;
#endif // VP9_DECODER_VP9_ONYXD_INT_H_

View File

@ -353,7 +353,7 @@ static void encode_ref_frame(VP9_COMP *cpi, vp9_writer *bc) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mi = &xd->this_mi->mbmi;
MB_MODE_INFO *mi = &xd->mi_8x8[0]->mbmi;
const int segment_id = mi->segment_id;
int seg_ref_active = vp9_segfeature_active(&cm->seg, segment_id,
SEG_LVL_REF_FRAME);
@ -574,7 +574,6 @@ static void write_modes_b(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc,
if (xd->ab_index > 0)
return;
xd->this_mi = mi_8x8[0];
xd->mi_8x8 = mi_8x8;
set_mi_row_col(&cpi->common, xd,

View File

@ -352,8 +352,8 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *mi = &ctx->mic;
MB_MODE_INFO * const mbmi = &xd->this_mi->mbmi;
MODE_INFO *mi_addr = xd->this_mi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
MODE_INFO *mi_addr = xd->mi_8x8[0];
int mb_mode_index = ctx->best_mode_index;
const int mis = cm->mode_info_stride;
@ -497,9 +497,9 @@ static void set_offsets(VP9_COMP *cpi, int mi_row, int mi_col,
// cannot be used.
xd->last_mi = cm->prev_mi ? xd->prev_mi_8x8[0] : NULL;
xd->this_mi = xd->mi_8x8[0] = cm->mi + idx_str;
xd->mi_8x8[0] = cm->mi + idx_str;
mbmi = &xd->this_mi->mbmi;
mbmi = &xd->mi_8x8[0]->mbmi;
// Set up destination pointers
setup_dst_planes(xd, &cm->yv12_fb[dst_fb_idx], mi_row, mi_col);
@ -579,10 +579,10 @@ static void pick_sb_modes(VP9_COMP *cpi, int mi_row, int mi_col,
}
set_offsets(cpi, mi_row, mi_col, bsize);
xd->this_mi->mbmi.sb_type = bsize;
xd->mi_8x8[0]->mbmi.sb_type = bsize;
// Set to zero to make sure we do not use the previous encoded frame stats
xd->this_mi->mbmi.skip_coeff = 0;
xd->mi_8x8[0]->mbmi.skip_coeff = 0;
x->source_variance = get_sby_perpixel_variance(cpi, x, bsize);
@ -594,7 +594,7 @@ static void pick_sb_modes(VP9_COMP *cpi, int mi_row, int mi_col,
energy = vp9_block_energy(cpi, x, bsize);
}
xd->this_mi->mbmi.segment_id = vp9_vaq_segment_id(energy);
xd->mi_8x8[0]->mbmi.segment_id = vp9_vaq_segment_id(energy);
rdmult_ratio = vp9_vaq_rdmult_ratio(energy);
vp9_mb_init_quantizer(cpi, x);
}
@ -627,7 +627,7 @@ static void update_stats(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *mi = xd->this_mi;
MODE_INFO *mi = xd->mi_8x8[0];
MB_MODE_INFO *const mbmi = &mi->mbmi;
if (!frame_is_intra_only(cm)) {
@ -1866,8 +1866,8 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) {
setup_block_dptrs(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
xd->this_mi->mbmi.mode = DC_PRED;
xd->this_mi->mbmi.uv_mode = DC_PRED;
xd->mi_8x8[0]->mbmi.mode = DC_PRED;
xd->mi_8x8[0]->mbmi.uv_mode = DC_PRED;
vp9_zero(cpi->y_mode_count);
vp9_zero(cpi->y_uv_mode_count);
@ -1941,8 +1941,7 @@ static void encode_frame_internal(VP9_COMP *cpi) {
xd->mi_8x8 = cm->mi_grid_visible;
// required for vp9_frame_init_quantizer
xd->this_mi = xd->mi_8x8[0] = cm->mi;
xd->mic_stream_ptr = cm->mi;
xd->mi_8x8[0] = cm->mi;
xd->last_mi = cm->prev_mi;

View File

@ -117,7 +117,7 @@ static void optimize_b(MACROBLOCK *mb,
TX_SIZE tx_size) {
MACROBLOCKD *const xd = &mb->e_mbd;
struct macroblockd_plane *pd = &xd->plane[plane];
const int ref = is_inter_block(&xd->this_mi->mbmi);
const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi);
vp9_token_state tokens[1025][2];
unsigned best_index[1025][2];
const int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[plane].coeff, block);
@ -331,7 +331,7 @@ static void optimize_init_b(int plane, BLOCK_SIZE bsize,
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];
const MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
const MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi) : mbmi->tx_size;
vp9_get_entropy_contexts(tx_size, args->ctx->ta[plane], args->ctx->tl[plane],
@ -494,7 +494,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->this_mi->mbmi;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
@ -596,7 +596,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
scan = get_scan_4x4(tx_type);
iscan = get_iscan_4x4(tx_type);
if (mbmi->sb_type < BLOCK_8X8 && plane == 0)
mode = xd->this_mi->bmi[block].as_mode;
mode = xd->mi_8x8[0]->bmi[block].as_mode;
else
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;

View File

@ -358,7 +358,7 @@ static void zz_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
// Set up pointers for this macro block recon buffer
xd->plane[0].pre[0].buf = recon_buffer->y_buffer + recon_yoffset;
switch (xd->this_mi->mbmi.sb_type) {
switch (xd->mi_8x8[0]->mbmi.sb_type) {
case BLOCK_8X8:
vp9_mse8x8(x->plane[0].src.buf, x->plane[0].src.stride,
xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride,
@ -397,7 +397,7 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param;
int n;
vp9_variance_fn_ptr_t v_fn_ptr =
cpi->fn_ptr[xd->this_mi->mbmi.sb_type];
cpi->fn_ptr[xd->mi_8x8[0]->mbmi.sb_type];
int new_mv_mode_penalty = 256;
int sr = 0;
@ -414,7 +414,7 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
further_steps -= sr;
// override the default variance function to use MSE
switch (xd->this_mi->mbmi.sb_type) {
switch (xd->mi_8x8[0]->mbmi.sb_type) {
case BLOCK_8X8:
v_fn_ptr.vf = vp9_mse8x8;
break;
@ -518,9 +518,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
xd->mi_8x8 = cm->mi_grid_visible;
// required for vp9_frame_init_quantizer
xd->this_mi =
xd->mi_8x8[0] = cm->mi;
xd->mic_stream_ptr = cm->mi;
setup_block_dptrs(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
@ -565,26 +563,26 @@ void vp9_first_pass(VP9_COMP *cpi) {
if (mb_col * 2 + 1 < cm->mi_cols) {
if (mb_row * 2 + 1 < cm->mi_rows) {
xd->this_mi->mbmi.sb_type = BLOCK_16X16;
xd->mi_8x8[0]->mbmi.sb_type = BLOCK_16X16;
} else {
xd->this_mi->mbmi.sb_type = BLOCK_16X8;
xd->mi_8x8[0]->mbmi.sb_type = BLOCK_16X8;
}
} else {
if (mb_row * 2 + 1 < cm->mi_rows) {
xd->this_mi->mbmi.sb_type = BLOCK_8X16;
xd->mi_8x8[0]->mbmi.sb_type = BLOCK_8X16;
} else {
xd->this_mi->mbmi.sb_type = BLOCK_8X8;
xd->mi_8x8[0]->mbmi.sb_type = BLOCK_8X8;
}
}
xd->this_mi->mbmi.ref_frame[0] = INTRA_FRAME;
xd->mi_8x8[0]->mbmi.ref_frame[0] = INTRA_FRAME;
set_mi_row_col(cm, xd,
mb_row << 1,
1 << mi_height_log2(xd->this_mi->mbmi.sb_type),
1 << mi_height_log2(xd->mi_8x8[0]->mbmi.sb_type),
mb_col << 1,
1 << mi_width_log2(xd->this_mi->mbmi.sb_type));
1 << mi_width_log2(xd->mi_8x8[0]->mbmi.sb_type));
if (cpi->sf.variance_adaptive_quantization) {
int energy = vp9_block_energy(cpi, x, xd->this_mi->mbmi.sb_type);
int energy = vp9_block_energy(cpi, x, xd->mi_8x8[0]->mbmi.sb_type);
error_weight = vp9_vaq_inv_q_ratio(energy);
}
@ -690,13 +688,13 @@ void vp9_first_pass(VP9_COMP *cpi) {
mv.as_mv.col *= 8;
this_error = motion_error;
vp9_set_mbmode_and_mvs(x, NEWMV, &mv);
xd->this_mi->mbmi.tx_size = TX_4X4;
xd->this_mi->mbmi.ref_frame[0] = LAST_FRAME;
xd->this_mi->mbmi.ref_frame[1] = NONE;
xd->mi_8x8[0]->mbmi.tx_size = TX_4X4;
xd->mi_8x8[0]->mbmi.ref_frame[0] = LAST_FRAME;
xd->mi_8x8[0]->mbmi.ref_frame[1] = NONE;
vp9_build_inter_predictors_sby(xd, mb_row << 1,
mb_col << 1,
xd->this_mi->mbmi.sb_type);
vp9_encode_sby(x, xd->this_mi->mbmi.sb_type);
xd->mi_8x8[0]->mbmi.sb_type);
vp9_encode_sby(x, xd->mi_8x8[0]->mbmi.sb_type);
sum_mvr += mv.as_mv.row;
sum_mvr_abs += abs(mv.as_mv.row);
sum_mvc += mv.as_mv.col;

View File

@ -149,7 +149,7 @@ static int find_best_16x16_intra(VP9_COMP *cpi,
for (mode = DC_PRED; mode <= TM_PRED; mode++) {
unsigned int err;
xd->this_mi->mbmi.mode = mode;
xd->mi_8x8[0]->mbmi.mode = mode;
vp9_predict_intra_block(xd, 0, 2, TX_16X16, mode,
x->plane[0].src.buf, x->plane[0].src.stride,
xd->plane[0].dst.buf, xd->plane[0].dst.stride);
@ -258,7 +258,7 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi,
xd->plane[0].dst.stride = buf->y_stride;
xd->plane[0].pre[0].stride = buf->y_stride;
xd->plane[1].dst.stride = buf->uv_stride;
xd->this_mi = &mi_local;
xd->mi_8x8[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;
@ -312,6 +312,7 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi,
static void separate_arf_mbs(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
int mb_col, mb_row, offset, i;
int mi_row, mi_col;
int ncnt[4] = { 0 };
int n_frames = cpi->mbgraph_n_frames;
@ -348,22 +349,17 @@ static void separate_arf_mbs(VP9_COMP *cpi) {
}
}
for (offset = 0, mb_row = 0; mb_row < cm->mb_rows;
offset += cm->mb_cols, mb_row++) {
for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
// arf_not_zz is indexed by MB, but this loop is indexed by MI to avoid out
// of bound access in segmentation_map
for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) {
// If any of the blocks in the sequence failed then the MB
// goes in segment 0
if (arf_not_zz[offset + mb_col]) {
if (arf_not_zz[mi_row/2*cm->mb_cols + mi_col/2]) {
ncnt[0]++;
cpi->segmentation_map[offset * 4 + 2 * mb_col] = 0;
cpi->segmentation_map[offset * 4 + 2 * mb_col + 1] = 0;
cpi->segmentation_map[offset * 4 + 2 * mb_col + cm->mi_cols] = 0;
cpi->segmentation_map[offset * 4 + 2 * mb_col + cm->mi_cols + 1] = 0;
cpi->segmentation_map[mi_row * cm->mi_cols + mi_col] = 0;
} else {
cpi->segmentation_map[offset * 4 + 2 * mb_col] = 1;
cpi->segmentation_map[offset * 4 + 2 * mb_col + 1] = 1;
cpi->segmentation_map[offset * 4 + 2 * mb_col + cm->mi_cols] = 1;
cpi->segmentation_map[offset * 4 + 2 * mb_col + cm->mi_cols + 1] = 1;
cpi->segmentation_map[mi_row * cm->mi_cols + mi_col] = 1;
ncnt[1]++;
}
}
@ -374,7 +370,7 @@ static void separate_arf_mbs(VP9_COMP *cpi) {
if (1) {
// Note % of blocks that are marked as static
if (cm->MBs)
cpi->static_mb_pct = (ncnt[1] * 100) / cm->MBs;
cpi->static_mb_pct = (ncnt[1] * 100) / (cm->mi_rows * cm->mi_cols);
// This error case should not be reachable as this function should
// never be called with the common data structure uninitialized.

View File

@ -445,8 +445,8 @@ static void configure_static_seg_features(VP9_COMP *cpi) {
// Skip all MBs if high Q (0,0 mv and skip coeffs)
if (high_q) {
vp9_enable_segfeature(seg, 0, SEG_LVL_SKIP);
vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP);
vp9_enable_segfeature(seg, 0, SEG_LVL_SKIP);
vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP);
}
// Enable data update
seg->update_data = 1;
@ -2912,7 +2912,8 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
// Set various flags etc to special state if it is a key frame.
if (frame_is_intra_only(cm)) {
// Reset the loop filter deltas and segmentation map
vp9_setup_key_frame(cpi);
// Reset the loop filter deltas and segmentation map.
setup_features(cm);
// If segmentation is enabled force a map update for key frames.
@ -3495,7 +3496,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
cpi->mb.e_mbd.mi_8x8 = cm->mi_grid_visible;
cpi->mb.e_mbd.mi_8x8[0] = cm->mi;
cpi->mb.e_mbd.this_mi = cm->mi;
// Don't increment frame counters if this was an altref buffer
// update not a real frame

View File

@ -275,7 +275,7 @@ void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *xd = &x->e_mbd;
int zbin_extra;
int segment_id = xd->this_mi->mbmi.segment_id;
int segment_id = xd->mi_8x8[0]->mbmi.segment_id;
const int qindex = vp9_get_qindex(&cpi->common.seg, segment_id,
cpi->common.base_qindex);

View File

@ -489,7 +489,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
TX_SIZE tx_size,
const int16_t *scan, const int16_t *nb) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct macroblockd_plane *pd = &xd->plane[plane];
const PLANE_TYPE type = pd->plane_type;
const int16_t *band_count = &band_counts[tx_size][1];
@ -567,7 +567,7 @@ static void dist_block(int plane, int block, TX_SIZE tx_size, void *arg) {
args->sse = this_sse >> shift;
if (x->skip_encode &&
xd->this_mi->mbmi.ref_frame[0] == INTRA_FRAME) {
xd->mi_8x8[0]->mbmi.ref_frame[0] == INTRA_FRAME) {
// TODO(jingning): tune the model to better capture the distortion.
int64_t p = (pd->dequant[1] * pd->dequant[1] *
(1 << ss_txfrm_size)) >> (shift + 2);
@ -599,7 +599,7 @@ static void block_yrd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
if (args->skip)
return;
if (!is_inter_block(&xd->this_mi->mbmi))
if (!is_inter_block(&xd->mi_8x8[0]->mbmi))
vp9_encode_block_intra(plane, block, plane_bsize, tx_size, &encode_args);
else
vp9_xform_quant(plane, block, plane_bsize, tx_size, &encode_args);
@ -685,7 +685,7 @@ static void txfm_rd_in_plane(MACROBLOCK *x,
init_rdcost_stack(x, tx_size, num_4x4_w, num_4x4_h,
ref_best_rd, rd_stack);
if (plane == 0)
xd->this_mi->mbmi.tx_size = tx_size;
xd->mi_8x8[0]->mbmi.tx_size = tx_size;
vp9_get_entropy_contexts(tx_size, rd_stack->t_above, rd_stack->t_left,
pd->above_context, pd->left_context,
@ -716,7 +716,7 @@ static void choose_largest_txfm_size(VP9_COMP *cpi, MACROBLOCK *x,
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
if (max_tx_size == TX_32X32 &&
(cm->tx_mode == ALLOW_32X32 ||
cm->tx_mode == TX_MODE_SELECT)) {
@ -746,13 +746,13 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
vp9_prob skip_prob = vp9_get_pred_prob_mbskip(cm, xd);
int64_t rd[TX_SIZES][2];
int n, m;
int s0, s1;
const vp9_prob *tx_probs = get_tx_probs2(xd, &cm->fc.tx_probs, xd->this_mi);
const vp9_prob *tx_probs = get_tx_probs2(xd, &cm->fc.tx_probs, xd->mi_8x8[0]);
for (n = TX_4X4; n <= max_tx_size; n++) {
r[n][1] = r[n][0];
@ -849,7 +849,7 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x,
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
vp9_prob skip_prob = vp9_get_pred_prob_mbskip(cm, xd);
int64_t rd[TX_SIZES][2];
int n, m;
@ -857,7 +857,7 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x,
double scale_rd[TX_SIZES] = {1.73, 1.44, 1.20, 1.00};
// double scale_r[TX_SIZES] = {2.82, 2.00, 1.41, 1.00};
const vp9_prob *tx_probs = get_tx_probs2(xd, &cm->fc.tx_probs, xd->this_mi);
const vp9_prob *tx_probs = get_tx_probs2(xd, &cm->fc.tx_probs, xd->mi_8x8[0]);
// for (n = TX_4X4; n <= max_txfm_size; n++)
// r[n][0] = (r[n][0] * scale_r[n]);
@ -942,7 +942,7 @@ static void super_block_yrd(VP9_COMP *cpi,
int r[TX_SIZES][2], s[TX_SIZES];
int64_t d[TX_SIZES], sse[TX_SIZES];
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
struct rdcost_block_args *rdcost_stack = &cpi->rdcost_stack;
assert(bs == mbmi->sb_type);
@ -1052,7 +1052,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
vpx_memcpy(ta, a, sizeof(ta));
vpx_memcpy(tl, l, sizeof(tl));
xd->this_mi->mbmi.tx_size = TX_4X4;
xd->mi_8x8[0]->mbmi.tx_size = TX_4X4;
for (mode = DC_PRED; mode <= TM_PRED; ++mode) {
int64_t this_rd;
@ -1083,7 +1083,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
uint8_t *dst = dst_init + idx * 4 + idy * 4 * dst_stride;
block = ib + idy * 2 + idx;
xd->this_mi->bmi[block].as_mode = mode;
xd->mi_8x8[0]->bmi[block].as_mode = mode;
src_diff = raster_block_offset_int16(BLOCK_8X8, block, p->src_diff);
coeff = BLOCK_OFFSET(x->plane[0].coeff, block);
vp9_predict_intra_block(xd, block, 1,
@ -1159,10 +1159,10 @@ static int64_t rd_pick_intra_sub_8x8_y_mode(VP9_COMP * const cpi,
int64_t best_rd) {
int i, j;
MACROBLOCKD *const xd = &mb->e_mbd;
MODE_INFO *const mic = xd->this_mi;
MODE_INFO *const mic = xd->mi_8x8[0];
const MODE_INFO *above_mi = xd->mi_8x8[-xd->mode_info_stride];
const MODE_INFO *left_mi = xd->mi_8x8[-1];
const BLOCK_SIZE bsize = xd->this_mi->mbmi.sb_type;
const BLOCK_SIZE bsize = xd->mi_8x8[0]->mbmi.sb_type;
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
int idx, idy;
@ -1233,7 +1233,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
MB_PREDICTION_MODE mode;
MB_PREDICTION_MODE mode_selected = DC_PRED;
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *const mic = xd->this_mi;
MODE_INFO *const mic = xd->mi_8x8[0];
int this_rate, this_rate_tokenonly, s;
int64_t this_distortion, this_rd;
TX_SIZE best_tx = TX_4X4;
@ -1303,7 +1303,7 @@ static void super_block_uvrd(VP9_COMP *const cpi, MACROBLOCK *x,
int64_t *sse, BLOCK_SIZE bsize,
int64_t ref_best_rd) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
TX_SIZE uv_txfm_size = get_uv_tx_size(mbmi);
int plane;
int pnrate = 0, pnskip = 1;
@ -1426,7 +1426,7 @@ static int cost_mv_ref(VP9_COMP *cpi, MB_PREDICTION_MODE mode,
int mode_context) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int segment_id = xd->this_mi->mbmi.segment_id;
const int segment_id = xd->mi_8x8[0]->mbmi.segment_id;
// Don't account for mode here if segment skip is enabled.
if (!vp9_segfeature_active(&cpi->common.seg, segment_id, SEG_LVL_SKIP)) {
@ -1462,7 +1462,7 @@ static int labels2mode(MACROBLOCK *x, int i,
int_mv *second_best_ref_mv,
int *mvjcost, int *mvcost[2], VP9_COMP *cpi) {
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *const mic = xd->this_mi;
MODE_INFO *const mic = xd->mi_8x8[0];
MB_MODE_INFO *mbmi = &mic->mbmi;
int cost = 0, thismvcost = 0;
int idx, idy;
@ -1540,7 +1540,7 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi,
MACROBLOCKD *xd = &x->e_mbd;
struct macroblockd_plane *const pd = &xd->plane[0];
struct macroblock_plane *const p = &x->plane[0];
MODE_INFO *const mi = xd->this_mi;
MODE_INFO *const mi = xd->mi_8x8[0];
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
const int width = plane_block_width(bsize, pd);
const int height = plane_block_height(bsize, pd);
@ -2057,7 +2057,7 @@ static int64_t rd_pick_best_mbsegmentation(VP9_COMP *cpi, MACROBLOCK *x,
int i;
BEST_SEG_INFO *bsi = bsi_buf + filter_idx;
MACROBLOCKD *xd = &x->e_mbd;
MODE_INFO *mi = xd->this_mi;
MODE_INFO *mi = xd->mi_8x8[0];
MB_MODE_INFO *mbmi = &mi->mbmi;
int mode_idx;
@ -2103,7 +2103,7 @@ static void mv_pred(VP9_COMP *cpi, MACROBLOCK *x,
uint8_t *ref_y_buffer, int ref_y_stride,
int ref_frame, BLOCK_SIZE block_size ) {
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
int_mv this_mv;
int i;
int zero_seen = 0;
@ -2227,7 +2227,7 @@ static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
// restored if we decide to encode this way
ctx->skip = x->skip;
ctx->best_mode_index = mode_index;
ctx->mic = *xd->this_mi;
ctx->mic = *xd->mi_8x8[0];
ctx->best_ref_mv.as_int = ref_mv->as_int;
ctx->second_best_ref_mv.as_int = second_ref_mv->as_int;
@ -2278,7 +2278,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
VP9_COMMON *cm = &cpi->common;
YV12_BUFFER_CONFIG *yv12 = &cm->yv12_fb[cpi->common.ref_frame_map[idx]];
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
// set up scaling factors
scale[frame_type] = cpi->common.active_ref_scale[frame_type - 1];
@ -2296,7 +2296,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
&scale[frame_type], &scale[frame_type]);
// Gets an initial list of candidate vectors from neighbours and orders them
vp9_find_mv_refs(&cpi->common, xd, xd->this_mi,
vp9_find_mv_refs(&cpi->common, xd, xd->mi_8x8[0],
xd->last_mi,
frame_type,
mbmi->ref_mvs[frame_type], mi_row, mi_col);
@ -2326,7 +2326,7 @@ static YV12_BUFFER_CONFIG *get_scaled_ref_frame(VP9_COMP *cpi, int ref_frame) {
static INLINE int get_switchable_rate(const MACROBLOCK *x) {
const MACROBLOCKD *const xd = &x->e_mbd;
const MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
const MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
const int ctx = vp9_get_pred_context_switchable_interp(xd);
return SWITCHABLE_INTERP_RATE_FACTOR *
x->switchable_interp_costs[ctx][mbmi->interp_filter];
@ -2338,7 +2338,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int_mv *tmp_mv, int *rate_mv) {
MACROBLOCKD *xd = &x->e_mbd;
VP9_COMMON *cm = &cpi->common;
MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0}};
int bestsme = INT_MAX;
int further_steps, step_param;
@ -2477,7 +2477,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int *rate_mv) {
int pw = 4 << b_width_log2(bsize), ph = 4 << b_height_log2(bsize);
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
int refs[2] = { mbmi->ref_frame[0],
(mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1]) };
int_mv ref_mv[2];
@ -2642,7 +2642,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
const int64_t ref_best_rd) {
VP9_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
const int is_comp_pred = has_second_ref(mbmi);
const int num_refs = is_comp_pred ? 2 : 1;
const int this_mode = mbmi->mode;
@ -2688,7 +2688,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
single_motion_search(cpi, x, bsize, mi_row, mi_col, &tmp_mv, &rate_mv);
*rate2 += rate_mv;
frame_mv[refs[0]].as_int =
xd->this_mi->bmi[0].as_mv[0].as_int = tmp_mv.as_int;
xd->mi_8x8[0]->bmi[0].as_mv[0].as_int = tmp_mv.as_int;
single_newmv[refs[0]].as_int = tmp_mv.as_int;
}
}
@ -3052,7 +3052,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
int64_t dist_y = 0, dist_uv = 0, tx_cache[TX_MODES] = { 0 };
x->skip_encode = 0;
ctx->skip = 0;
xd->this_mi->mbmi.ref_frame[0] = INTRA_FRAME;
xd->mi_8x8[0]->mbmi.ref_frame[0] = INTRA_FRAME;
if (bsize >= BLOCK_8X8) {
if (rd_pick_intra_sby_mode(cpi, x, &rate_y, &rate_y_tokenonly,
&dist_y, &y_skip, bsize, tx_cache,
@ -3092,7 +3092,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
}
ctx->mic = *xd->this_mi;
ctx->mic = *xd->mi_8x8[0];
}
int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
@ -3104,7 +3104,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
int64_t best_rd_so_far) {
VP9_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
const struct segmentation *seg = &cm->seg;
const BLOCK_SIZE block_size = get_plane_block_size(bsize, &xd->plane[0]);
MB_PREDICTION_MODE this_mode;
@ -3535,15 +3535,15 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
// Keep record of best intra rd
if (xd->this_mi->mbmi.ref_frame[0] == INTRA_FRAME &&
is_intra_mode(xd->this_mi->mbmi.mode) &&
if (xd->mi_8x8[0]->mbmi.ref_frame[0] == INTRA_FRAME &&
is_intra_mode(xd->mi_8x8[0]->mbmi.mode) &&
this_rd < best_intra_rd) {
best_intra_rd = this_rd;
best_intra_mode = xd->this_mi->mbmi.mode;
best_intra_mode = xd->mi_8x8[0]->mbmi.mode;
}
// Keep record of best inter rd with single reference
if (xd->this_mi->mbmi.ref_frame[0] > INTRA_FRAME &&
xd->this_mi->mbmi.ref_frame[1] == NONE &&
if (xd->mi_8x8[0]->mbmi.ref_frame[0] > INTRA_FRAME &&
xd->mi_8x8[0]->mbmi.ref_frame[1] == NONE &&
!mode_excluded &&
this_rd < best_inter_rd) {
best_inter_rd = this_rd;
@ -3802,7 +3802,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
int64_t best_rd_so_far) {
VP9_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
const struct segmentation *seg = &cm->seg;
const BLOCK_SIZE block_size = get_plane_block_size(bsize, &xd->plane[0]);
MV_REFERENCE_FRAME ref_frame, second_ref_frame;
@ -4091,7 +4091,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
cpi->rd_thresh_sub8x8[segment_id][bsize][THR_ALTR];
this_rd_thresh = (ref_frame == GOLDEN_FRAME) ?
cpi->rd_thresh_sub8x8[segment_id][bsize][THR_GOLD] : this_rd_thresh;
xd->this_mi->mbmi.tx_size = TX_4X4;
xd->mi_8x8[0]->mbmi.tx_size = TX_4X4;
cpi->rd_filter_cache[SWITCHABLE_FILTERS] = INT64_MAX;
if (cm->mcomp_filter_type != BILINEAR) {
@ -4146,7 +4146,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
tmp_best_skippable = skippable;
tmp_best_mbmode = *mbmi;
for (i = 0; i < 4; i++)
tmp_best_bmodes[i] = xd->this_mi->bmi[i];
tmp_best_bmodes[i] = xd->mi_8x8[0]->bmi[i];
pred_exists = 1;
if (switchable_filter_index == 0 &&
cpi->sf.use_rd_breakout &&
@ -4197,7 +4197,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
skippable = tmp_best_skippable;
*mbmi = tmp_best_mbmode;
for (i = 0; i < 4; i++)
xd->this_mi->bmi[i] = tmp_best_bmodes[i];
xd->mi_8x8[0]->bmi[i] = tmp_best_bmodes[i];
}
rate2 += rate;
@ -4290,8 +4290,8 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
}
// Keep record of best inter rd with single reference
if (xd->this_mi->mbmi.ref_frame[0] > INTRA_FRAME &&
xd->this_mi->mbmi.ref_frame[1] == NONE &&
if (xd->mi_8x8[0]->mbmi.ref_frame[0] > INTRA_FRAME &&
xd->mi_8x8[0]->mbmi.ref_frame[1] == NONE &&
!mode_excluded &&
this_rd < best_inter_rd) {
best_inter_rd = this_rd;
@ -4327,7 +4327,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
sizeof(ctx->zcoeff_blk));
for (i = 0; i < 4; i++)
best_bmodes[i] = xd->this_mi->bmi[i];
best_bmodes[i] = xd->mi_8x8[0]->bmi[i];
// TODO(debargha): enhance this test with a better distortion prediction
// based on qp, activity mask and history
@ -4478,13 +4478,13 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
x->skip |= best_skip2;
if (best_mbmode.ref_frame[0] == INTRA_FRAME) {
for (i = 0; i < 4; i++)
xd->this_mi->bmi[i].as_mode = best_bmodes[i].as_mode;
xd->mi_8x8[0]->bmi[i].as_mode = best_bmodes[i].as_mode;
} else {
for (i = 0; i < 4; ++i)
vpx_memcpy(&xd->this_mi->bmi[i], &best_bmodes[i], sizeof(b_mode_info));
vpx_memcpy(&xd->mi_8x8[0]->bmi[i], &best_bmodes[i], sizeof(b_mode_info));
mbmi->mv[0].as_int = xd->this_mi->bmi[3].as_mv[0].as_int;
mbmi->mv[1].as_int = xd->this_mi->bmi[3].as_mv[1].as_int;
mbmi->mv[0].as_int = xd->mi_8x8[0]->bmi[3].as_mv[0].as_int;
mbmi->mv[1].as_int = xd->mi_8x8[0]->bmi[3].as_mv[1].as_int;
}
for (i = 0; i < NB_PREDICTION_TYPES; ++i) {

View File

@ -129,9 +129,8 @@ static void count_segs(VP9_COMP *cpi, MODE_INFO **mi_8x8,
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
segment_id = mi_8x8[0]->mbmi.segment_id;
xd->mi_8x8 = mi_8x8;
xd->this_mi = mi_8x8[0];
segment_id = xd->mi_8x8[0]->mbmi.segment_id;
set_mi_row_col(cm, xd, mi_row, bh, mi_col, bw);

View File

@ -108,7 +108,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
MACROBLOCKD *xd = args->xd;
TOKENEXTRA **tp = args->tp;
struct macroblockd_plane *pd = &xd->plane[plane];
MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
int pt; /* near block/prev token context index */
int c = 0, rc = 0;
TOKENEXTRA *t = *tp; /* store tokens starting here */
@ -200,7 +200,7 @@ void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
BLOCK_SIZE bsize) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
TOKENEXTRA *t_backup = *t;
const int mb_skip_context = vp9_get_pred_context_mbskip(xd);
const int skip_inc = !vp9_segfeature_active(&cm->seg, mbmi->segment_id,