Revision: 42378
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42378
Author:   keir
Date:     2011-12-03 23:30:11 +0000 (Sat, 03 Dec 2011)
Log Message:
-----------
Add a fix for compiling the brute force region tracker from libmv on Mac OS X.

Modified Paths:
--------------
    branches/soc-2011-tomato/extern/libmv/libmv/tracking/brute_region_tracker.cc

Modified: 
branches/soc-2011-tomato/extern/libmv/libmv/tracking/brute_region_tracker.cc
===================================================================
--- 
branches/soc-2011-tomato/extern/libmv/libmv/tracking/brute_region_tracker.cc    
    2011-12-03 23:05:35 UTC (rev 42377)
+++ 
branches/soc-2011-tomato/extern/libmv/libmv/tracking/brute_region_tracker.cc    
    2011-12-03 23:30:11 UTC (rev 42378)
@@ -24,7 +24,14 @@
 #include <emmintrin.h>
 #endif
 
-#include <malloc.h> // For memalign.
+#ifndef __APPLE__
+// Needed for memalign on Linux and _aligned_alloc on Windows.
+#include <malloc.h>
+#else
+// Apple's malloc is 16-byte aligned, and does not have malloc.h, so include
+// stdilb instead.
+#include <cstdlib>
+#endif
 
 #include "libmv/image/image.h"
 #include "libmv/image/convolve.h"
@@ -38,7 +45,12 @@
 void *aligned_malloc(int size, int alignment) {
 #ifdef _WIN32
   return _aligned_malloc(size, alignment);
-#else  // TODO(keir): Will this work on Mac OS X?
+#elif __APPLE__
+  // On Mac OS X, both the heap and the stack are guaranteed 16-byte aligned so
+  // they work natively with SSE types with no further work.
+  CHECK_EQ(alignment, 16);
+  return malloc(size);
+#else // This is for Linux.
   return memalign(alignment, size);
 #endif
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to