Commit 1ae91f77 authored by Dmitry Kovalev's avatar Dmitry Kovalev

Adding get_y_mode() function.

Change-Id: Iaac57b24f79cd205a8c62bc1177412d22f5787a8
parent acefe86e
......@@ -16,8 +16,7 @@ MB_PREDICTION_MODE vp9_left_block_mode(const MODE_INFO *cur_mi,
if (!left_mi || is_inter_block(&left_mi->mbmi))
return DC_PRED;
return left_mi->mbmi.sb_type < BLOCK_8X8 ? left_mi->bmi[b + 1].as_mode
: left_mi->mbmi.mode;
return get_y_mode(left_mi, b + 1);
} else {
assert(b == 1 || b == 3);
return cur_mi->bmi[b - 1].as_mode;
......@@ -30,8 +29,7 @@ MB_PREDICTION_MODE vp9_above_block_mode(const MODE_INFO *cur_mi,
if (!above_mi || is_inter_block(&above_mi->mbmi))
return DC_PRED;
return above_mi->mbmi.sb_type < BLOCK_8X8 ? above_mi->bmi[b + 2].as_mode
: above_mi->mbmi.mode;
return get_y_mode(above_mi, b + 2);
} else {
assert(b == 2 || b == 3);
return cur_mi->bmi[b - 2].as_mode;
......
......@@ -144,6 +144,11 @@ typedef struct {
b_mode_info bmi[4];
} MODE_INFO;
static INLINE MB_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;
}
static INLINE int is_inter_block(const MB_MODE_INFO *mbmi) {
return mbmi->ref_frame[0] > INTRA_FRAME;
}
......@@ -255,13 +260,11 @@ 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->mi_8x8[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi))
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(&mi->mbmi))
return DCT_DCT;
return mode2txfm_map[mbmi->sb_type < BLOCK_8X8 ? mi->bmi[ib].as_mode
: mbmi->mode];
return mode2txfm_map[get_y_mode(mi, ib)];
}
static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type,
......
......@@ -177,13 +177,11 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
static const INLINE scan_order *get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size,
PLANE_TYPE type, int block_idx) {
const MODE_INFO *const mi = xd->mi_8x8[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
if (is_inter_block(mbmi) || type != PLANE_TYPE_Y || xd->lossless) {
if (is_inter_block(&mi->mbmi) || type != PLANE_TYPE_Y || xd->lossless) {
return &vp9_default_scan_orders[tx_size];
} else {
const MB_PREDICTION_MODE mode =
mbmi->sb_type < BLOCK_8X8 ? mi->bmi[block_idx].as_mode : mbmi->mode;
const MB_PREDICTION_MODE mode = get_y_mode(mi, block_idx);
return &vp9_scan_orders[tx_size][mode2txfm_map[mode]];
}
}
......
......@@ -290,10 +290,8 @@ static void predict_and_reconstruct_intra_block(int plane, int block,
MACROBLOCKD *const xd = args->xd;
struct macroblockd_plane *const pd = &xd->plane[plane];
MODE_INFO *const mi = xd->mi_8x8[0];
const MB_PREDICTION_MODE mode = (plane == 0)
? ((mi->mbmi.sb_type < BLOCK_8X8) ? mi->bmi[block].as_mode
: mi->mbmi.mode)
: mi->mbmi.uv_mode;
const MB_PREDICTION_MODE mode = (plane == 0) ? get_y_mode(mi, block)
: mi->mbmi.uv_mode;
int x, y;
uint8_t *dst;
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
......
......@@ -575,11 +575,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
case TX_4X4:
tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
scan_order = &vp9_scan_orders[TX_4X4][tx_type];
if (mbmi->sb_type < BLOCK_8X8 && plane == 0)
mode = xd->mi_8x8[0]->bmi[block].as_mode;
else
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
mode = plane == 0 ? get_y_mode(xd->mi_8x8[0], block) : mbmi->uv_mode;
vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode,
x->skip_encode ? src : dst,
x->skip_encode ? src_stride : dst_stride,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment