Using unordered_map and unordered_set C++ container types currently
requires careful testing or usage of boost, due to the various confusing
C++ version differences in include paths and namespaces.
Libmv defines tests for these cases in cmake and scons, such that ceres
can use any available implementation, or fall back too std::map/std::set
if none can be found.
This patch generalizes this buildfile code by providing a Blender macro.
* cmake: defines both the variables used by libmv at them moment as well
as 2 variables UNORDERED_MAP_INCLUDE_PREFIX and UNORDERED_MAP_NAMESPACE,
which can later be used in other C++ parts for convenience.
* scons: adds a tool script returning the include prefix and namespace.
Libmv checks these to define the appropriate definitions for ceres.
Differential Revision: https://developer.blender.org/D425
This is mainly a maintaince commit which syncs changes
between Blender and Libmv upstream also bringing new
GLog version.
This GLog version is presumably have better support of
MinGW from "the box".
This commit is also aimed to make further 3d part libs
update easier.
Summary:
This brings up much easier termination type usage,
which for us means we might use:
ceres::Summary::IsSolutionUsable()
instead of doing manual funky enum values check.
Reviewers: keir
Differential Revision: https://developer.blender.org/D153
Changes for VC2013
Now, I can build Blender with VC2013 with Cycles, Collada, OpenExr,OpenImageIO disabled. Also, you need VC2008 sp1 installed to make old libs compatible.
The issue was caused by the fact that in this version
of MSVC unordered_map class is defined in <unordered_map>
header file, but this file declares the class int std::tr1
namespace.
This confused existing assumption that if there's an
existing <unordered_map> file then class is declared
in std namespace.
Added an extra check to CMake which detects whether
it's std or std::tr1 which actually contains class
of unordered_map.
This might be changed/cleaned in the future, for
now committing to our repository to solve compilation
error on windows.
Details of the patch in upstream can be found there:
https://ceres-solver-review.googlesource.com/#/c/4371/
- A richer Problem API.
- DynamicNumericDiffCostFunction.
- Faster ITERATIVE_SCHUR solver.
- Faster SCHUR_JACOBI preconditioner.
- Faster Jacobian evaluation.
- Faster visibility based preconditioning using single linkage clustering.
Also re-wrote rules for unordered collections detection,
should work on all platforms and compilers now :)
- Tweaked typedefs in stdint so they match
what we've got in BLI_sys_types (needed to
explicitly tell sign to MSVC).
Not so much harmful to be more explicit here,
but we really better to have single stdint
int blender.
- Tweaked allocations macros so MSVC is happy
with structures allocation.
For Blender this release is interesting because of:
- Covariance estimation (not used in Blender yet, but now we
might use it for keyframe selection instead of havingown
implementation).
- Significant performance improvements to loss function and
dense linear solvers and automatic differentiation.
Unfortunately, didn't notice speedup of tracking itself,
but camera reconstruction now happens around 2 times faster
on my laptop,
- Better inner iteration step acceptance and stopping.
- Ensures fix for msvc2012 is applying correct.
- Some code cleanup to match libmv's code style.
- Do not include points which were intersect
behind the camera to a reconstruction.
- Includes changes needed for keyframe selection.
This brings a fixes for threading issue in BLAS
making BA step more robust (there were some in-detemrinacy
caused by this threading issue).
Also brings some optimizations, which does not directly
affect on blender.
Thins brings up some speed improvements:
SPARSE_SCHUR is approx 1.3-1.5x times faster
ITERATIVE_SCHUR is approx 1.2x times faster
For blender this means camera solution go a bit
faster now. Would not have affect on tracking
speed.
Also made it theraded linear solver, seems it makes
sense for iterative schur with inner iterations
enabled.
Use OpenMO's max therads called from bundler code
to detect how many threads to use. Could be changed
in a way that number of threads is passing in options
from blender side in the future.
Also removed redundant V3D definition from compiler's
flags.
With new bundle adjustment based on Ceres we don't need
SSBA library anymore. This also means we don't need ldl
library and libmv is no longer depends on colamd as well.
This is helpful because it brings CHOLMOB-free ITERATIVE_SCHUR and
SCHUR_JACOBI which is really nice for new upcoming bundle adjustment.
If also includes all the local fixes we made locally.
There're lots of other improvements/fixed which are not currently
would be so much visible in Blender, but which opens doors for some
great improvements in future.
SSBA seemed to be working OK last time i've checked it
with MSVC and optimization enabled.
Also, we'll likely replace it with own BA soon, which
works fine with MSVC anyway.
find ldl symbols because order of libraries seems to be critical
for gcc linker.
A bit stupid, but that's how linker works..
Both CMake and SCons shall work fine on linux now.
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.
- move object_iterators.c --> view3d_iterators. (ED_object.h had to include ED_view3d.h which isn't so nice)
- move projection functions from view3d_view.c --> view3d_project.c (view3d_view was becoming a mishmash of utility functions and operators).
- some some cmake includes as system-includes.
This should contain real fixes for Windows, making it more robost and hopefully
faster (due to proper collection port) on that platform.
Also hack to fix Eigen alignment shouldn't be needed anymore.
Also on platforms which have got broken TR1 collections it's better to define
CERES_NO_TR1 instead of using Boost hacks. Made changes to Scons and CMake,
but can not check if this indeed works since i don't have OSX here.
As far as i remember Keir, this should be safe for our usages of ceres
and it should save noticeable amount of time and used memory when
compiling blender with libmv support.
Quick tests with tracking went smooth after this.