[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60868] trunk/blender/source/blender: Code cleanup: added generic function copt_m3_m3d
Sergey Sharybin
sergey.vfx at gmail.com
Sun Oct 20 14:08:52 CEST 2013
Revision: 60868
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60868
Author: nazgul
Date: 2013-10-20 12:08:51 +0000 (Sun, 20 Oct 2013)
Log Message:
-----------
Code cleanup: added generic function copt_m3_m3d
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/tracking.c
trunk/blender/source/blender/blenlib/BLI_math_matrix.h
trunk/blender/source/blender/blenlib/intern/math_matrix.c
Modified: trunk/blender/source/blender/blenkernel/intern/tracking.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/tracking.c 2013-10-20 10:13:19 UTC (rev 60867)
+++ trunk/blender/source/blender/blenkernel/intern/tracking.c 2013-10-20 12:08:51 UTC (rev 60868)
@@ -3263,23 +3263,6 @@
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 @@
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 @@
libmv_homography2DFromCorrespondencesEuc(x1, x2, 4, H_double);
- mat3f_from_mat3d(H, H_double);
+ copt_m3_m3d(H, H_double);
}
/*********************** Camera solving *************************/
Modified: trunk/blender/source/blender/blenlib/BLI_math_matrix.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_matrix.h 2013-10-20 10:13:19 UTC (rev 60867)
+++ trunk/blender/source/blender/blenlib/BLI_math_matrix.h 2013-10-20 12:08:51 UTC (rev 60868)
@@ -60,6 +60,9 @@
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]);
Modified: trunk/blender/source/blender/blenlib/intern/math_matrix.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_matrix.c 2013-10-20 10:13:19 UTC (rev 60867)
+++ trunk/blender/source/blender/blenlib/intern/math_matrix.c 2013-10-20 12:08:51 UTC (rev 60868)
@@ -112,6 +112,22 @@
}
+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;
More information about the Bf-blender-cvs
mailing list