Commit 3464aff4 authored by Sarah Parker's avatar Sarah Parker

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
parent 3c7aa7ce
......@@ -562,3 +562,30 @@ void vp10_warp_plane(WarpedMotionParams *wm,
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");
}
}
......@@ -62,4 +62,8 @@ void vp10_warp_plane(WarpedMotionParams *wm,
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
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