Add integerize function back in warped_motion.c

This function was previously unused and removed in
I6bc740e778658d6f81ca54888fc6fa822d3b5ee0. I am adding it back in
with previously suggested fixes.

Change-Id: Iee0afb39170d25895b11d07e71843eae6913efd1
diff --git a/vp10/common/warped_motion.c b/vp10/common/warped_motion.c
index 59999f7..7d5b7a2 100644
--- a/vp10/common/warped_motion.c
+++ b/vp10/common/warped_motion.c
@@ -562,3 +562,30 @@
                p_height, p_stride, subsampling_x, subsampling_y, x_scale,
                y_scale);
 }
+
+void vp10_integerize_model(const double *model, TransformationType wmtype,
+                           WarpedMotionParams *wm) {
+  wm->wmtype = wmtype;
+  switch (wmtype) {
+    case HOMOGRAPHY:
+      assert(fabs(model[8] - 1.0) < 1e-12);
+      wm->wmmat[7] =
+          (int)lrint(model[7] * (1 << WARPEDMODEL_ROW3HOMO_PREC_BITS));
+      wm->wmmat[6] =
+          (int)lrint(model[6] * (1 << WARPEDMODEL_ROW3HOMO_PREC_BITS));
+    /* fallthrough intended */
+    case AFFINE:
+      wm->wmmat[5] = (int)lrint(model[5] * (1 << WARPEDMODEL_PREC_BITS));
+      wm->wmmat[4] = (int)lrint(model[4] * (1 << WARPEDMODEL_PREC_BITS));
+    /* fallthrough intended */
+    case ROTZOOM:
+      wm->wmmat[3] = (int)lrint(model[3] * (1 << WARPEDMODEL_PREC_BITS));
+      wm->wmmat[2] = (int)lrint(model[2] * (1 << WARPEDMODEL_PREC_BITS));
+    /* fallthrough intended */
+    case TRANSLATION:
+      wm->wmmat[1] = (int)lrint(model[1] * (1 << WARPEDMODEL_PREC_BITS));
+      wm->wmmat[0] = (int)lrint(model[0] * (1 << WARPEDMODEL_PREC_BITS));
+      break;
+    default: assert(0 && "Invalid TransformationType");
+  }
+}
diff --git a/vp10/common/warped_motion.h b/vp10/common/warped_motion.h
index a9b53a5..3e566b6 100644
--- a/vp10/common/warped_motion.h
+++ b/vp10/common/warped_motion.h
@@ -62,4 +62,8 @@
                      uint8_t *pred, int p_col, int p_row, int p_width,
                      int p_height, int p_stride, int subsampling_x,
                      int subsampling_y, int x_scale, int y_scale);
+
+// Integerize model into the WarpedMotionParams structure
+void vp10_integerize_model(const double *model, TransformationType wmtype,
+                           WarpedMotionParams *wm);
 #endif  // VP10_COMMON_WARPED_MOTION_H