Merge "Move the definition of switchable filter numbers into enum INTERP_FILTER; Modify the macro ADD_MV_REF_LIST and IF_DIFF_REF_FRAME_ADD_MV."

This commit is contained in:
Hui Su
2014-10-30 11:05:04 -07:00
committed by Gerrit Code Review
4 changed files with 31 additions and 25 deletions

View File

@@ -31,17 +31,14 @@ typedef enum {
EIGHTTAP = 0, EIGHTTAP = 0,
EIGHTTAP_SMOOTH = 1, EIGHTTAP_SMOOTH = 1,
EIGHTTAP_SHARP = 2, EIGHTTAP_SHARP = 2,
SWITCHABLE_FILTERS = 3, /* Number of switchable filters */
BILINEAR = 3, BILINEAR = 3,
// The codec can operate in four possible inter prediction filter mode:
// 8-tap, 8-tap-smooth, 8-tap-sharp, and switching between the three.
SWITCHABLE_FILTER_CONTEXTS = SWITCHABLE_FILTERS + 1,
SWITCHABLE = 4 /* should be the last one */ SWITCHABLE = 4 /* should be the last one */
} INTERP_FILTER; } INTERP_FILTER;
// Number of switchable filters
#define SWITCHABLE_FILTERS 3
// The codec can operate in four possible inter prediction filter mode:
// 8-tap, 8-tap-smooth, 8-tap-sharp, and switching between the three.
#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
typedef int16_t InterpKernel[SUBPEL_TAPS]; typedef int16_t InterpKernel[SUBPEL_TAPS];
const InterpKernel *vp9_get_interp_kernel(INTERP_FILTER filter); const InterpKernel *vp9_get_interp_kernel(INTERP_FILTER filter);

View File

@@ -45,9 +45,11 @@ static void find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
different_ref_found = 1; different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame) if (candidate->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, block)); ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, block),
refmv_count, mv_ref_list, Done);
else if (candidate->ref_frame[1] == ref_frame) else if (candidate->ref_frame[1] == ref_frame)
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 1, mv_ref->col, block)); ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 1, mv_ref->col, block),
refmv_count, mv_ref_list, Done);
} }
} }
@@ -62,18 +64,18 @@ static void find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
different_ref_found = 1; different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame) if (candidate->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(candidate->mv[0]); ADD_MV_REF_LIST(candidate->mv[0], refmv_count, mv_ref_list, Done);
else if (candidate->ref_frame[1] == ref_frame) else if (candidate->ref_frame[1] == ref_frame)
ADD_MV_REF_LIST(candidate->mv[1]); ADD_MV_REF_LIST(candidate->mv[1], refmv_count, mv_ref_list, Done);
} }
} }
// Check the last frame's mode and mv info. // Check the last frame's mode and mv info.
if (prev_mbmi) { if (prev_mbmi) {
if (prev_mbmi->ref_frame[0] == ref_frame) if (prev_mbmi->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(prev_mbmi->mv[0]); ADD_MV_REF_LIST(prev_mbmi->mv[0], refmv_count, mv_ref_list, Done);
else if (prev_mbmi->ref_frame[1] == ref_frame) else if (prev_mbmi->ref_frame[1] == ref_frame)
ADD_MV_REF_LIST(prev_mbmi->mv[1]); ADD_MV_REF_LIST(prev_mbmi->mv[1], refmv_count, mv_ref_list, Done);
} }
// Since we couldn't find 2 mvs from the same reference frame // Since we couldn't find 2 mvs from the same reference frame
@@ -87,14 +89,16 @@ static void find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
* xd->mi_stride].src_mi->mbmi; * xd->mi_stride].src_mi->mbmi;
// If the candidate is INTRA we don't want to consider its mv. // If the candidate is INTRA we don't want to consider its mv.
IF_DIFF_REF_FRAME_ADD_MV(candidate); IF_DIFF_REF_FRAME_ADD_MV(candidate, ref_frame, ref_sign_bias,
refmv_count, mv_ref_list, Done);
} }
} }
} }
// 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 (prev_mbmi) if (prev_mbmi)
IF_DIFF_REF_FRAME_ADD_MV(prev_mbmi); IF_DIFF_REF_FRAME_ADD_MV(prev_mbmi, ref_frame, ref_sign_bias, refmv_count,
mv_ref_list, Done);
Done: Done:

