diff c/optical-flow.cpp @ 230:bc4ea09b1743

compatibility modifications for visual studio compilation
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 29 Jun 2012 16:15:13 -0400
parents 3ead4bcd001c
children
line wrap: on
line diff
--- a/c/optical-flow.cpp	Wed May 16 02:23:49 2012 -0400
+++ b/c/optical-flow.cpp	Fri Jun 29 16:15:13 2012 -0400
@@ -7,6 +7,25 @@
 #include <iostream>
 #include <ctime>
 
+/* MSVC does not have lrintf */
+#ifdef _MSC_VER
+static inline long lrintf(float f){
+/* x64 does not supported embedded assembly */
+#ifdef _M_X64
+    return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
+#else
+    int i;
+ 
+    _asm{
+        fld f
+        fistp i
+    };
+ 
+    return i;
+#endif
+}
+#endif
+
 using namespace std;
 
 void videoTiming(CvCapture* inputVideo) {