Commit 8da6d9d7 authored by David Barker's avatar David Barker Committed by Debargha Mukherjee

Fix a bug with global-motion + ref-mv

av1_find_mv_refs sets the ALL_ZERO flag when either (a) we don't have
enough candidate MVs, or (b) all candidate MVs are zero. With global
motion enabled, case (b) does not work as intended and causes two
problems: a significant quality decrease for foreman_cif.y4m, and
test failures in *CpuSpeedTest*Screencast*.

This patch skips check (b) when global motion is enabled, fixing
the above bugs.

Change-Id: I7461588cb02733563c1439f430b89190299a1b5d
parent 9e218747
......@@ -743,7 +743,10 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
find_mv_refs_sync sync, void *const data,
int16_t *mode_context) {
#if CONFIG_REF_MV
int idx, all_zero = 1;
#if !CONFIG_GLOBAL_MOTION
int idx;
#endif
int all_zero = 1;
#endif
#if CONFIG_EXT_INTER
av1_update_mv_context(xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col,
......@@ -766,6 +769,9 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
setup_ref_mv_list(cm, xd, ref_frame, ref_mv_count, ref_mv_stack, mv_ref_list,
-1, mi_row, mi_col, mode_context);
#if CONFIG_GLOBAL_MOTION
if ((*ref_mv_count >= 2) || (ref_frame <= ALTREF_FRAME)) all_zero = 0;
#else
if (*ref_mv_count >= 2) {
for (idx = 0; idx < AOMMIN(3, *ref_mv_count); ++idx) {
if (ref_mv_stack[idx].this_mv.as_int != 0) all_zero = 0;
......@@ -776,6 +782,7 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
for (idx = 0; idx < MAX_MV_REF_CANDIDATES; ++idx)
if (mv_ref_list[idx].as_int != 0) all_zero = 0;
}
#endif
if (all_zero) mode_context[ref_frame] |= (1 << ALL_ZERO_FLAG_OFFSET);
#endif
......
......@@ -9899,10 +9899,6 @@ PALETTE_EXIT:
) {
int8_t ref_frame_type = av1_ref_frame_type(best_mbmode.ref_frame);
int16_t mode_ctx = mbmi_ext->mode_context[ref_frame_type];
#if !CONFIG_EXT_INTER
if (best_mbmode.ref_frame[1] > NONE)
mode_ctx &= (mbmi_ext->mode_context[best_mbmode.ref_frame[1]] | 0x00ff);
#endif // !CONFIG_EXT_INTER
if (mode_ctx & (1 << ALL_ZERO_FLAG_OFFSET)) {
best_mbmode.mode = ZEROMV;
......
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