forked from bartvdbraak/blender
Fix #34299: Motion Tracking 20x slower under Windows
Root of the issue goes to SSBA library which didn't work properly when using optimization in MSVC. It was worked around by disabling optimization for libmv, which is in fact shame and shouldn't have been done. It seems after some changes optimization does not affect on SSBA code, but enabling optimization could be risky so close to release. For now solved by splitting SSBA to separate CMake/SCons library, disabling optimization only for this particular library and enabling optimization for rest of libmv. Tested on all files which used to fail with optimization enabled in SSBA and all of them works the same as before. Tracking speed is significantly higher now. After release we'll enable optimization for SSBA as well, so there'll be no crappy build setup. Later we'll replace old SSBA library with new BA code based on Ceres. Bundle script would be broken for until then, so better not to use it.
This commit is contained in:
parent
5d04d06d76
commit
1f88ee6213
21
extern/libmv/CMakeLists.txt
vendored
21
extern/libmv/CMakeLists.txt
vendored
@ -26,8 +26,6 @@
|
|||||||
# If you're doing changes in this file, please update template
|
# If you're doing changes in this file, please update template
|
||||||
# in that script too
|
# in that script too
|
||||||
|
|
||||||
add_subdirectory(third_party)
|
|
||||||
|
|
||||||
set(INC
|
set(INC
|
||||||
.
|
.
|
||||||
../colamd/Include
|
../colamd/Include
|
||||||
@ -86,8 +84,6 @@ set(SRC
|
|||||||
third_party/gflags/gflags_completions.cc
|
third_party/gflags/gflags_completions.cc
|
||||||
third_party/gflags/gflags_reporting.cc
|
third_party/gflags/gflags_reporting.cc
|
||||||
third_party/ldl/Source/ldl.c
|
third_party/ldl/Source/ldl.c
|
||||||
third_party/ssba/Geometry/v3d_metricbundle.cpp
|
|
||||||
third_party/ssba/Math/v3d_optimization.cpp
|
|
||||||
|
|
||||||
libmv-capi.h
|
libmv-capi.h
|
||||||
libmv/base/id_generator.h
|
libmv/base/id_generator.h
|
||||||
@ -148,13 +144,6 @@ set(SRC
|
|||||||
third_party/ldl/Include/ldl.h
|
third_party/ldl/Include/ldl.h
|
||||||
third_party/msinttypes/inttypes.h
|
third_party/msinttypes/inttypes.h
|
||||||
third_party/msinttypes/stdint.h
|
third_party/msinttypes/stdint.h
|
||||||
third_party/ssba/Geometry/v3d_cameramatrix.h
|
|
||||||
third_party/ssba/Geometry/v3d_distortion.h
|
|
||||||
third_party/ssba/Geometry/v3d_metricbundle.h
|
|
||||||
third_party/ssba/Math/v3d_linear.h
|
|
||||||
third_party/ssba/Math/v3d_linear_utils.h
|
|
||||||
third_party/ssba/Math/v3d_mathutilities.h
|
|
||||||
third_party/ssba/Math/v3d_optimization.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
@ -193,14 +182,6 @@ if(WIN32)
|
|||||||
third_party/msinttypes
|
third_party/msinttypes
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
set(MSVC_OFLAGS O1 O2 Ox)
|
|
||||||
foreach(FLAG ${MSVC_OFLAGS})
|
|
||||||
string(REPLACE "${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
|
||||||
string(REPLACE "${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
list(APPEND SRC
|
list(APPEND SRC
|
||||||
third_party/glog/src/demangle.cc
|
third_party/glog/src/demangle.cc
|
||||||
@ -245,3 +226,5 @@ add_definitions(
|
|||||||
)
|
)
|
||||||
|
|
||||||
blender_add_lib(extern_libmv "${SRC}" "${INC}" "${INC_SYS}")
|
blender_add_lib(extern_libmv "${SRC}" "${INC}" "${INC_SYS}")
|
||||||
|
|
||||||
|
add_subdirectory(third_party)
|
||||||
|
21
extern/libmv/SConscript
vendored
21
extern/libmv/SConscript
vendored
@ -11,10 +11,6 @@ Import('env')
|
|||||||
|
|
||||||
defs = []
|
defs = []
|
||||||
|
|
||||||
cflags_libmv = Split(env['CFLAGS'])
|
|
||||||
ccflags_libmv = Split(env['CCFLAGS'])
|
|
||||||
cxxflags_libmv = Split(env['CXXFLAGS'])
|
|
||||||
|
|
||||||
defs.append('V3DLIB_ENABLE_SUITESPARSE')
|
defs.append('V3DLIB_ENABLE_SUITESPARSE')
|
||||||
defs.append('GOOGLE_GLOG_DLL_DECL=')
|
defs.append('GOOGLE_GLOG_DLL_DECL=')
|
||||||
|
|
||||||
@ -27,8 +23,6 @@ src += env.Glob('libmv/tracking/*.cc')
|
|||||||
src += env.Glob('third_party/fast/*.c')
|
src += env.Glob('third_party/fast/*.c')
|
||||||
src += env.Glob('third_party/gflags/*.cc')
|
src += env.Glob('third_party/gflags/*.cc')
|
||||||
src += env.Glob('third_party/ldl/Source/*.c')
|
src += env.Glob('third_party/ldl/Source/*.c')
|
||||||
src += env.Glob('third_party/ssba/Geometry/*.cpp')
|
|
||||||
src += env.Glob('third_party/ssba/Math/*.cpp')
|
|
||||||
|
|
||||||
incs = '. ../Eigen3 third_party/ceres/include'
|
incs = '. ../Eigen3 third_party/ceres/include'
|
||||||
incs += ' ' + env['BF_PNG_INC']
|
incs += ' ' + env['BF_PNG_INC']
|
||||||
@ -41,19 +35,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
|
|||||||
|
|
||||||
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/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/windows/port.cc']
|
||||||
|
|
||||||
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
|
||||||
cflags_libmv.append('/Od')
|
|
||||||
ccflags_libmv.append('/Od')
|
|
||||||
cxxflags_libmv.append('/Od')
|
|
||||||
|
|
||||||
if not env['BF_DEBUG']:
|
|
||||||
defs.append('NDEBUG')
|
|
||||||
else:
|
|
||||||
if not env['BF_DEBUG']:
|
|
||||||
cflags_libmv += Split(env['REL_CFLAGS'])
|
|
||||||
ccflags_libmv += Split(env['REL_CCFLAGS'])
|
|
||||||
cxxflags_libmv += Split(env['REL_CXXFLAGS'])
|
|
||||||
else:
|
else:
|
||||||
src += env.Glob("third_party/glog/src/*.cc")
|
src += env.Glob("third_party/glog/src/*.cc")
|
||||||
incs += ' ./third_party/glog/src'
|
incs += ' ./third_party/glog/src'
|
||||||
@ -64,6 +45,6 @@ else:
|
|||||||
|
|
||||||
incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'
|
incs += ' ./third_party/ssba ./third_party/ldl/Include ../colamd/Include'
|
||||||
|
|
||||||
env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_libmv, cc_compileflags=ccflags_libmv, cxx_compileflags=cxxflags_libmv )
|
env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] )
|
||||||
|
|
||||||
SConscript(['third_party/SConscript'])
|
SConscript(['third_party/SConscript'])
|
||||||
|
1
extern/libmv/third_party/CMakeLists.txt
vendored
1
extern/libmv/third_party/CMakeLists.txt
vendored
@ -1,2 +1,3 @@
|
|||||||
|
|
||||||
|
add_subdirectory(ssba)
|
||||||
add_subdirectory(ceres)
|
add_subdirectory(ceres)
|
||||||
|
1
extern/libmv/third_party/SConscript
vendored
1
extern/libmv/third_party/SConscript
vendored
@ -1,3 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
SConscript(['ssba/SConscript'])
|
||||||
SConscript(['ceres/SConscript'])
|
SConscript(['ceres/SConscript'])
|
||||||
|
61
extern/libmv/third_party/ssba/CMakeLists.txt
vendored
Normal file
61
extern/libmv/third_party/ssba/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# ***** 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 *****
|
||||||
|
|
||||||
|
set(INC
|
||||||
|
.
|
||||||
|
../ldl/Include
|
||||||
|
../../../colamd/Include
|
||||||
|
)
|
||||||
|
|
||||||
|
set(INC_SYS
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SRC
|
||||||
|
Geometry/v3d_metricbundle.cpp
|
||||||
|
Math/v3d_optimization.cpp
|
||||||
|
|
||||||
|
Geometry/v3d_cameramatrix.h
|
||||||
|
Geometry/v3d_distortion.h
|
||||||
|
Geometry/v3d_metricbundle.h
|
||||||
|
Math/v3d_linear.h
|
||||||
|
Math/v3d_linear_utils.h
|
||||||
|
Math/v3d_mathutilities.h
|
||||||
|
Math/v3d_optimization.h
|
||||||
|
)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(MSVC)
|
||||||
|
set(MSVC_OFLAGS O1 O2 Ox)
|
||||||
|
foreach(FLAG ${MSVC_OFLAGS})
|
||||||
|
string(REPLACE "${FLAG}" "Od" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
string(REPLACE "${FLAG}" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_definitions(
|
||||||
|
-DV3DLIB_ENABLE_SUITESPARSE
|
||||||
|
)
|
||||||
|
|
||||||
|
blender_add_lib(extern_ssba "${SRC}" "${INC}" "${INC_SYS}")
|
35
extern/libmv/third_party/ssba/SConscript
vendored
Normal file
35
extern/libmv/third_party/ssba/SConscript
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
Import('env')
|
||||||
|
|
||||||
|
defs = []
|
||||||
|
|
||||||
|
cflags_ssba = Split(env['CFLAGS'])
|
||||||
|
ccflags_ssba = Split(env['CCFLAGS'])
|
||||||
|
cxxflags_ssba = Split(env['CXXFLAGS'])
|
||||||
|
|
||||||
|
defs.append('V3DLIB_ENABLE_SUITESPARSE')
|
||||||
|
|
||||||
|
src = env.Glob('Geometry/*.cpp')
|
||||||
|
src += env.Glob('Math/*.cpp')
|
||||||
|
|
||||||
|
incs = '. ../ldl/Include ../../../colamd/Include'
|
||||||
|
|
||||||
|
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
|
||||||
|
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
|
||||||
|
cflags_ssba.append('/Od')
|
||||||
|
ccflags_ssba.append('/Od')
|
||||||
|
cxxflags_ssba.append('/Od')
|
||||||
|
|
||||||
|
if not env['BF_DEBUG']:
|
||||||
|
defs.append('NDEBUG')
|
||||||
|
else:
|
||||||
|
if not env['BF_DEBUG']:
|
||||||
|
cflags_ssba += Split(env['REL_CFLAGS'])
|
||||||
|
ccflags_ssba += Split(env['REL_CCFLAGS'])
|
||||||
|
cxxflags_ssba += Split(env['REL_CXXFLAGS'])
|
||||||
|
|
||||||
|
env.BlenderLib ( libname = 'extern_ssba', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137], compileflags=cflags_ssba, cc_compileflags=ccflags_ssba, cxx_compileflags=cxxflags_ssba )
|
@ -1105,7 +1105,7 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo
|
|||||||
{
|
{
|
||||||
TrackMarkersJob *tmj = (TrackMarkersJob *)tmv;
|
TrackMarkersJob *tmj = (TrackMarkersJob *)tmv;
|
||||||
int framenr = tmj->sfra;
|
int framenr = tmj->sfra;
|
||||||
//double t = PIL_check_seconds_timer();
|
// double t = PIL_check_seconds_timer();
|
||||||
|
|
||||||
while (framenr != tmj->efra) {
|
while (framenr != tmj->efra) {
|
||||||
if (tmj->delay > 0) {
|
if (tmj->delay > 0) {
|
||||||
@ -1141,7 +1141,7 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("Tracking time: %lf\n", PIL_check_seconds_timer()-t);
|
// printf("Tracking time: %lf\n", PIL_check_seconds_timer()-t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void track_markers_updatejob(void *tmv)
|
static void track_markers_updatejob(void *tmv)
|
||||||
|
@ -924,6 +924,7 @@ endif()
|
|||||||
if(WITH_LIBMV)
|
if(WITH_LIBMV)
|
||||||
list(APPEND BLENDER_SORTED_LIBS extern_libmv)
|
list(APPEND BLENDER_SORTED_LIBS extern_libmv)
|
||||||
list(APPEND BLENDER_SORTED_LIBS extern_ceres)
|
list(APPEND BLENDER_SORTED_LIBS extern_ceres)
|
||||||
|
list(APPEND BLENDER_SORTED_LIBS extern_ssba)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_MOD_CLOTH_ELTOPO)
|
if(WITH_MOD_CLOTH_ELTOPO)
|
||||||
|
Loading…
Reference in New Issue
Block a user