From e0b7151138afc8f36e61d83b9c907fa20cb5d5be Mon Sep 17 00:00:00 2001
From: David Barker <david.barker@argondesign.com>
Date: Fri, 3 Feb 2017 11:07:56 +0000
Subject: [PATCH] Fix compile error for global-motion without ref-mv

The reference frame handling in av1_find_mv_refs introduced
in https://aomedia-review.googlesource.com/c/6067/ broke the
compile when global-motion is enabled but ref-mv is not.
This patch adds the missing logic, allowing this case to compile
again.

Change-Id: I914887eb56d28a700b2917d086447bdbb314f35d
---
 av1/common/mvref_common.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index f83f98d387..39a8cb43cd 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -874,10 +874,10 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
   int_mv zeromv[2];
 #if CONFIG_REF_MV
   int idx, all_zero = 1;
-#endif
 #if CONFIG_GLOBAL_MOTION
   MV_REFERENCE_FRAME rf[2];
 #endif
+#endif
 #if CONFIG_EXT_INTER
   av1_update_mv_context(xd, mi, ref_frame, mv_ref_list, -1, mi_row, mi_col,
 #if CONFIG_REF_MV
@@ -888,6 +888,7 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
 #endif  // CONFIG_EXT_INTER
 
 #if CONFIG_GLOBAL_MOTION
+#if CONFIG_REF_MV
   av1_set_ref_frame(rf, ref_frame);
   zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[rf[0]],
                                           cm->allow_high_precision_mv)
@@ -897,9 +898,15 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
                                                 cm->allow_high_precision_mv)
                                .as_int
                          : 0;
+#else
+  zeromv[0].as_int = gm_get_motion_vector(&cm->global_motion[ref_frame],
+                                          cm->allow_high_precision_mv)
+                         .as_int;
+  zeromv[1].as_int = 0;
+#endif  // CONFIG_REF_MV
 #else
   zeromv[0].as_int = zeromv[1].as_int = 0;
-#endif
+#endif  // CONFIG_GLOBAL_MOTION
 
 #if CONFIG_REF_MV
   if (ref_frame <= ALTREF_FRAME)
-- 
GitLab