Commit 2d234c6b authored by Yaowu Xu's avatar Yaowu Xu

misc-fix: clamp MVs before find_ref_mvs()

This commit merge the fix that adds clamping to motion vectors before
they are added to list of MVs in find_ref_mvs().

Related tracking issue:
https://bugs.chromium.org/p/webm/issues/detail?id=1012
Original libvpx commit:
293e20df

Change-Id: I6916a321f374f521187aae96d87bcfd2954db629
parent b989fd00
......@@ -509,11 +509,6 @@ static void find_mv_refs_idx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type] << 3;
const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type] << 3;
#if !CONFIG_MISC_FIXES
// Blank the reference vector list
memset(mv_ref_list, 0, sizeof(*mv_ref_list) * MAX_MV_REF_CANDIDATES);
#endif
// The nearest 2 blocks are treated differently
// if the size < 8x8 we get the mv from the bmi substructure,
// and we also need to keep a mode count.
......@@ -627,14 +622,8 @@ Done:
if (mode_context)
mode_context[ref_frame] = counter_to_context[context_counter];
#if CONFIG_MISC_FIXES
for (i = refmv_count; i < MAX_MV_REF_CANDIDATES; ++i)
mv_ref_list[i].as_int = 0;
#else
// Clamp vectors
for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i)
clamp_mv_ref(&mv_ref_list[i].as_mv, bw, bh, xd);
#endif
}
void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
......
......@@ -252,13 +252,7 @@ static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
return mv;
}
#if CONFIG_MISC_FIXES
#define CLIP_IN_ADD(mv, bw, bh, xd) clamp_mv_ref(mv, bw, bh, xd)
#else
#define CLIP_IN_ADD(mv, bw, bh, xd) \
do { \
} while (0)
#endif
// 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
......
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