### Avoid useless computations when determinant is 0

`Change-Id: I8b9fcb995116068fdaed26f3a7b084b154ea3bc1`
parent 316a6235
 ... @@ -1166,15 +1166,9 @@ static int find_affine_int(int np, const int *pts1, const int *pts2, ... @@ -1166,15 +1166,9 @@ static int find_affine_int(int np, const int *pts1, const int *pts2, assert(By >= LS_MAT_MIN && By <= LS_MAT_MAX); assert(By >= LS_MAT_MIN && By <= LS_MAT_MAX); assert(By >= LS_MAT_MIN && By <= LS_MAT_MAX); assert(By >= LS_MAT_MIN && By <= LS_MAT_MAX); int64_t Px, Py, Det; int64_t Det; int16_t iDet, shift; int16_t iDet, shift; // These divided by the Det, are the least squares solutions Px = (int64_t)A * Bx - (int64_t)A * Bx; Px = -(int64_t)A * Bx + (int64_t)A * Bx; Py = (int64_t)A * By - (int64_t)A * By; Py = -(int64_t)A * By + (int64_t)A * By; // Compute Determinant of A // Compute Determinant of A Det = (int64_t)A * A - (int64_t)A * A; Det = (int64_t)A * A - (int64_t)A * A; if (Det == 0) return 1; if (Det == 0) return 1; ... @@ -1185,6 +1179,14 @@ static int find_affine_int(int np, const int *pts1, const int *pts2, ... @@ -1185,6 +1179,14 @@ static int find_affine_int(int np, const int *pts1, const int *pts2, shift = 0; shift = 0; } } int64_t Px, Py; // These divided by the Det, are the least squares solutions Px = (int64_t)A * Bx - (int64_t)A * Bx; Px = -(int64_t)A * Bx + (int64_t)A * Bx; Py = (int64_t)A * By - (int64_t)A * By; Py = -(int64_t)A * By + (int64_t)A * By; wm->wmmat = get_mult_shift_diag(Px, iDet, shift); wm->wmmat = get_mult_shift_diag(Px, iDet, shift); wm->wmmat = get_mult_shift_ndiag(Px, iDet, shift); wm->wmmat = get_mult_shift_ndiag(Px, iDet, shift); wm->wmmat = get_mult_shift_ndiag(Py, iDet, shift); wm->wmmat = get_mult_shift_ndiag(Py, iDet, shift); ... ...
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