Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-10-20 16:08:51 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-10-20 16:08:51 +0400
commite9d5e9813c5cce45f14bb25bb82f2e88f5688351 (patch)
treeba63074682d55b5ca2b1109cca58891f6d226e34 /source
parent30a2d7fe8572791947f5fe3b94b9735bfab83166 (diff)
Code cleanup: added generic function copt_m3_m3d
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/tracking.c21
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h3
-rw-r--r--source/blender/blenlib/intern/math_matrix.c16
3 files changed, 21 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index c7fea98d7cf..3c2eca1a157 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -3263,23 +3263,6 @@ static int point_markers_correspondences_on_both_image(MovieTrackingPlaneTrack *
return correspondence_index;
}
-/* TODO(sergey): Make it generic function available for everyone. */
-BLI_INLINE void mat3f_from_mat3d(float mat_float[3][3], double mat_double[3][3])
-{
- /* Keep it stupid simple for better data flow in CPU. */
- mat_float[0][0] = mat_double[0][0];
- mat_float[0][1] = mat_double[0][1];
- mat_float[0][2] = mat_double[0][2];
-
- mat_float[1][0] = mat_double[1][0];
- mat_float[1][1] = mat_double[1][1];
- mat_float[1][2] = mat_double[1][2];
-
- mat_float[2][0] = mat_double[2][0];
- mat_float[2][1] = mat_double[2][1];
- mat_float[2][2] = mat_double[2][2];
-}
-
/* NOTE: frame number should be in clip space, not scene space */
static void track_plane_from_existing_motion(MovieTrackingPlaneTrack *plane_track, int start_frame,
int direction, bool retrack)
@@ -3341,7 +3324,7 @@ static void track_plane_from_existing_motion(MovieTrackingPlaneTrack *plane_trac
libmv_homography2DFromCorrespondencesEuc(x1, x2, num_correspondences, H_double);
- mat3f_from_mat3d(H, H_double);
+ copt_m3_m3d(H, H_double);
for (i = 0; i < 4; i++) {
float vec[3] = {0.0f, 0.0f, 1.0f}, vec2[3];
@@ -3445,7 +3428,7 @@ void BKE_tracking_homography_between_two_quads(/*const*/ float reference_corners
libmv_homography2DFromCorrespondencesEuc(x1, x2, 4, H_double);
- mat3f_from_mat3d(H, H_double);
+ copt_m3_m3d(H, H_double);
}
/*********************** Camera solving *************************/
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 7db2227dfaf..cb0d95301fb 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -60,6 +60,9 @@ void copy_m4_m4(float R[4][4], float A[4][4]);
void copy_m3_m4(float R[3][3], float A[4][4]);
void copy_m4_m3(float R[4][4], float A[3][3]);
+/* double->float */
+void copt_m3_m3d(float R[3][3], double A[3][3]);
+
void swap_m3m3(float A[3][3], float B[3][3]);
void swap_m4m4(float A[4][4], float B[4][4]);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 6b96f0515b9..2cda4425d8e 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -112,6 +112,22 @@ void copy_m4_m3(float m1[4][4], float m2[3][3]) /* no clear */
}
+void copt_m3_m3d(float R[3][3], double A[3][3])
+{
+ /* Keep it stupid simple for better data flow in CPU. */
+ R[0][0] = A[0][0];
+ R[0][1] = A[0][1];
+ R[0][2] = A[0][2];
+
+ R[1][0] = A[1][0];
+ R[1][1] = A[1][1];
+ R[1][2] = A[1][2];
+
+ R[2][0] = A[2][0];
+ R[2][1] = A[2][1];
+ R[2][2] = A[2][2];
+}
+
void swap_m3m3(float m1[3][3], float m2[3][3])
{
float t;