Commit edced25a authored by Debargha Mukherjee's avatar Debargha Mukherjee

Further cleanups related to removal of cb4x4 flags

Removes a bunch of unused code.

Change-Id: I86bda117d8d455452ee1ee3a2a566742650e05e0
parent c4ec0329
......@@ -1632,18 +1632,9 @@ static INLINE int is_nontrans_global_motion(const MACROBLOCKD *xd) {
const MODE_INFO *mi = xd->mi[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
int ref;
const int unify_bsize = 1;
// First check if all modes are ZEROMV
if (mbmi->sb_type >= BLOCK_8X8 || unify_bsize) {
if (mbmi->mode != ZEROMV && mbmi->mode != ZERO_ZEROMV) return 0;
} else {
if ((mi->bmi[0].as_mode != ZEROMV && mi->bmi[0].as_mode != ZERO_ZEROMV) ||
(mi->bmi[1].as_mode != ZEROMV && mi->bmi[1].as_mode != ZERO_ZEROMV) ||
(mi->bmi[2].as_mode != ZEROMV && mi->bmi[2].as_mode != ZERO_ZEROMV) ||
(mi->bmi[3].as_mode != ZEROMV && mi->bmi[3].as_mode != ZERO_ZEROMV))
return 0;
}
if (mbmi->mode != ZEROMV && mbmi->mode != ZERO_ZEROMV) return 0;
#if !GLOBAL_SUB8X8_USED
if (mbmi->sb_type < BLOCK_8X8) return 0;
......
......@@ -244,10 +244,10 @@ static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm,
int is_integer
#endif
) {
const int unify_bsize = 1;
int_mv res;
const int32_t *mat = gm->wmmat;
int x, y, tx, ty;
(void)block_idx;
if (gm->wmtype == TRANSLATION) {
// All global motion vectors are stored with WARPEDMODEL_PREC_BITS (16)
......@@ -269,15 +269,8 @@ static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm,
return res;
}
if (bsize >= BLOCK_8X8 || unify_bsize) {
x = block_center_x(mi_col, bsize);
y = block_center_y(mi_row, bsize);
} else {
x = block_center_x(mi_col, bsize);
y = block_center_y(mi_row, bsize);
x += (block_idx & 1) * MI_SIZE / 2;
y += (block_idx & 2) * MI_SIZE / 4;
}
x = block_center_x(mi_col, bsize);
y = block_center_y(mi_row, bsize);
if (gm->wmtype == ROTZOOM) {
assert(gm->wmmat[5] == gm->wmmat[2]);
......
......@@ -65,7 +65,6 @@ static uint8_t add_ref_mv_candidate(
int subsampling_y) {
int index = 0, ref;
int newmv_count = 0;
const int unify_bsize = 1;
assert(weight % 2 == 0);
#if !CONFIG_EXT_WARPED_MOTION
(void)bsize;
......@@ -146,33 +145,6 @@ static uint8_t add_ref_mv_candidate(
if (candidate->mode == NEWMV) ++newmv_count;
}
if (candidate_mi->mbmi.sb_type < BLOCK_8X8 && block >= 0 &&
!unify_bsize) {
int alt_block = 3 - block;
this_refmv = get_sub_block_mv(candidate_mi, ref, col, alt_block);
#if CONFIG_AMVR
lower_mv_precision(&this_refmv.as_mv, use_hp, is_integer);
#else
lower_mv_precision(&this_refmv.as_mv, use_hp);
#endif
for (index = 0; index < *refmv_count; ++index)
if (ref_mv_stack[index].this_mv.as_int == this_refmv.as_int) break;
if (index < *refmv_count) ref_mv_stack[index].weight += len;
// Add a new item to the list.
if (index == *refmv_count) {
ref_mv_stack[index].this_mv = this_refmv;
ref_mv_stack[index].pred_diff[0] = av1_get_pred_diff_ctx(
get_sub_block_pred_mv(candidate_mi, ref, col, alt_block),
this_refmv);
ref_mv_stack[index].weight = len;
++(*refmv_count);
if (candidate->mode == NEWMV) ++newmv_count;
}
}
}
}
} else {
......@@ -214,43 +186,6 @@ static uint8_t add_ref_mv_candidate(
if (candidate->mode == NEW_NEWMV) ++newmv_count;
}
if (candidate_mi->mbmi.sb_type < BLOCK_8X8 && block >= 0 &&
!unify_bsize) {
int alt_block = 3 - block;
this_refmv[0] = get_sub_block_mv(candidate_mi, 0, col, alt_block);
this_refmv[1] = get_sub_block_mv(candidate_mi, 1, col, alt_block);
for (ref = 0; ref < 2; ++ref) {
#if CONFIG_AMVR
lower_mv_precision(&this_refmv[ref].as_mv, use_hp, is_integer);
#else
lower_mv_precision(&this_refmv[ref].as_mv, use_hp);
#endif
}
for (index = 0; index < *refmv_count; ++index)
if (ref_mv_stack[index].this_mv.as_int == this_refmv[0].as_int &&
ref_mv_stack[index].comp_mv.as_int == this_refmv[1].as_int)
break;
if (index < *refmv_count) ref_mv_stack[index].weight += len;
// Add a new item to the list.
if (index == *refmv_count) {
ref_mv_stack[index].this_mv = this_refmv[0];
ref_mv_stack[index].comp_mv = this_refmv[1];
ref_mv_stack[index].pred_diff[0] = av1_get_pred_diff_ctx(
get_sub_block_pred_mv(candidate_mi, 0, col, block),
this_refmv[0]);
ref_mv_stack[index].pred_diff[0] = av1_get_pred_diff_ctx(
get_sub_block_pred_mv(candidate_mi, 1, col, block),
this_refmv[1]);
ref_mv_stack[index].weight = len;
++(*refmv_count);
if (candidate->mode == NEW_NEWMV) ++newmv_count;
}
}
}
}
return newmv_count;
......
......@@ -1524,7 +1524,6 @@ static void build_inter_predictors_for_planes(const AV1_COMMON *cm,
int plane;
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
const int unify_bsize = 1;
for (plane = plane_from; plane <= plane_to; ++plane) {
const struct macroblockd_plane *pd = &xd->plane[plane];
const int bw = pd->width;
......@@ -1534,33 +1533,11 @@ static void build_inter_predictors_for_planes(const AV1_COMMON *cm,
pd->subsampling_y))
continue;
if (xd->mi[0]->mbmi.sb_type < BLOCK_8X8 && !unify_bsize) {
const PARTITION_TYPE bp = bsize - xd->mi[0]->mbmi.sb_type;
const int have_vsplit = bp != PARTITION_HORZ;
const int have_hsplit = bp != PARTITION_VERT;
const int num_4x4_w = 2 >> ((!have_vsplit) | pd->subsampling_x);
const int num_4x4_h = 2 >> ((!have_hsplit) | pd->subsampling_y);
const int pw = 8 >> (have_vsplit | pd->subsampling_x);
const int ph = 8 >> (have_hsplit | pd->subsampling_y);
int x, y;
assert(bp != PARTITION_NONE && bp < PARTITION_TYPES);
assert(bsize == BLOCK_8X8);
assert(pw * num_4x4_w == bw && ph * num_4x4_h == bh);
for (y = 0; y < num_4x4_h; ++y)
for (x = 0; x < num_4x4_w; ++x)
build_inter_predictors(cm, xd, plane,
build_inter_predictors(cm, xd, plane,
#if CONFIG_MOTION_VAR
xd->mi[0], 0,
#endif // CONFIG_MOTION_VAR
y * 2 + x, bw, bh, 4 * x, 4 * y, pw, ph, mi_x,
mi_y);
} else {
build_inter_predictors(cm, xd, plane,
#if CONFIG_MOTION_VAR
xd->mi[0], 0,
xd->mi[0], 0,
#endif // CONFIG_MOTION_VAR
0, bw, bh, 0, 0, bw, bh, mi_x, mi_y);
}
0, bw, bh, 0, 0, bw, bh, mi_x, mi_y);
}
}
......
......@@ -448,35 +448,11 @@ static INLINE int has_subpel_mv_component(const MODE_INFO *const mi,
const BLOCK_SIZE bsize = mbmi->sb_type;
int plane;
int ref = (dir >> 1);
const int unify_bsize = 1;
if (bsize >= BLOCK_8X8 || unify_bsize) {
if (dir & 0x01) {
if (mbmi->mv[ref].as_mv.col & SUBPEL_MASK) return 1;
} else {
if (mbmi->mv[ref].as_mv.row & SUBPEL_MASK) return 1;
}
if (dir & 0x01) {
if (mbmi->mv[ref].as_mv.col & SUBPEL_MASK) return 1;
} else {
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
const PARTITION_TYPE bp = BLOCK_8X8 - bsize;
const struct macroblockd_plane *const pd = &xd->plane[plane];
const int have_vsplit = bp != PARTITION_HORZ;
const int have_hsplit = bp != PARTITION_VERT;
const int num_4x4_w = 2 >> ((!have_vsplit) | pd->subsampling_x);
const int num_4x4_h = 2 >> ((!have_hsplit) | pd->subsampling_y);
int x, y;
for (y = 0; y < num_4x4_h; ++y) {
for (x = 0; x < num_4x4_w; ++x) {
const MV mv = average_split_mvs(pd, mi, ref, y * 2 + x);
if (dir & 0x01) {
if (mv.col & SUBPEL_MASK) return 1;
} else {
if (mv.row & SUBPEL_MASK) return 1;
}
}
}
}
if (mbmi->mv[ref].as_mv.row & SUBPEL_MASK) return 1;
}
return 0;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -317,71 +317,11 @@ static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext,
}
}
static void inc_mvs_sub8x8(const MODE_INFO *mi, int block, const int_mv mvs[2],
const MB_MODE_INFO_EXT *mbmi_ext,
nmv_context_counts *nmv_counts
#if CONFIG_AMVR
,
MvSubpelPrecision precision
#endif
) {
int i;
PREDICTION_MODE mode = mi->bmi[block].as_mode;
const MB_MODE_INFO *mbmi = &mi->mbmi;
if (mode == NEWMV || mode == NEW_NEWMV) {
for (i = 0; i < 1 + has_second_ref(&mi->mbmi); ++i) {
const MV *ref = &mi->bmi[block].ref_mv[i].as_mv;
const MV diff = { mvs[i].as_mv.row - ref->row,
mvs[i].as_mv.col - ref->col };
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], i, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
#if CONFIG_AMVR
av1_inc_mv(&diff, counts, precision);
#else
av1_inc_mv(&diff, counts, 1);
#endif
}
} else if (mode == NEAREST_NEWMV || mode == NEAR_NEWMV) {
const MV *ref = &mi->bmi[block].ref_mv[1].as_mv;
const MV diff = { mvs[1].as_mv.row - ref->row,
mvs[1].as_mv.col - ref->col };
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
#if CONFIG_AMVR
av1_inc_mv(&diff, counts, precision);
#else
av1_inc_mv(&diff, counts, 1);
#endif
} else if (mode == NEW_NEARESTMV || mode == NEW_NEARMV) {
const MV *ref = &mi->bmi[block].ref_mv[0].as_mv;
const MV diff = { mvs[0].as_mv.row - ref->row,
mvs[0].as_mv.col - ref->col };
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context_counts *counts = &nmv_counts[nmv_ctx];
#if CONFIG_AMVR
av1_inc_mv(&diff, counts, precision);
#else
av1_inc_mv(&diff, counts, 1);
#endif
}
}
void av1_update_mv_count(ThreadData *td) {
const MACROBLOCKD *xd = &td->mb.e_mbd;
const MODE_INFO *mi = xd->mi[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
const MB_MODE_INFO_EXT *mbmi_ext = td->mb.mbmi_ext;
const int unify_bsize = 1;
#if CONFIG_AMVR
MvSubpelPrecision precision = 1;
if (xd->cur_frame_mv_precision_level) {
......@@ -389,33 +329,10 @@ void av1_update_mv_count(ThreadData *td) {
}
#endif
if (mbmi->sb_type < BLOCK_8X8 && !unify_bsize) {
const int num_4x4_w = num_4x4_blocks_wide_lookup[mbmi->sb_type];
const int num_4x4_h = num_4x4_blocks_high_lookup[mbmi->sb_type];
int idx, idy;
for (idy = 0; idy < 2; idy += num_4x4_h) {
for (idx = 0; idx < 2; idx += num_4x4_w) {
const int i = idy * 2 + idx;
if (have_newmv_in_inter_mode(mi->bmi[i].as_mode))
#if CONFIG_AMVR
inc_mvs_sub8x8(mi, i, mi->bmi[i].as_mv, mbmi_ext, td->counts->mv,
precision);
#else
inc_mvs_sub8x8(mi, i, mi->bmi[i].as_mv, mbmi_ext, td->counts->mv);
#endif
}
}
} else {
if (have_newmv_in_inter_mode(mbmi->mode))
if (have_newmv_in_inter_mode(mbmi->mode))
#if CONFIG_AMVR
inc_mvs(mbmi, mbmi_ext, mbmi->mv, mbmi->pred_mv, td->counts->mv,
precision);
inc_mvs(mbmi, mbmi_ext, mbmi->mv, mbmi->pred_mv, td->counts->mv, precision);
#else
inc_mvs(mbmi, mbmi_ext, mbmi->mv, mbmi->pred_mv, td->counts->mv);
inc_mvs(mbmi, mbmi_ext, mbmi->mv, mbmi->pred_mv, td->counts->mv);
#endif
}
}
This diff is collapsed.
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