Commit 7d2109e5 authored by Yue Chen's avatar Yue Chen

Use fast warping algorithm for warped motion mode

Disable warped motion mode when the model parameters are out of the
range of the new interpolation algorithm.
Performance: 1.1% lowres (was 1.2%)

Change-Id: I947ce3fd07e0d574d66333c1a729e85ba0294b4a
parent 61dca1fd
......@@ -1723,6 +1723,7 @@ int find_homography(const int np, double *pts1, double *pts2, double *mat) {
return 0;
}
#if CONFIG_WARPED_MOTION
int find_projection(const int np, double *pts1, double *pts2,
WarpedMotionParams *wm_params) {
double H[9];
......@@ -1734,7 +1735,33 @@ int find_projection(const int np, double *pts1, double *pts2,
case HOMOGRAPHY: result = find_homography(np, pts1, pts2, H); break;
default: assert(0 && "Invalid warped motion type!"); return 1;
}
if (result == 0) av1_integerize_model(H, wm_params->wmtype, wm_params);
if (result == 0) {
av1_integerize_model(H, wm_params->wmtype, wm_params);
if (wm_params->wmtype == ROTZOOM) {
wm_params->wmmat[5] = wm_params->wmmat[2];
wm_params->wmmat[4] = -wm_params->wmmat[3];
}
}
if (wm_params->wmtype == AFFINE || wm_params->wmtype == ROTZOOM) {
// check compatibility with the fast warp filter
int32_t *mat = wm_params->wmmat;
int32_t alpha, beta, gamma, delta;
if (mat[2] == 0) return 1;
alpha = mat[2] - (1 << WARPEDMODEL_PREC_BITS);
beta = mat[3];
gamma = ((int64_t)mat[4] << WARPEDMODEL_PREC_BITS) / mat[2];
delta = mat[5] - (((int64_t)mat[3] * mat[4] + (mat[2] / 2)) / mat[2]) -
(1 << WARPEDMODEL_PREC_BITS);
if ((4 * abs(alpha) + 7 * abs(beta) > (1 << WARPEDMODEL_PREC_BITS)) ||
(4 * abs(gamma) + 7 * abs(delta) > (1 << WARPEDMODEL_PREC_BITS))) {
return 1;
}
}
return result;
}
#endif // CONFIG_WARPED_MOTION
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