static INLINE int assign_mv(VP9_COMMON *cm, MB_PREDICTION_MODE mode, int_mv mv[2], int_mv ref_mv[2], int_mv nearest_mv[2], int_mv near_mv[2], int is_compound, int allow_hp, vp9_reader *r) { int i; int ret = 1; switch (mode) { case NEWMV: { nmv_context_counts *const mv_counts = cm->frame_parallel_decoding_mode ? NULL : &cm->counts.mv; read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &cm->fc.nmvc, mv_counts, allow_hp); if (is_compound) read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &cm->fc.nmvc, mv_counts, allow_hp); for (i = 0; i < 1 + is_compound; ++i) { ret = ret && mv[i].as_mv.row < MV_UPP && mv[i].as_mv.row > MV_LOW; ret = ret && mv[i].as_mv.col < MV_UPP && mv[i].as_mv.col > MV_LOW; } break; } case NEARESTMV: { mv[0].as_int = nearest_mv[0].as_int; if (is_compound) mv[1].as_int = nearest_mv[1].as_int; break; } case NEARMV: { mv[0].as_int = near_mv[0].as_int; if (is_compound) mv[1].as_int = near_mv[1].as_int; break; } case ZEROMV: { mv[0].as_int = 0; if (is_compound) mv[1].as_int = 0; break; } default: { return 0; } } return ret; }
static INLINE int assign_mv(VP9_COMMON *cm, MACROBLOCKD *xd, PREDICTION_MODE mode, int_mv mv[2], int_mv ref_mv[2], int_mv nearest_mv[2], int_mv near_mv[2], int is_compound, int allow_hp, vp9_reader *r) { int i; int ret = 1; switch (mode) { case NEWMV: { FRAME_COUNTS *counts = xd->counts; nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; for (i = 0; i < 1 + is_compound; ++i) { read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc, mv_counts, allow_hp); ret = ret && is_mv_valid(&mv[i].as_mv); } break; } case NEARESTMV: { mv[0].as_int = nearest_mv[0].as_int; if (is_compound) mv[1].as_int = nearest_mv[1].as_int; break; } case NEARMV: { mv[0].as_int = near_mv[0].as_int; if (is_compound) mv[1].as_int = near_mv[1].as_int; break; } case ZEROMV: { mv[0].as_int = 0; if (is_compound) mv[1].as_int = 0; break; } default: { return 0; } } return ret; }