diff options
Diffstat (limited to 'extern/libmv/libmv/tracking/brute_region_tracker.cc')
-rw-r--r-- | extern/libmv/libmv/tracking/brute_region_tracker.cc | 55 |
1 files changed, 3 insertions, 52 deletions
diff --git a/extern/libmv/libmv/tracking/brute_region_tracker.cc b/extern/libmv/libmv/tracking/brute_region_tracker.cc index 234aaa6ed00..4a2aef63a96 100644 --- a/extern/libmv/libmv/tracking/brute_region_tracker.cc +++ b/extern/libmv/libmv/tracking/brute_region_tracker.cc @@ -21,27 +21,10 @@ #include "libmv/tracking/brute_region_tracker.h" #ifdef __SSE2__ -#include <emmintrin.h> -#endif - -#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) -// Needed for memalign on Linux and _aligned_alloc on Windows. -#ifdef FREE_WINDOWS -/* make sure _aligned_malloc is included */ -#ifdef __MSVCRT_VERSION__ -#undef __MSVCRT_VERSION__ -#endif - -#define __MSVCRT_VERSION__ 0x0700 -#endif - -#include <malloc.h> -#else -// Apple's malloc is 16-byte aligned, and does not have malloc.h, so include -// stdilb instead. -#include <cstdlib> +# include <emmintrin.h> #endif +#include "libmv/base/aligned_malloc.h" #include "libmv/image/image.h" #include "libmv/image/convolve.h" #include "libmv/image/correlation.h" @@ -51,37 +34,6 @@ namespace libmv { namespace { -// TODO(keir): It's stupid that this is needed here. Push this somewhere else. -void *aligned_malloc(int size, int alignment) { -#ifdef _WIN32 - return _aligned_malloc(size, alignment); -#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); -#elif defined(__FreeBSD__) || defined(__NetBSD__) - void *result; - - if (posix_memalign(&result, alignment, size)) { - // non-zero means allocation error - // either no allocation or bad alignment value - return NULL; - } - return result; -#else // This is for Linux. - return memalign(alignment, size); -#endif -} - -void aligned_free(void *ptr) { -#ifdef _WIN32 - _aligned_free(ptr); -#else - free(ptr); -#endif -} - bool RegionIsInBounds(const FloatImage &image1, double x, double y, int half_window_size) { @@ -364,8 +316,7 @@ bool BruteRegionTracker::Track(const FloatImage &image1, // for sanity. double correlation = PearsonProductMomentCorrelation( image_and_gradient1_sampled, - image_and_gradient2_sampled, - pattern_width); + image_and_gradient2_sampled); LG << "Final correlation: " << correlation; |