Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-05-13 02:17:37 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-05-13 02:17:37 +0400
commit32faec1a53fdc557dd7c74465d9d1d0c0c17cdb0 (patch)
tree60bf3329883052ce7b8cf7ad95c491fdcbf666ae
parent5c2355d3640618084d326e7f09bd83e118251ea9 (diff)
Remplace bunch of annoying ifdefs in tracking.c with a libmv-capi_stub.cc
Makes code in tracking.cc much easier to understand and modify, without worring to breck compulation with Libmv disabled. It is still possible compilation will break due to libmv-capi changes, but that's not happening so much often.
-rw-r--r--extern/CMakeLists.txt5
-rw-r--r--extern/SConscript4
-rw-r--r--extern/libmv/CMakeLists.txt366
-rw-r--r--extern/libmv/SConscript55
-rwxr-xr-xextern/libmv/bundle.sh175
-rw-r--r--extern/libmv/libmv-capi.cc (renamed from extern/libmv/libmv-capi.cpp)0
-rw-r--r--extern/libmv/libmv-capi_stub.cc277
-rw-r--r--source/blender/blenkernel/CMakeLists.txt4
-rw-r--r--source/blender/blenkernel/SConscript2
-rw-r--r--source/blender/blenkernel/intern/tracking.c151
-rw-r--r--source/blenderplayer/CMakeLists.txt2
-rw-r--r--source/creator/CMakeLists.txt2
12 files changed, 610 insertions, 433 deletions
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 941f69e9047..f6de8737fa7 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -29,6 +29,7 @@ remove_strict_flags()
add_subdirectory(colamd)
add_subdirectory(rangetree)
add_subdirectory(wcwidth)
+add_subdirectory(libmv)
if(WITH_BULLET)
if(NOT WITH_SYSTEM_BULLET)
@@ -69,10 +70,6 @@ if(WITH_LZMA)
add_subdirectory(lzma)
endif()
-if(WITH_LIBMV)
- add_subdirectory(libmv)
-endif()
-
if(WITH_MOD_BOOLEAN)
add_subdirectory(carve)
endif()
diff --git a/extern/SConscript b/extern/SConscript
index e2bb1dc1f31..041aa345d79 100644
--- a/extern/SConscript
+++ b/extern/SConscript
@@ -6,6 +6,7 @@ SConscript(['glew/SConscript'])
SConscript(['colamd/SConscript'])
SConscript(['rangetree/SConscript'])
SConscript(['wcwidth/SConscript'])
+SConscript(['libmv/SConscript'])
if env['WITH_BF_GAMEENGINE']:
SConscript(['recastnavigation/SConscript'])
@@ -34,9 +35,6 @@ if env['WITH_BF_LZO']:
if env['WITH_BF_LZMA']:
SConscript(['lzma/SConscript'])
-if env['WITH_BF_LIBMV']:
- SConscript(['libmv/SConscript'])
-
if env['WITH_BF_BOOLEAN']:
SConscript(['carve/SConscript'])
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index 71554795355..a18011fc599 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -28,198 +28,216 @@
set(INC
.
- third_party/ceres/include
-)
-
-set(INC_SYS
- ../Eigen3
- ${PNG_INCLUDE_DIR}
- ${ZLIB_INCLUDE_DIRS}
)
set(SRC
- libmv-capi.cpp
- libmv/image/array_nd.cc
- libmv/image/convolve.cc
- libmv/multiview/conditioning.cc
- libmv/multiview/euclidean_resection.cc
- libmv/multiview/fundamental.cc
- libmv/multiview/homography.cc
- libmv/multiview/panography.cc
- libmv/multiview/projection.cc
- libmv/multiview/triangulation.cc
- libmv/numeric/numeric.cc
- libmv/numeric/poly.cc
- libmv/simple_pipeline/bundle.cc
- libmv/simple_pipeline/camera_intrinsics.cc
- libmv/simple_pipeline/detect.cc
- libmv/simple_pipeline/initialize_reconstruction.cc
- libmv/simple_pipeline/intersect.cc
- libmv/simple_pipeline/modal_solver.cc
- libmv/simple_pipeline/pipeline.cc
- libmv/simple_pipeline/reconstruction.cc
- libmv/simple_pipeline/reconstruction_scale.cc
- libmv/simple_pipeline/resect.cc
- libmv/simple_pipeline/tracks.cc
- libmv/tracking/brute_region_tracker.cc
- libmv/tracking/esm_region_tracker.cc
- libmv/tracking/hybrid_region_tracker.cc
- libmv/tracking/klt_region_tracker.cc
- libmv/tracking/lmicklt_region_tracker.cc
- libmv/tracking/pyramid_region_tracker.cc
- libmv/tracking/retrack_region_tracker.cc
- libmv/tracking/track_region.cc
- libmv/tracking/trklt_region_tracker.cc
-
- third_party/fast/fast_10.c
- third_party/fast/fast_11.c
- third_party/fast/fast_12.c
- third_party/fast/fast_9.c
- third_party/fast/fast.c
- third_party/fast/nonmax.c
- third_party/gflags/gflags.cc
- third_party/gflags/gflags_completions.cc
- third_party/gflags/gflags_reporting.cc
-
libmv-capi.h
- libmv/base/id_generator.h
- libmv/base/scoped_ptr.h
- libmv/base/vector.h
- libmv/base/vector_utils.h
- libmv/image/array_nd.h
- libmv/image/convolve.h
- libmv/image/correlation.h
- libmv/image/image.h
- libmv/image/sample.h
- libmv/image/tuple.h
- libmv/logging/logging.h
- libmv/multiview/conditioning.h
- libmv/multiview/euclidean_resection.h
- libmv/multiview/fundamental.h
- libmv/multiview/homography.h
- libmv/multiview/homography_parameterization.h
- libmv/multiview/nviewtriangulation.h
- libmv/multiview/panography.h
- libmv/multiview/projection.h
- libmv/multiview/resection.h
- libmv/multiview/triangulation.h
- libmv/numeric/dogleg.h
- libmv/numeric/function_derivative.h
- libmv/numeric/levenberg_marquardt.h
- libmv/numeric/numeric.h
- libmv/numeric/poly.h
- libmv/simple_pipeline/bundle.h
- libmv/simple_pipeline/callbacks.h
- libmv/simple_pipeline/camera_intrinsics.h
- libmv/simple_pipeline/detect.h
- libmv/simple_pipeline/initialize_reconstruction.h
- libmv/simple_pipeline/intersect.h
- libmv/simple_pipeline/modal_solver.h
- libmv/simple_pipeline/pipeline.h
- libmv/simple_pipeline/reconstruction.h
- libmv/simple_pipeline/reconstruction_scale.h
- libmv/simple_pipeline/resect.h
- libmv/simple_pipeline/tracks.h
- libmv/tracking/brute_region_tracker.h
- libmv/tracking/esm_region_tracker.h
- libmv/tracking/hybrid_region_tracker.h
- libmv/tracking/klt_region_tracker.h
- libmv/tracking/lmicklt_region_tracker.h
- libmv/tracking/pyramid_region_tracker.h
- libmv/tracking/region_tracker.h
- libmv/tracking/retrack_region_tracker.h
- libmv/tracking/track_region.h
- libmv/tracking/trklt_region_tracker.h
-
- third_party/fast/fast.h
- third_party/gflags/config.h
- third_party/gflags/gflags/gflags_completions.h
- third_party/gflags/gflags/gflags_declare.h
- third_party/gflags/gflags/gflags.h
- third_party/gflags/mutex.h
- third_party/gflags/util.h
- third_party/msinttypes/inttypes.h
- third_party/msinttypes/stdint.h
)
-if(WIN32)
- list(APPEND SRC
- third_party/glog/src/logging.cc
- third_party/glog/src/raw_logging.cc
- third_party/glog/src/utilities.cc
- third_party/glog/src/vlog_is_on.cc
- third_party/glog/src/windows/port.cc
-
- third_party/glog/src/utilities.h
- third_party/glog/src/stacktrace_generic-inl.h
- third_party/glog/src/stacktrace.h
- third_party/glog/src/stacktrace_x86_64-inl.h
- third_party/glog/src/base/googleinit.h
- third_party/glog/src/base/mutex.h
- third_party/glog/src/base/commandlineflags.h
- third_party/glog/src/stacktrace_powerpc-inl.h
- third_party/glog/src/stacktrace_x86-inl.h
- third_party/glog/src/config.h
- third_party/glog/src/stacktrace_libunwind-inl.h
- third_party/glog/src/windows/glog/raw_logging.h
- third_party/glog/src/windows/glog/vlog_is_on.h
- third_party/glog/src/windows/glog/logging.h
- third_party/glog/src/windows/glog/log_severity.h
- third_party/glog/src/windows/port.h
- third_party/glog/src/windows/config.h
+if(WITH_LIBMV)
+ add_definitions(
+ -DWITH_LIBMV
)
list(APPEND INC
- third_party/glog/src/windows
+ third_party/ceres/include
+ )
+
+ set(INC_SYS
+ ../Eigen3
+ ${PNG_INCLUDE_DIR}
+ ${ZLIB_INCLUDE_DIRS}
)
- if(NOT MINGW)
+ list(APPEND SRC
+ libmv-capi.cc
+ libmv/image/array_nd.cc
+ libmv/image/convolve.cc
+ libmv/multiview/conditioning.cc
+ libmv/multiview/euclidean_resection.cc
+ libmv/multiview/fundamental.cc
+ libmv/multiview/homography.cc
+ libmv/multiview/panography.cc
+ libmv/multiview/projection.cc
+ libmv/multiview/triangulation.cc
+ libmv/numeric/numeric.cc
+ libmv/numeric/poly.cc
+ libmv/simple_pipeline/bundle.cc
+ libmv/simple_pipeline/camera_intrinsics.cc
+ libmv/simple_pipeline/detect.cc
+ libmv/simple_pipeline/initialize_reconstruction.cc
+ libmv/simple_pipeline/intersect.cc
+ libmv/simple_pipeline/modal_solver.cc
+ libmv/simple_pipeline/pipeline.cc
+ libmv/simple_pipeline/reconstruction.cc
+ libmv/simple_pipeline/reconstruction_scale.cc
+ libmv/simple_pipeline/resect.cc
+ libmv/simple_pipeline/tracks.cc
+ libmv/tracking/brute_region_tracker.cc
+ libmv/tracking/esm_region_tracker.cc
+ libmv/tracking/hybrid_region_tracker.cc
+ libmv/tracking/klt_region_tracker.cc
+ libmv/tracking/lmicklt_region_tracker.cc
+ libmv/tracking/pyramid_region_tracker.cc
+ libmv/tracking/retrack_region_tracker.cc
+ libmv/tracking/track_region.cc
+ libmv/tracking/trklt_region_tracker.cc
+
+ third_party/fast/fast_10.c
+ third_party/fast/fast_11.c
+ third_party/fast/fast_12.c
+ third_party/fast/fast_9.c
+ third_party/fast/fast.c
+ third_party/fast/nonmax.c
+ third_party/gflags/gflags.cc
+ third_party/gflags/gflags_completions.cc
+ third_party/gflags/gflags_reporting.cc
+
+ libmv/base/id_generator.h
+ libmv/base/scoped_ptr.h
+ libmv/base/vector.h
+ libmv/base/vector_utils.h
+ libmv/image/array_nd.h
+ libmv/image/convolve.h
+ libmv/image/correlation.h
+ libmv/image/image.h
+ libmv/image/sample.h
+ libmv/image/tuple.h
+ libmv/logging/logging.h
+ libmv/multiview/conditioning.h
+ libmv/multiview/euclidean_resection.h
+ libmv/multiview/fundamental.h
+ libmv/multiview/homography.h
+ libmv/multiview/homography_parameterization.h
+ libmv/multiview/nviewtriangulation.h
+ libmv/multiview/panography.h
+ libmv/multiview/projection.h
+ libmv/multiview/resection.h
+ libmv/multiview/triangulation.h
+ libmv/numeric/dogleg.h
+ libmv/numeric/function_derivative.h
+ libmv/numeric/levenberg_marquardt.h
+ libmv/numeric/numeric.h
+ libmv/numeric/poly.h
+ libmv/simple_pipeline/bundle.h
+ libmv/simple_pipeline/callbacks.h
+ libmv/simple_pipeline/camera_intrinsics.h
+ libmv/simple_pipeline/detect.h
+ libmv/simple_pipeline/initialize_reconstruction.h
+ libmv/simple_pipeline/intersect.h
+ libmv/simple_pipeline/modal_solver.h
+ libmv/simple_pipeline/pipeline.h
+ libmv/simple_pipeline/reconstruction.h
+ libmv/simple_pipeline/reconstruction_scale.h
+ libmv/simple_pipeline/resect.h
+ libmv/simple_pipeline/tracks.h
+ libmv/tracking/brute_region_tracker.h
+ libmv/tracking/esm_region_tracker.h
+ libmv/tracking/hybrid_region_tracker.h
+ libmv/tracking/klt_region_tracker.h
+ libmv/tracking/lmicklt_region_tracker.h
+ libmv/tracking/pyramid_region_tracker.h
+ libmv/tracking/region_tracker.h
+ libmv/tracking/retrack_region_tracker.h
+ libmv/tracking/track_region.h
+ libmv/tracking/trklt_region_tracker.h
+
+ third_party/fast/fast.h
+ third_party/gflags/config.h
+ third_party/gflags/gflags/gflags_completions.h
+ third_party/gflags/gflags/gflags_declare.h
+ third_party/gflags/gflags/gflags.h
+ third_party/gflags/mutex.h
+ third_party/gflags/util.h
+ third_party/msinttypes/inttypes.h
+ third_party/msinttypes/stdint.h
+ )
+
+ if(WIN32)
+ list(APPEND SRC
+ third_party/glog/src/logging.cc
+ third_party/glog/src/raw_logging.cc
+ third_party/glog/src/utilities.cc
+ third_party/glog/src/vlog_is_on.cc
+ third_party/glog/src/windows/port.cc
+
+ third_party/glog/src/utilities.h
+ third_party/glog/src/stacktrace_generic-inl.h
+ third_party/glog/src/stacktrace.h
+ third_party/glog/src/stacktrace_x86_64-inl.h
+ third_party/glog/src/base/googleinit.h
+ third_party/glog/src/base/mutex.h
+ third_party/glog/src/base/commandlineflags.h
+ third_party/glog/src/stacktrace_powerpc-inl.h
+ third_party/glog/src/stacktrace_x86-inl.h
+ third_party/glog/src/config.h
+ third_party/glog/src/stacktrace_libunwind-inl.h
+ third_party/glog/src/windows/glog/raw_logging.h
+ third_party/glog/src/windows/glog/vlog_is_on.h
+ third_party/glog/src/windows/glog/logging.h
+ third_party/glog/src/windows/glog/log_severity.h
+ third_party/glog/src/windows/port.h
+ third_party/glog/src/windows/config.h
+ )
+
+ list(APPEND INC
+ third_party/glog/src/windows
+ )
+
+ if(NOT MINGW)
+ list(APPEND INC
+ third_party/msinttypes
+ )
+ endif()
+ else()
+ list(APPEND SRC
+ third_party/glog/src/demangle.cc
+ third_party/glog/src/logging.cc
+ third_party/glog/src/raw_logging.cc
+ third_party/glog/src/signalhandler.cc
+ third_party/glog/src/symbolize.cc
+ third_party/glog/src/utilities.cc
+ third_party/glog/src/vlog_is_on.cc
+
+ third_party/glog/src/base/commandlineflags.h
+ third_party/glog/src/base/googleinit.h
+ third_party/glog/src/base/mutex.h
+ third_party/glog/src/config_freebsd.h
+ third_party/glog/src/config.h
+ third_party/glog/src/config_hurd.h
+ third_party/glog/src/config_linux.h
+ third_party/glog/src/config_mac.h
+ third_party/glog/src/demangle.h
+ third_party/glog/src/glog/logging.h
+ third_party/glog/src/glog/log_severity.h
+ third_party/glog/src/glog/raw_logging.h
+ third_party/glog/src/glog/vlog_is_on.h
+ third_party/glog/src/stacktrace_generic-inl.h
+ third_party/glog/src/stacktrace.h
+ third_party/glog/src/stacktrace_libunwind-inl.h
+ third_party/glog/src/stacktrace_powerpc-inl.h
+ third_party/glog/src/stacktrace_x86_64-inl.h
+ third_party/glog/src/stacktrace_x86-inl.h
+ third_party/glog/src/symbolize.h
+ third_party/glog/src/utilities.h
+ )
+
list(APPEND INC
- third_party/msinttypes
+ third_party/glog/src
)
endif()
+
+ add_definitions(
+ -DGOOGLE_GLOG_DLL_DECL=
+ )
else()
list(APPEND SRC
- third_party/glog/src/demangle.cc
- third_party/glog/src/logging.cc
- third_party/glog/src/raw_logging.cc
- third_party/glog/src/signalhandler.cc
- third_party/glog/src/symbolize.cc
- third_party/glog/src/utilities.cc
- third_party/glog/src/vlog_is_on.cc
-
- third_party/glog/src/base/commandlineflags.h
- third_party/glog/src/base/googleinit.h
- third_party/glog/src/base/mutex.h
- third_party/glog/src/config_freebsd.h
- third_party/glog/src/config.h
- third_party/glog/src/config_hurd.h
- third_party/glog/src/config_linux.h
- third_party/glog/src/config_mac.h
- third_party/glog/src/demangle.h
- third_party/glog/src/glog/logging.h
- third_party/glog/src/glog/log_severity.h
- third_party/glog/src/glog/raw_logging.h
- third_party/glog/src/glog/vlog_is_on.h
- third_party/glog/src/stacktrace_generic-inl.h
- third_party/glog/src/stacktrace.h
- third_party/glog/src/stacktrace_libunwind-inl.h
- third_party/glog/src/stacktrace_powerpc-inl.h
- third_party/glog/src/stacktrace_x86_64-inl.h
- third_party/glog/src/stacktrace_x86-inl.h
- third_party/glog/src/symbolize.h
- third_party/glog/src/utilities.h
- )
-
- list(APPEND INC
- third_party/glog/src
+ libmv-capi_stub.cc
)
endif()
-add_definitions(
- -DGOOGLE_GLOG_DLL_DECL=
-)
-
blender_add_lib(extern_libmv "${SRC}" "${INC}" "${INC_SYS}")
-add_subdirectory(third_party)
+if(WITH_LIBMV)
+ add_subdirectory(third_party)
+endif()
diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript
index d0015db42d7..ec616ff2adf 100644
--- a/extern/libmv/SConscript
+++ b/extern/libmv/SConscript
@@ -11,32 +11,37 @@ Import('env')
defs = []
-defs.append('GOOGLE_GLOG_DLL_DECL=')
-
-src = env.Glob("*.cpp")
-src += env.Glob('libmv/image/*.cc')
-src += env.Glob('libmv/multiview/*.cc')
-src += env.Glob('libmv/numeric/*.cc')
-src += env.Glob('libmv/simple_pipeline/*.cc')
-src += env.Glob('libmv/tracking/*.cc')
-src += env.Glob('third_party/fast/*.c')
-src += env.Glob('third_party/gflags/*.cc')
-
-incs = '. ../Eigen3 third_party/ceres/include'
-incs += ' ' + env['BF_PNG_INC']
-incs += ' ' + env['BF_ZLIB_INC']
-
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
- incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
- if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
- incs += ' ./third_party/msinttypes'
-
- src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
- src += ['./third_party/glog/src/windows/port.cc']
+if env['WITH_BF_LIBMV']:
+ defs.append('GOOGLE_GLOG_DLL_DECL=')
+ defs.append('WITH_LIBMV')
+
+ src = env.Glob("libmv-capi.cc")
+ src += env.Glob('libmv/image/*.cc')
+ src += env.Glob('libmv/multiview/*.cc')
+ src += env.Glob('libmv/numeric/*.cc')
+ src += env.Glob('libmv/simple_pipeline/*.cc')
+ src += env.Glob('libmv/tracking/*.cc')
+ src += env.Glob('third_party/fast/*.c')
+ src += env.Glob('third_party/gflags/*.cc')
+
+ incs = '. ../Eigen3 third_party/ceres/include'
+ incs += ' ' + env['BF_PNG_INC']
+ incs += ' ' + env['BF_ZLIB_INC']
+
+ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
+ incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
+ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+ incs += ' ./third_party/msinttypes'
+
+ src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
+ src += ['./third_party/glog/src/windows/port.cc']
+ else:
+ src += env.Glob("third_party/glog/src/*.cc")
+ incs += ' ./third_party/glog/src'
else:
- src += env.Glob("third_party/glog/src/*.cc")
- incs += ' ./third_party/glog/src'
+ src = env.Glob("libmv-capi_stub.cc")
env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] )
-SConscript(['third_party/SConscript'])
+if env['WITH_BF_LIBMV']:
+ SConscript(['third_party/SConscript'])
diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh
index a9edfde55bf..4a52cf2fd18 100755
--- a/extern/libmv/bundle.sh
+++ b/extern/libmv/bundle.sh
@@ -38,17 +38,17 @@ rm -rf $tmp
chmod 664 ./third_party/glog/src/windows/*.cc ./third_party/glog/src/windows/*.h ./third_party/glog/src/windows/glog/*.h
-sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | sort -d`
-headers=`find ./libmv -type f -iname '*.h' | sed -r 's/^\.\//\t/' | sort -d`
+sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t\t/' | sort -d`
+headers=`find ./libmv -type f -iname '*.h' | sed -r 's/^\.\//\t\t/' | sort -d`
-third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | grep -v ceres | sed -r 's/^\.\//\t/' | sort -d`
-third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | grep -v ceres | sed -r 's/^\.\//\t/' | sort -d`
+third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d`
+third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d`
-third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort -d`
-third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort -d`
+third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t\t/' | sort -d`
+third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t\t/' | sort -d`
-src_dir=`find ./libmv -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort -d | uniq`
-src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | grep -v ceres | sed -r 's/^\.\//\t/' | sort -d | uniq`
+src_dir=`find ./libmv -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t\t/' | sort -d | uniq`
+src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d | uniq`
src=""
win_src=""
for x in $src_dir $src_third_dir; do
@@ -59,12 +59,12 @@ for x in $src_dir $src_third_dir; do
fi
if stat $x/*.cpp > /dev/null 2>&1; then
- t="src += env.Glob('`echo $x'/*.cpp'`')"
+ t=" src += env.Glob('`echo $x'/*.cpp'`')"
fi
if stat $x/*.c > /dev/null 2>&1; then
if [ -z "$t" ]; then
- t="src += env.Glob('`echo $x'/*.c'`')"
+ t=" src += env.Glob('`echo $x'/*.c'`')"
else
t="$t + env.Glob('`echo $x'/*.c'`')"
fi
@@ -72,7 +72,7 @@ for x in $src_dir $src_third_dir; do
if stat $x/*.cc > /dev/null 2>&1; then
if [ -z "$t" ]; then
- t="src += env.Glob('`echo $x'/*.cc'`')"
+ t=" src += env.Glob('`echo $x'/*.cc'`')"
else
t="$t + env.Glob('`echo $x'/*.cc'`')"
fi
@@ -124,82 +124,100 @@ cat > CMakeLists.txt << EOF
set(INC
.
- third_party/ceres/include
)
-set(INC_SYS
- ../Eigen3
- \${PNG_INCLUDE_DIR}
- \${ZLIB_INCLUDE_DIRS}
+set(SRC
+ libmv-capi.h
)
-set(SRC
- libmv-capi.cpp
+if(WITH_LIBMV)
+ add_definitions(
+ -DWITH_LIBMV
+ )
+
+ list(APPEND INC
+ third_party/ceres/include
+ )
+
+ set(INC_SYS
+ ../Eigen3
+ \${PNG_INCLUDE_DIR}
+ \${ZLIB_INCLUDE_DIRS}
+ )
+
+ list(APPEND SRC
+ libmv-capi.cc
${sources}
${third_sources}
- libmv-capi.h
${headers}
${third_headers}
-)
-
-if(WIN32)
- list(APPEND SRC
- third_party/glog/src/logging.cc
- third_party/glog/src/raw_logging.cc
- third_party/glog/src/utilities.cc
- third_party/glog/src/vlog_is_on.cc
- third_party/glog/src/windows/port.cc
-
- third_party/glog/src/utilities.h
- third_party/glog/src/stacktrace_generic-inl.h
- third_party/glog/src/stacktrace.h
- third_party/glog/src/stacktrace_x86_64-inl.h
- third_party/glog/src/base/googleinit.h
- third_party/glog/src/base/mutex.h
- third_party/glog/src/base/commandlineflags.h
- third_party/glog/src/stacktrace_powerpc-inl.h
- third_party/glog/src/stacktrace_x86-inl.h
- third_party/glog/src/config.h
- third_party/glog/src/stacktrace_libunwind-inl.h
- third_party/glog/src/windows/glog/raw_logging.h
- third_party/glog/src/windows/glog/vlog_is_on.h
- third_party/glog/src/windows/glog/logging.h
- third_party/glog/src/windows/glog/log_severity.h
- third_party/glog/src/windows/port.h
- third_party/glog/src/windows/config.h
)
- list(APPEND INC
- third_party/glog/src/windows
- )
+ if(WIN32)
+ list(APPEND SRC
+ third_party/glog/src/logging.cc
+ third_party/glog/src/raw_logging.cc
+ third_party/glog/src/utilities.cc
+ third_party/glog/src/vlog_is_on.cc
+ third_party/glog/src/windows/port.cc
+
+ third_party/glog/src/utilities.h
+ third_party/glog/src/stacktrace_generic-inl.h
+ third_party/glog/src/stacktrace.h
+ third_party/glog/src/stacktrace_x86_64-inl.h
+ third_party/glog/src/base/googleinit.h
+ third_party/glog/src/base/mutex.h
+ third_party/glog/src/base/commandlineflags.h
+ third_party/glog/src/stacktrace_powerpc-inl.h
+ third_party/glog/src/stacktrace_x86-inl.h
+ third_party/glog/src/config.h
+ third_party/glog/src/stacktrace_libunwind-inl.h
+ third_party/glog/src/windows/glog/raw_logging.h
+ third_party/glog/src/windows/glog/vlog_is_on.h
+ third_party/glog/src/windows/glog/logging.h
+ third_party/glog/src/windows/glog/log_severity.h
+ third_party/glog/src/windows/port.h
+ third_party/glog/src/windows/config.h
+ )
- if(NOT MINGW)
list(APPEND INC
- third_party/msinttypes
+ third_party/glog/src/windows
)
- endif()
-else()
- list(APPEND SRC
+
+ if(NOT MINGW)
+ list(APPEND INC
+ third_party/msinttypes
+ )
+ endif()
+ else()
+ list(APPEND SRC
${third_glog_sources}
${third_glog_headers}
- )
+ )
- list(APPEND INC
- third_party/glog/src
+ list(APPEND INC
+ third_party/glog/src
+ )
+ endif()
+
+ add_definitions(
+ -DGOOGLE_GLOG_DLL_DECL=
+ )
+else()
+ list(APPEND SRC
+ libmv-capi_stub.cc
)
endif()
-add_definitions(
- -DGOOGLE_GLOG_DLL_DECL=
-)
-
blender_add_lib(extern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}")
-add_subdirectory(third_party)
+if(WITH_LIBMV)
+ add_subdirectory(third_party)
+endif()
EOF
cat > SConscript << EOF
@@ -216,27 +234,32 @@ Import('env')
defs = []
-defs.append('GOOGLE_GLOG_DLL_DECL=')
+if env['WITH_BF_LIBMV']:
+ defs.append('GOOGLE_GLOG_DLL_DECL=')
+ defs.append('WITH_LIBMV')
-src = env.Glob("*.cpp")
+ src = env.Glob("libmv-capi.cc")
$src
-incs = '. ../Eigen3 third_party/ceres/include'
-incs += ' ' + env['BF_PNG_INC']
-incs += ' ' + env['BF_ZLIB_INC']
+ incs = '. ../Eigen3 third_party/ceres/include'
+ incs += ' ' + env['BF_PNG_INC']
+ incs += ' ' + env['BF_ZLIB_INC']
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
- incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
- if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
- incs += ' ./third_party/msinttypes'
+ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
+ incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
+ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+ incs += ' ./third_party/msinttypes'
${win_src}
- src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
- src += ['./third_party/glog/src/windows/port.cc']
+ src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
+ src += ['./third_party/glog/src/windows/port.cc']
+ else:
+ src += env.Glob("third_party/glog/src/*.cc")
+ incs += ' ./third_party/glog/src'
else:
- src += env.Glob("third_party/glog/src/*.cc")
- incs += ' ./third_party/glog/src'
+ src = env.Glob("libmv-capi_stub.cc")
env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] )
-SConscript(['third_party/SConscript'])
+if env['WITH_BF_LIBMV']:
+ SConscript(['third_party/SConscript'])
EOF
diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cc
index 4aa8093aba9..4aa8093aba9 100644
--- a/extern/libmv/libmv-capi.cpp
+++ b/extern/libmv/libmv-capi.cc
diff --git a/extern/libmv/libmv-capi_stub.cc b/extern/libmv/libmv-capi_stub.cc
new file mode 100644
index 00000000000..5f6df585c8b
--- /dev/null
+++ b/extern/libmv/libmv-capi_stub.cc
@@ -0,0 +1,277 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef WITH_LIBMV
+
+#include "libmv-capi.h"
+
+#include <cstdlib>
+#include <cstring>
+
+/* ************ Logging ************ */
+
+void libmv_initLogging(const char * /*argv0*/)
+{
+}
+
+void libmv_startDebugLogging(void)
+{
+}
+
+void libmv_setLoggingVerbosity(int /*verbosity*/)
+{
+}
+
+/* ************ Planar tracker ************ */
+
+/* TrackRegion (new planar tracker) */
+int libmv_trackRegion(const struct libmv_trackRegionOptions * /*options*/,
+ const float * /*image1*/, int /*image1_width*/, int /*image1_height*/,
+ const float * /*image2*/, int /*image2_width*/, int /*image2_height*/,
+ const double *x1, const double *y1,
+ struct libmv_trackRegionResult *result,
+ double *x2, double *y2)
+{
+ /* Convert to doubles for the libmv api. The four corners and the center. */
+ for (int i = 0; i < 5; ++i) {
+ x2[i] = x1[i];
+ y2[i] = y1[i];
+ }
+
+ result->termination = -1;
+ result->termination_reason = "Built without libmv support";
+ result->correlation = 0.0;
+
+ return false;
+}
+
+void libmv_samplePlanarPatch(const float *image, int width, int height,
+ int channels, const double *xs, const double *ys,
+ int num_samples_x, int num_samples_y,
+ const float *mask, float *patch,
+ double *warped_position_x, double *warped_position_y)
+{
+ /* TODO(sergey): implement */
+}
+
+/* ************ Tracks ************ */
+
+libmv_Tracks *libmv_tracksNew(void) {
+ return NULL;
+}
+
+void libmv_tracksInsert(struct libmv_Tracks * /*libmv_tracks*/, int /*image*/,
+ int /*track*/, double /*x*/, double /*y*/)
+{
+}
+
+void libmv_tracksDestroy(libmv_Tracks * /*libmv_tracks*/)
+{
+}
+
+/* ************ Reconstruction solver ************ */
+
+libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks * /*libmv_tracks*/,
+ libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
+ libmv_reconstructionOptions * /*libmv_reconstruction_options*/,
+ reconstruct_progress_update_cb /*progress_update_callback*/,
+ void * /*callback_customdata*/)
+{
+ return NULL;
+}
+
+struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks * /*libmv_tracks*/,
+ libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
+ libmv_reconstructionOptions * /*libmv_reconstruction_options*/,
+ reconstruct_progress_update_cb /*progress_update_callback*/,
+ void * /*callback_customdata*/)
+{
+ return NULL;
+}
+
+int libmv_reporojectionPointForTrack(libmv_Reconstruction * /*libmv_reconstruction*/,
+ int /*track*/, double /*pos*/[3])
+{
+ return 0;
+}
+
+double libmv_reporojectionErrorForTrack(libmv_Reconstruction * /*libmv_reconstruction*/, int /*track*/)
+{
+ return 0.0;
+}
+
+double libmv_reporojectionErrorForImage(libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/)
+{
+ return 0.0;
+}
+
+int libmv_reporojectionCameraForImage(libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/,
+ double /*mat*/[4][4])
+{
+ return 0;
+}
+
+double libmv_reprojectionError(libmv_Reconstruction * /*libmv_reconstruction*/)
+{
+ return 0.0;
+}
+
+void libmv_destroyReconstruction(libmv_Reconstruction * /*libmv_reconstruction*/)
+{
+}
+
+/* ************ feature detector ************ */
+
+struct libmv_Features *libmv_detectFeaturesFAST(unsigned char * /*data*/,
+ int /*width*/, int /*height*/, int /*stride*/,
+ int /*margin*/, int /*min_trackness*/, int /*min_distance*/)
+{
+ return NULL;
+}
+
+struct libmv_Features *libmv_detectFeaturesMORAVEC(unsigned char * /*data*/,
+ int /*width*/, int /*height*/, int /*stride*/,
+ int /*margin*/, int /*count*/, int /*min_distance*/)
+{
+ return NULL;
+}
+
+int libmv_countFeatures(struct libmv_Features * /*libmv_features*/)
+{
+ return 0;
+}
+
+void libmv_getFeature(struct libmv_Features * /*libmv_features*/, int /*number*/,
+ double *x, double *y, double *score, double *size)
+{
+ *x = 0.0;
+ *y = 0.0;
+ *score = 0.0;
+ *size = 0.0;
+}
+
+void libmv_destroyFeatures(struct libmv_Features * /*libmv_features*/)
+{
+}
+
+/* ************ camera intrinsics ************ */
+
+struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics(
+ struct libmv_Reconstruction * /*libmv_Reconstruction*/)
+{
+ return NULL;
+}
+
+struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNewEmpty(void)
+{
+ return NULL;
+}
+
+struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/)
+{
+ return NULL;
+}
+
+struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/)
+{
+ return NULL;
+}
+
+void libmv_CameraIntrinsicsDestroy(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/)
+{
+}
+
+void libmv_CameraIntrinsicsUpdate(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/,
+ libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/)
+{
+}
+
+void libmv_CameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, int /*threads*/)
+{
+}
+
+void libmv_CameraIntrinsicsExtract(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, double * focal_length,
+ double * principal_x, double *principal_y, double *k1, double *k2, double *k3,
+ int *width, int *height)
+{
+ *focal_length = 1.0;
+ *principal_x = 0.0;
+ *principal_y = 0.0;
+ *k1 = 0.0;
+ *k2 = 0.0;
+ *width = 0.0;
+ *height = 0.0;
+}
+
+void libmv_CameraIntrinsicsUndistortByte(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/,
+ unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels)
+{
+ memcpy(dst, src, channels * width * height * sizeof(unsigned char));
+}
+
+void libmv_CameraIntrinsicsUndistortFloat(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/,
+ float *src, float *dst, int width, int height, float overscan, int channels)
+{
+ memcpy(dst, src, channels * width * height * sizeof(float));
+}
+
+void libmv_CameraIntrinsicsDistortByte(struct libmv_CameraIntrinsics *libmvIntrinsics,
+ unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels)
+{
+ memcpy(dst, src, channels * width * height * sizeof(unsigned char));
+}
+
+void libmv_CameraIntrinsicsDistortFloat(struct libmv_CameraIntrinsics *libmvIntrinsics,
+ float *src, float *dst, int width, int height, float overscan, int channels)
+{
+ memcpy(dst, src, channels * width * height * sizeof(float));
+}
+
+/* ************ utils ************ */
+
+void libmv_ApplyCameraIntrinsics(libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+ double x, double y, double *x1, double *y1)
+{
+ double focal_length = libmv_camera_intrinsics_options->focal_length;
+ double principal_x = libmv_camera_intrinsics_options->principal_point_x;
+ double principal_y = libmv_camera_intrinsics_options->principal_point_y;
+
+ *x1 = x * focal_length + principal_x;
+ *y1 = y * focal_length + principal_y;
+}
+
+void libmv_InvertCameraIntrinsics(libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options,
+ double x, double y, double *x1, double *y1)
+{
+ double focal_length = libmv_camera_intrinsics_options->focal_length;
+ double principal_x = libmv_camera_intrinsics_options->principal_point_x;
+ double principal_y = libmv_camera_intrinsics_options->principal_point_y;
+
+ *x1 = (x - principal_x) / focal_length;
+ *y1 = (y - principal_y) / focal_length;
+}
+
+#endif // ifndef WITH_LIBMV
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 716b76114fa..67f8f6b4f55 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -44,6 +44,7 @@ set(INC
../../../intern/opennl/extern
../../../intern/raskter
../../../intern/smoke/extern
+ ../../../extern/libmv
# XXX - BAD LEVEL CALL WM_api.h
../windowmanager
@@ -412,9 +413,6 @@ if(WITH_GAMEENGINE)
endif()
if(WITH_LIBMV)
- list(APPEND INC
- ../../../extern/libmv
- )
add_definitions(-DWITH_LIBMV)
endif()
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index c21cd168874..fb2ed4b6c07 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -50,6 +50,7 @@ incs += ' #/intern/mikktspace'
incs += ' #/intern/audaspace/intern'
incs += ' #/intern/ffmpeg'
incs += ' #/intern/raskter'
+incs += ' #/extern/libmv'
incs += ' ' + env['BF_OPENGL_INC']
incs += ' ' + env['BF_ZLIB_INC']
@@ -138,7 +139,6 @@ else:
sources.remove('intern' + os.sep + 'navmesh_conversion.c')
if env['WITH_BF_LIBMV']:
- incs += ' #/extern/libmv'
defs.append('WITH_LIBMV')
if env['WITH_BF_FFTW3']:
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 71a7697bfc2..17fc696b771 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -64,11 +64,7 @@
#include "raskter.h"
-#ifdef WITH_LIBMV
-# include "libmv-capi.h"
-#else
-struct libmv_Features;
-#endif
+#include "libmv-capi.h"
typedef struct MovieDistortion {
struct libmv_CameraIntrinsics *intrinsics;
@@ -343,7 +339,6 @@ static void get_search_origin_frame_pixel(int frame_width, int frame_height,
frame_pixel[1] = (int)frame_pixel[1];
}
-#ifdef WITH_LIBMV
static void pixel_to_unified(int frame_width, int frame_height, const float pixel_coords[2], float unified_coords[2])
{
unified_coords[0] = pixel_coords[0] / frame_width;
@@ -438,7 +433,6 @@ static void set_marker_coords_from_tracking(int frame_width, int frame_height, M
marker->pos[0] += marker_unified[0];
marker->pos[1] += marker_unified[1];
}
-#endif
/*********************** clipboard *************************/
@@ -1540,7 +1534,6 @@ void BKE_tracking_camera_get_reconstructed_interpolate(MovieTracking *tracking,
/*********************** Distortion/Undistortion *************************/
-#ifdef WITH_LIBMV
static void cameraIntrinscisOptionsFromTracking(libmv_cameraIntrinsicsOptions *camera_intrinsics_options,
MovieTracking *tracking, int calibration_width, int calibration_height)
{
@@ -1559,7 +1552,6 @@ static void cameraIntrinscisOptionsFromTracking(libmv_cameraIntrinsicsOptions *c
camera_intrinsics_options->image_width = calibration_width;
camera_intrinsics_options->image_height = (double) (calibration_height * aspy);
}
-#endif
MovieDistortion *BKE_tracking_distortion_new(void)
{
@@ -1567,9 +1559,7 @@ MovieDistortion *BKE_tracking_distortion_new(void)
distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
-#ifdef WITH_LIBMV
distortion->intrinsics = libmv_CameraIntrinsicsNewEmpty();
-#endif
return distortion;
}
@@ -1577,29 +1567,17 @@ MovieDistortion *BKE_tracking_distortion_new(void)
void BKE_tracking_distortion_update(MovieDistortion *distortion, MovieTracking *tracking,
int calibration_width, int calibration_height)
{
-#ifdef WITH_LIBMV
libmv_cameraIntrinsicsOptions camera_intrinsics_options;
cameraIntrinscisOptionsFromTracking(&camera_intrinsics_options, tracking,
calibration_width, calibration_height);
libmv_CameraIntrinsicsUpdate(distortion->intrinsics, &camera_intrinsics_options);
-#else
- (void) distortion;
- (void) tracking;
- (void) calibration_width;
- (void) calibration_height;
-#endif
}
void BKE_tracking_distortion_set_threads(MovieDistortion *distortion, int threads)
{
-#ifdef WITH_LIBMV
libmv_CameraIntrinsicsSetThreads(distortion->intrinsics, threads);
-#else
- (void) distortion;
- (void) threads;
-#endif
}
MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion)
@@ -1608,11 +1586,7 @@ MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion)
new_distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
-#ifdef WITH_LIBMV
new_distortion->intrinsics = libmv_CameraIntrinsicsCopy(distortion->intrinsics);
-#else
- (void) distortion;
-#endif
return new_distortion;
}
@@ -1626,7 +1600,6 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
resibuf = IMB_dupImBuf(ibuf);
-#ifdef WITH_LIBMV
if (ibuf->rect_float) {
if (undistort) {
libmv_CameraIntrinsicsUndistortFloat(distortion->intrinsics,
@@ -1654,22 +1627,13 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
ibuf->x, ibuf->y, overscan, ibuf->channels);
}
}
-#else
- (void) overscan;
- (void) undistort;
-
- if (ibuf->rect_float && ibuf->rect)
- imb_freerectImBuf(ibuf);
-#endif
return resibuf;
}
void BKE_tracking_distortion_free(MovieDistortion *distortion)
{
-#ifdef WITH_LIBMV
libmv_CameraIntrinsicsDestroy(distortion->intrinsics);
-#endif
MEM_freeN(distortion);
}
@@ -1678,7 +1642,6 @@ void BKE_tracking_distort_v2(MovieTracking *tracking, const float co[2], float r
{
MovieTrackingCamera *camera = &tracking->camera;
-#ifdef WITH_LIBMV
libmv_cameraIntrinsicsOptions camera_intrinsics_options;
double x, y;
float aspy = 1.0f / tracking->camera.pixel_aspect;
@@ -1694,18 +1657,12 @@ void BKE_tracking_distort_v2(MovieTracking *tracking, const float co[2], float r
/* result is in image coords already */
r_co[0] = x;
r_co[1] = y;
-#else
- (void) camera;
- (void) co;
- zero_v2(r_co);
-#endif
}
void BKE_tracking_undistort_v2(MovieTracking *tracking, const float co[2], float r_co[2])
{
MovieTrackingCamera *camera = &tracking->camera;
-#ifdef WITH_LIBMV
libmv_cameraIntrinsicsOptions camera_intrinsics_options;
double x = co[0], y = co[1];
float aspy = 1.0f / tracking->camera.pixel_aspect;
@@ -1716,11 +1673,6 @@ void BKE_tracking_undistort_v2(MovieTracking *tracking, const float co[2], float
r_co[0] = (float)x * camera->focal + camera->principal[0];
r_co[1] = (float)y * camera->focal + camera->principal[1] * aspy;
-#else
- (void) camera;
- (void) co;
- zero_v2(r_co);
-#endif
}
ImBuf *BKE_tracking_undistort_frame(MovieTracking *tracking, ImBuf *ibuf, int calibration_width,
@@ -1822,7 +1774,6 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea
int from_anchor, int use_mask, int num_samples_x, int num_samples_y,
float pos[2])
{
-#ifdef WITH_LIBMV
ImBuf *pattern_ibuf;
double src_pixel_x[5], src_pixel_y[5];
double warped_position_x, warped_position_y;
@@ -1880,30 +1831,6 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea
}
return pattern_ibuf;
-#else
- ImBuf *pattern_ibuf;
-
- /* real sampling requires libmv, but areas are supposing pattern would be
- * sampled if search area does exists, so we'll need to create empty
- * pattern area here to prevent adding NULL-checks all over just to deal
- * with situation when libmv is disabled
- */
-
- (void) frame_width;
- (void) frame_height;
- (void) search_ibuf;
- (void) marker;
- (void) from_anchor;
- (void) track;
- (void) use_mask;
-
- pattern_ibuf = IMB_allocImBuf(num_samples_x, num_samples_y, 32, IB_rectfloat);
-
- pos[0] = num_samples_x / 2.0f;
- pos[1] = num_samples_y / 2.0f;
-
- return pattern_ibuf;
-#endif
}
ImBuf *BKE_tracking_get_pattern_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker,
@@ -2232,7 +2159,6 @@ static void tracks_map_free(TracksMap *map, void (*customdata_free)(void *custom
/*********************** 2D tracking *************************/
typedef struct TrackContext {
-#ifdef WITH_LIBMV
/* the reference marker and cutout search area */
MovieTrackingMarker reference_marker;
@@ -2243,9 +2169,6 @@ typedef struct TrackContext {
int framenr;
float *mask;
-#else
- int pad;
-#endif
} TrackContext;
typedef struct MovieTrackingContext {
@@ -2267,16 +2190,11 @@ static void track_context_free(void *customdata)
{
TrackContext *track_context = (TrackContext *)customdata;
-#ifdef WITH_LIBMV
if (track_context->search_area)
MEM_freeN(track_context->search_area);
if (track_context->mask)
MEM_freeN(track_context->mask);
-
-#else
- (void)track_context;
-#endif
}
/* Create context for motion 2D tracking, copies all data needed
@@ -2402,7 +2320,6 @@ void BKE_tracking_context_sync_user(const MovieTrackingContext *context, MovieCl
user->framenr = context->sync_frame;
}
-#ifdef WITH_LIBMV
/* **** utility functions for tracking **** */
/* convert from float and byte RGBA to grayscale. Supports different coefficients for RGB. */
@@ -2778,7 +2695,6 @@ static bool configure_and_run_tracker(ImBuf *destination_ibuf, MovieTrackingTrac
return tracked;
}
-#endif
/* Track all the tracks from context one more frame,
* returns FALSe if nothing was tracked.
@@ -2821,7 +2737,6 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
marker = BKE_tracking_marker_get_exact(track, curfra);
if (marker && (marker->flag & MARKER_DISABLED) == 0) {
-#ifdef WITH_LIBMV
bool tracked = false, need_readjust;
double dst_pixel_x[5], dst_pixel_y[5];
@@ -2857,10 +2772,6 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
}
ok = true;
-#else
- (void)frame_height;
- (void)frame_width;
-#endif
}
}
@@ -2879,7 +2790,6 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
*/
void BKE_tracking_refine_marker(MovieClip *clip, MovieTrackingTrack *track, MovieTrackingMarker *marker, int backwards)
{
-#ifdef WITH_LIBMV
MovieTrackingMarker *reference_marker = NULL;
ImBuf *reference_ibuf, *destination_ibuf;
float *search_area, *mask = NULL;
@@ -2941,24 +2851,17 @@ void BKE_tracking_refine_marker(MovieClip *clip, MovieTrackingTrack *track, Movi
MEM_freeN(mask);
IMB_freeImBuf(reference_ibuf);
IMB_freeImBuf(destination_ibuf);
-#else
- (void) clip;
- (void) track;
- (void) marker;
- (void) backwards;
-#endif
}
/*********************** Camera solving *************************/
typedef struct MovieReconstructContext {
-#ifdef WITH_LIBMV
struct libmv_Tracks *tracks;
int keyframe1, keyframe2;
short refine_flags;
struct libmv_Reconstruction *reconstruction;
-#endif
+
char object_name[MAX_NAME];
int is_camera;
short motion_flag;
@@ -2987,7 +2890,6 @@ typedef struct ReconstructProgressData {
int message_size;
} ReconstructProgressData;
-#ifdef WITH_LIBMV
/* Create mew libmv Tracks structure from blender's tracks list. */
static struct libmv_Tracks *libmv_tracks_new(ListBase *tracksbase, int width, int height)
{
@@ -3219,13 +3121,11 @@ static int reconstruct_count_tracks_on_both_keyframes(MovieTracking *tracking, M
return tot;
}
-#endif
/* Perform early check on whether everything is fine to start reconstruction. */
int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObject *object,
char *error_msg, int error_size)
{
-#ifdef WITH_LIBMV
if (tracking->settings.motion_flag & TRACKING_MOTION_MODAL) {
/* TODO: check for number of tracks? */
return TRUE;
@@ -3238,15 +3138,12 @@ int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObje
return FALSE;
}
- return TRUE;
-#else
+#ifndef WITH_LIBMV
BLI_strncpy(error_msg, N_("Blender is compiled without motion tracking library"), error_size);
-
- (void) tracking;
- (void) object;
-
- return 0;
+ return FALSE;
#endif
+
+ return TRUE;
}
/* Create context for camera/object motion reconstruction.
@@ -3317,17 +3214,10 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
context->sfra = sfra;
context->efra = efra;
-#ifdef WITH_LIBMV
context->tracks = libmv_tracks_new(tracksbase, width, height * aspy);
context->keyframe1 = keyframe1;
context->keyframe2 = keyframe2;
context->refine_flags = reconstruct_refine_intrinsics_get_flags(tracking, object);
-#else
- (void) width;
- (void) height;
- (void) keyframe1;
- (void) keyframe2;
-#endif
return context;
}
@@ -3335,19 +3225,16 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
/* Free memory used by a reconstruction process. */
void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context)
{
-#ifdef WITH_LIBMV
if (context->reconstruction)
libmv_destroyReconstruction(context->reconstruction);
libmv_tracksDestroy(context->tracks);
-#endif
tracks_map_free(context->tracks_map, NULL);
MEM_freeN(context);
}
-#ifdef WITH_LIBMV
/* Callback which is called from libmv side to update progress in the interface. */
static void reconstruct_update_solve_cb(void *customdata, double progress, const char *message)
{
@@ -3390,7 +3277,6 @@ static void reconstructionOptionsFromContext(libmv_reconstructionOptions *recons
reconstruction_options->success_threshold = context->success_threshold;
reconstruction_options->use_fallback_reconstruction = context->use_fallback_reconstruction;
}
-#endif
/* Solve camera/object motion and reconstruct 3D markers position
* from a prepared reconstruction context.
@@ -3404,7 +3290,6 @@ static void reconstructionOptionsFromContext(libmv_reconstructionOptions *recons
void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *stop, short *do_update,
float *progress, char *stats_message, int message_size)
{
-#ifdef WITH_LIBMV
float error;
ReconstructProgressData progressdata;
@@ -3437,14 +3322,6 @@ void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *
error = libmv_reprojectionError(context->reconstruction);
context->reprojection_error = error;
-#else
- (void) context;
- (void) stop;
- (void) do_update;
- (void) progress;
- (void) stats_message;
- (void) message_size;
-#endif
}
/* Finish reconstruction process by copying reconstructed data
@@ -3470,17 +3347,14 @@ int BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieTr
reconstruction->error = context->reprojection_error;
reconstruction->flag |= TRACKING_RECONSTRUCTED;
-#ifdef WITH_LIBMV
if (!reconstruct_retrieve_libmv(context, tracking))
return FALSE;
-#endif
return TRUE;
}
/*********************** Feature detection *************************/
-#ifdef WITH_LIBMV
/* Check whether point is inside grease pencil stroke. */
static bool check_point_in_stroke(bGPDstroke *stroke, float x, float y)
{
@@ -3594,14 +3468,12 @@ static unsigned char *detect_get_frame_ucharbuf(ImBuf *ibuf)
return pixels;
}
-#endif
/* Detect features using FAST detector */
void BKE_tracking_detect_fast(MovieTracking *tracking, ListBase *tracksbase, ImBuf *ibuf,
int framenr, int margin, int min_trackness, int min_distance, bGPDlayer *layer,
int place_outside_layer)
{
-#ifdef WITH_LIBMV
struct libmv_Features *features;
unsigned char *pixels = detect_get_frame_ucharbuf(ibuf);
@@ -3615,17 +3487,6 @@ void BKE_tracking_detect_fast(MovieTracking *tracking, ListBase *tracksbase, ImB
place_outside_layer ? true : false);
libmv_destroyFeatures(features);
-#else
- (void) tracking;
- (void) tracksbase;
- (void) ibuf;
- (void) framenr;
- (void) margin;
- (void) min_trackness;
- (void) min_distance;
- (void) layer;
- (void) place_outside_layer;
-#endif
}
/*********************** 2D stabilization *************************/
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index c775f7d3279..51f98e625c6 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -151,6 +151,7 @@ endif()
bf_intern_opennl
extern_rangetree
extern_wcwidth
+ extern_libmv
)
if(WITH_MOD_CLOTH_ELTOPO)
@@ -166,7 +167,6 @@ endif()
endif()
if(WITH_LIBMV)
- list(APPEND BLENDER_SORTED_LIBS extern_libmv)
list(APPEND BLENDER_SORTED_LIBS extern_ceres)
endif()
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index d5407fe38a2..0350de5870c 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -932,6 +932,7 @@ endif()
bf_intern_opencolorio
extern_rangetree
extern_wcwidth
+ extern_libmv
)
if(WITH_COMPOSITOR)
@@ -941,7 +942,6 @@ endif()
endif()
if(WITH_LIBMV)
- list(APPEND BLENDER_SORTED_LIBS extern_libmv)
list(APPEND BLENDER_SORTED_LIBS extern_ceres)
endif()