View File

@@ -158,29 +158,32 @@ static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
// 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
// already in the list. If it's the second motion vector it will also // already in the list. If it's the second motion vector it will also
// skip all additional processing and jump to done! // skip all additional processing and jump to done!
#define ADD_MV_REF_LIST(mv) \ #define ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, Done) \
do { \ do { \
if (refmv_count) { \ if (refmv_count) { \
if ((mv).as_int != mv_ref_list[0].as_int) { \ if ((mv).as_int != (mv_ref_list)[0].as_int) { \
mv_ref_list[refmv_count] = (mv); \ (mv_ref_list)[(refmv_count)] = (mv); \
goto Done; \ goto Done; \
} \ } \
} else { \ } else { \
mv_ref_list[refmv_count++] = (mv); \ (mv_ref_list)[(refmv_count)++] = (mv); \
} \ } \
} while (0) } while (0)
// 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(mbmi) \ #define IF_DIFF_REF_FRAME_ADD_MV(mbmi, ref_frame, ref_sign_bias, refmv_count, \
mv_ref_list, Done) \
do { \ do { \
if (is_inter_block(mbmi)) { \ if (is_inter_block(mbmi)) { \
if ((mbmi)->ref_frame[0] != ref_frame) \ if ((mbmi)->ref_frame[0] != ref_frame) \
ADD_MV_REF_LIST(scale_mv((mbmi), 0, ref_frame, ref_sign_bias)); \ ADD_MV_REF_LIST(scale_mv((mbmi), 0, ref_frame, ref_sign_bias), \
refmv_count, mv_ref_list, Done); \
if (has_second_ref(mbmi) && \ if (has_second_ref(mbmi) && \
(mbmi)->ref_frame[1] != ref_frame && \ (mbmi)->ref_frame[1] != ref_frame && \
(mbmi)->mv[1].as_int != (mbmi)->mv[0].as_int) \ (mbmi)->mv[1].as_int != (mbmi)->mv[0].as_int) \
ADD_MV_REF_LIST(scale_mv((mbmi), 1, ref_frame, ref_sign_bias)); \ ADD_MV_REF_LIST(scale_mv((mbmi), 1, ref_frame, ref_sign_bias), \
refmv_count, mv_ref_list, Done); \
} \ } \
} while (0) } while (0)

View File

@@ -65,7 +65,8 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCKD *xd,
different_ref_found = 1; different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame) if (candidate->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, -1)); ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, -1),
refmv_count, mv_ref_list, Done);
} }
} }
@@ -82,7 +83,7 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCKD *xd,
different_ref_found = 1; different_ref_found = 1;
if (candidate->ref_frame[0] == ref_frame) if (candidate->ref_frame[0] == ref_frame)
ADD_MV_REF_LIST(candidate->mv[0]); ADD_MV_REF_LIST(candidate->mv[0], refmv_count, mv_ref_list, Done);
} }
} }
@@ -97,7 +98,8 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCKD *xd,
* xd->mi_stride].src_mi->mbmi; * xd->mi_stride].src_mi->mbmi;
// If the candidate is INTRA we don't want to consider its mv. // If the candidate is INTRA we don't want to consider its mv.
IF_DIFF_REF_FRAME_ADD_MV(candidate); IF_DIFF_REF_FRAME_ADD_MV(candidate, ref_frame, ref_sign_bias,
refmv_count, mv_ref_list, Done);
} }
} }
} }