[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42378] branches/soc-2011-tomato/extern/ libmv/libmv/tracking/brute_region_tracker.cc: Add a fix for compiling the brute force region tracker from libmv on Mac OS X .

Keir Mierle mierle at gmail.com
Sun Dec 4 00:30:15 CET 2011


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
 }




More information about the Bf-blender-cvs mailing list