Commit b89eef8f authored by Dmitry Kovalev's avatar Dmitry Kovalev Committed by Gerrit Code Review
Browse files

Merge "Simplifying vp9_mvref_common.c."

parents b214cd0d 1a5e6ffb
...@@ -129,18 +129,15 @@ static INLINE int_mv get_sub_block_mv(const MODE_INFO *candidate, ...@@ -129,18 +129,15 @@ static INLINE int_mv get_sub_block_mv(const MODE_INFO *candidate,
// Performs mv sign inversion if indicated by the reference frame combination. // Performs mv sign inversion if indicated by the reference frame combination.
static INLINE int_mv scale_mv(const MODE_INFO *candidate, const int which_mv, static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
const MV_REFERENCE_FRAME this_ref_frame, const MV_REFERENCE_FRAME this_ref_frame,
const int *ref_sign_bias) { const int *ref_sign_bias) {
int_mv return_mv = candidate->mbmi.mv[which_mv]; int_mv mv = mbmi->mv[ref];
if (ref_sign_bias[mbmi->ref_frame[ref]] != ref_sign_bias[this_ref_frame]) {
// Sign inversion where appropriate. mv.as_mv.row *= -1;
if (ref_sign_bias[candidate->mbmi.ref_frame[which_mv]] != mv.as_mv.col *= -1;
ref_sign_bias[this_ref_frame]) {
return_mv.as_mv.row *= -1;
return_mv.as_mv.col *= -1;
} }
return return_mv; return mv;
} }
// This macro is used to add a motion vector mv_ref list if it isn't // This macro is used to add a motion vector mv_ref list if it isn't
...@@ -159,12 +156,12 @@ static INLINE int_mv scale_mv(const MODE_INFO *candidate, const int which_mv, ...@@ -159,12 +156,12 @@ static INLINE int_mv scale_mv(const MODE_INFO *candidate, const int which_mv,
// If either reference frame is different, not INTRA, and they // If either reference frame is different, not INTRA, and they
// are different from each other scale and add the mv to our list. // are different from each other scale and add the mv to our list.
#define IF_DIFF_REF_FRAME_ADD_MV(CANDIDATE) \ #define IF_DIFF_REF_FRAME_ADD_MV(CANDIDATE) \
if ((CANDIDATE)->mbmi.ref_frame[0] != ref_frame) { \ if ((CANDIDATE)->ref_frame[0] != ref_frame) { \
ADD_MV_REF_LIST(scale_mv((CANDIDATE), 0, ref_frame, ref_sign_bias)); \ ADD_MV_REF_LIST(scale_mv((CANDIDATE), 0, ref_frame, ref_sign_bias)); \
} \ } \
if ((CANDIDATE)->mbmi.ref_frame[1] != ref_frame && \ if ((CANDIDATE)->ref_frame[1] != ref_frame && \
(CANDIDATE)->mbmi.ref_frame[1] > INTRA_FRAME && \ (CANDIDATE)->ref_frame[1] > INTRA_FRAME && \
(CANDIDATE)->mbmi.mv[1].as_int != (CANDIDATE)->mbmi.mv[0].as_int) { \ (CANDIDATE)->mv[1].as_int != (CANDIDATE)->mv[0].as_int) { \
ADD_MV_REF_LIST(scale_mv((CANDIDATE), 1, ref_frame, ref_sign_bias)); \ ADD_MV_REF_LIST(scale_mv((CANDIDATE), 1, ref_frame, ref_sign_bias)); \
} }
...@@ -273,13 +270,13 @@ void vp9_find_mv_refs_idx(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, ...@@ -273,13 +270,13 @@ void vp9_find_mv_refs_idx(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
if (!is_inter_block(&candidate->mbmi)) if (!is_inter_block(&candidate->mbmi))
continue; continue;
IF_DIFF_REF_FRAME_ADD_MV(candidate); IF_DIFF_REF_FRAME_ADD_MV(&candidate->mbmi);
} }
} }
// Since we still don't have a candidate we'll try the last frame. // Since we still don't have a candidate we'll try the last frame.
if (lf_here != NULL && is_inter_block(&lf_here->mbmi)) { if (lf_here != NULL && is_inter_block(&lf_here->mbmi)) {
IF_DIFF_REF_FRAME_ADD_MV(lf_here); IF_DIFF_REF_FRAME_ADD_MV(&lf_here->mbmi);
} }
Done: Done:
...@@ -290,6 +287,3 @@ void vp9_find_mv_refs_idx(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, ...@@ -290,6 +287,3 @@ void vp9_find_mv_refs_idx(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
for (idx = 0; idx < MAX_MV_REF_CANDIDATES; ++idx) for (idx = 0; idx < MAX_MV_REF_CANDIDATES; ++idx)
clamp_mv_ref(&mv_ref_list[idx].as_mv, xd); clamp_mv_ref(&mv_ref_list[idx].as_mv, xd);
} }
#undef ADD_MV_REF_LIST
#undef IF_DIFF_REF_FRAME_ADD_MV
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