Commit 1e6bf6ba authored by Hui Su's avatar Hui Su

intrabc: add assertions for DV subpel

DV and ref DV should not have subpel values.

Change-Id: I7c47c442936f1d6bda36314812c44498ba6195a6
parent 1e68d5dd
......@@ -991,6 +991,11 @@ static INLINE int assign_dv(AV1_COMMON *cm, MACROBLOCKD *xd, int_mv *mv,
nmv_context_counts *const dv_counts = counts ? &counts->dv : NULL;
read_mv(r, &mv->as_mv, &ref_mv->as_mv, &ec_ctx->ndvc, dv_counts,
MV_SUBPEL_NONE);
// DV should not have sub-pel.
assert((mv->as_mv.col & 7) == 0);
assert((mv->as_mv.row & 7) == 0);
mv->as_mv.col = (mv->as_mv.col >> 3) << 3;
mv->as_mv.row = (mv->as_mv.row >> 3) << 3;
int valid = is_mv_valid(&mv->as_mv) &&
is_dv_valid(mv->as_mv, &xd->tile, mi_row, mi_col, bsize);
return valid;
......@@ -1048,6 +1053,11 @@ static void read_intrabc_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
#endif
int_mv dv_ref = nearestmv.as_int == 0 ? nearmv : nearestmv;
if (dv_ref.as_int == 0) av1_find_ref_dv(&dv_ref, mi_row, mi_col);
// Ref DV should not have sub-pel.
assert((dv_ref.as_mv.col & 7) == 0);
assert((dv_ref.as_mv.row & 7) == 0);
dv_ref.as_mv.col = (dv_ref.as_mv.col >> 3) << 3;
dv_ref.as_mv.row = (dv_ref.as_mv.row >> 3) << 3;
xd->corrupted |=
!assign_dv(cm, xd, &mbmi->mv[0], &dv_ref, mi_row, mi_col, bsize, r);
#if !CONFIG_TXK_SEL
......
......@@ -217,6 +217,11 @@ void av1_encode_mv(AV1_COMP *cpi, aom_writer *w, const MV *mv, const MV *ref,
#if CONFIG_INTRABC
void av1_encode_dv(aom_writer *w, const MV *mv, const MV *ref,
nmv_context *mvctx) {
// DV and ref DV should not have sub-pel.
assert((mv->col & 7) == 0);
assert((mv->row & 7) == 0);
assert((ref->col & 7) == 0);
assert((ref->row & 7) == 0);
const MV diff = { mv->row - ref->row, mv->col - ref->col };
const MV_JOINT_TYPE j = av1_get_mv_joint(&diff);
......
......@@ -8778,6 +8778,9 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
int_mv dv_ref = nearestmv.as_int == 0 ? nearmv : nearestmv;
if (dv_ref.as_int == 0) av1_find_ref_dv(&dv_ref, mi_row, mi_col);
// Ref DV should not have sub-pel.
assert((dv_ref.as_mv.col & 7) == 0);
assert((dv_ref.as_mv.row & 7) == 0);
mbmi_ext->ref_mvs[INTRA_FRAME][0] = dv_ref;
struct buf_2d yv12_mb[MAX_MB_PLANE];
......@@ -8855,6 +8858,9 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
if (mv_check_bounds(&x->mv_limits, &dv)) continue;
if (!is_dv_valid(dv, tile, mi_row, mi_col, bsize)) continue;
// DV should not have sub-pel.
assert((dv.col & 7) == 0);
assert((dv.row & 7) == 0);
memset(&mbmi->palette_mode_info, 0, sizeof(mbmi->palette_mode_info));
mbmi->use_intrabc = 1;
mbmi->mode = DC_PRED;
......
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