A few fixes for global motion

Handles a rare divisin by 0 case.
Also adds a check on global motion parameters to disable
if the parameters obtained are outside the range that the
shear supports. This fixes a rare assert failure.
Also changes the recode loop threshold somewhat.

Change-Id: I4c6e74b914ac653cd9caa0563d78b0a19a2a8627
diff --git a/av1/encoder/ransac.c b/av1/encoder/ransac.c
index 44dc7f5..198bc39 100644
--- a/av1/encoder/ransac.c
+++ b/av1/encoder/ransac.c
@@ -454,7 +454,7 @@
     msqe += sqrt(p[0] * p[0] + p[1] * p[1]);
   }
   msqe /= n;
-  scale = sqrt(2) / msqe;
+  scale = (msqe == 0 ? 1.0 : sqrt(2) / msqe);
   T[0] = scale;
   T[1] = 0;
   T[2] = -scale * mean[0];