Commit eda4e24c authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Using is_inter_block and has_second_ref functions.

Change-Id: I60dee58a4fd24d3c4f3c101a49d30e217309f43a
parent f9e2140c
......@@ -55,13 +55,11 @@ static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb,
if (!mi)
return DC_PRED;
if (mi->mbmi.ref_frame[0] != INTRA_FRAME) {
if (is_inter_block(&mi->mbmi))
return DC_PRED;
} else if (mi->mbmi.sb_type < BLOCK_8X8) {
return ((mi->bmi + 1 + b)->as_mode);
} else {
return mi->mbmi.mode;
}
else
return mi->mbmi.sb_type < BLOCK_8X8 ? (mi->bmi + 1 + b)->as_mode
: mi->mbmi.mode;
}
assert(b == 1 || b == 3);
return (mi->bmi + b - 1)->as_mode;
......@@ -77,13 +75,11 @@ static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
if (!mi)
return DC_PRED;
if (mi->mbmi.ref_frame[0] != INTRA_FRAME) {
if (is_inter_block(&mi->mbmi))
return DC_PRED;
} else if (mi->mbmi.sb_type < BLOCK_8X8) {
return ((mi->bmi + 2 + b)->as_mode);
} else {
return mi->mbmi.mode;
}
else
return mi->mbmi.sb_type < BLOCK_8X8 ? (mi->bmi + 2 + b)->as_mode
: mi->mbmi.mode;
}
return (mi->bmi + b - 2)->as_mode;
......
......@@ -132,7 +132,7 @@ static void build_inter_predictors(int plane, int block, BLOCK_SIZE bsize,
const int x = 4 * (block & ((1 << bwl) - 1));
const int y = 4 * (block >> bwl);
const MODE_INFO *mi = xd->this_mi;
const int use_second_ref = mi->mbmi.ref_frame[1] > 0;
const int is_compound = has_second_ref(&mi->mbmi);
int ref;
assert(x < bw);
......@@ -140,7 +140,7 @@ static void build_inter_predictors(int plane, int block, BLOCK_SIZE bsize,
assert(mi->mbmi.sb_type < BLOCK_8X8 || 4 << pred_w == bw);
assert(mi->mbmi.sb_type < BLOCK_8X8 || 4 << pred_h == bh);
for (ref = 0; ref < 1 + use_second_ref; ++ref) {
for (ref = 0; ref < 1 + is_compound; ++ref) {
struct scale_factors *const scale = &xd->scale_factor[ref];
struct buf_2d *const pre_buf = &pd->pre[ref];
struct buf_2d *const dst_buf = &pd->dst;
......
......@@ -2736,7 +2736,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
int idx = cm->ref_frame_map[get_ref_frame_idx(cpi, mbmi->ref_frame[0])];
YV12_BUFFER_CONFIG *ref_fb = &cm->yv12_fb[idx];
YV12_BUFFER_CONFIG *second_ref_fb = NULL;
if (mbmi->ref_frame[1] > 0) {
if (has_second_ref(mbmi)) {
idx = cm->ref_frame_map[get_ref_frame_idx(cpi, mbmi->ref_frame[1])];
second_ref_fb = &cm->yv12_fb[idx];
}
......
......@@ -2672,7 +2672,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
VP9_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->this_mi->mbmi;
const int is_comp_pred = (mbmi->ref_frame[1] > 0);
const int is_comp_pred = has_second_ref(mbmi);
const int num_refs = is_comp_pred ? 2 : 1;
const int this_mode = mbmi->mode;
int_mv *frame_mv = mode_mv[this_mode];
......@@ -4044,13 +4044,11 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (best_mbmode.ref_frame[0] != INTRA_FRAME &&
best_mbmode.sb_type < BLOCK_8X8) {
for (i = 0; i < 4; i++)
xd->this_mi->bmi[i].as_mv[0].as_int =
best_bmodes[i].as_mv[0].as_int;
xd->this_mi->bmi[i].as_mv[0].as_int = best_bmodes[i].as_mv[0].as_int;
if (mbmi->ref_frame[1] > 0)
if (has_second_ref(mbmi))
for (i = 0; i < 4; i++)
xd->this_mi->bmi[i].as_mv[1].as_int =
best_bmodes[i].as_mv[1].as_int;
xd->this_mi->bmi[i].as_mv[1].as_int = best_bmodes[i].as_mv[1].as_int;
*x->partition_info = best_partition;
......
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