Commit Graph

1096 Commits

Author SHA1 Message Date
Campbell Barton
2e840e56cf CMake: correct include dirs 2014-07-01 09:36:28 +10:00
Sergey Sharybin
c73505fb43 Get rid of usage of non-existing module 2014-06-27 17:30:17 +06:00
Sergey Sharybin
cba3498629 Update Carve to latest upstream version
This brings new copyright header which supports GPL2 and 3.

It wasn't really an issue before because we had agreement with
Tobias, but now it's all documented in sources.
2014-06-27 15:56:50 +06:00
Sergey Sharybin
72ac596e19 Update Ceres to latest upstream version
Brings new bounds limiting and also prepares build system
for the changes in the upstream.

Namely shared_ptr header and namespace is now being detected
by a build system rather than by hacks in the code.

This commit includes some changes to auto-detection flags
in SCons, presumably adding more consistency there. This
is main changes which are suppoed to be reviewed here.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D581
2014-06-27 14:08:27 +06:00
Campbell Barton
4baa2fdcfe Correction to GTest commit (WITH_GTEST=OFF works now) 2014-06-19 04:35:15 +10:00
Sergey Sharybin
72b607ab74 Some WITH_TESTS weer not renamed to WITH_GTEST 2014-06-18 22:28:27 +06:00
Sergey Sharybin
306cbb82ec GTest unit testing framework
Currently covers only small set of functionality.
2014-06-19 02:09:16 +10:00
Sergey Sharybin
e53c00a2db Add patchset to recent Carve changes
In the future i'd rather have this reported to an
upstream instead of adding local changes. It's really
easy to override this changes if patchset is not added
and this is to be fixed in upstream. Also the function
was never used so it was rather totally harmless warning
for us.
2014-06-11 13:13:36 +06:00
Jens Verwiebe
a6a38de4d6 Fix a warning in carve by initializing var 2014-06-10 20:15:50 +02:00
Sergey Sharybin
05fa464a25 Fix T40551: Boolean Modifier distorts UVs
Mapping to original face was never working 100% reliably actually,
now use more robust method for this.
2014-06-10 19:27:09 +06:00
Sergey Sharybin
8bf7172384 Fix compilation on OSX after previous commit
EXPECT_EQ wasn't defined in the scope.
2014-04-23 19:19:38 +06:00
Sergey Sharybin
c605711c6b Libmv cleanup: move aligned malloc implementation into own file
It was rather stupid having it in brute region tracker,
now it is in own file in base library.
2014-04-23 16:03:44 +06:00
Sergey Sharybin
0ff06a9ba5 Libmv: optimization of PearsonProductMomentCorrelation
Pass the arrays by reference rather than by value,
should give some percent of speedup.

Also don't pass the dimensions to the function but
get them from the images themselves.

Hopefully this will give some %% of tracker speedup.
2014-04-21 14:26:37 +06:00
Jens Verwiebe
9c93c0bf08 Bullet: making bullet friction workaround more furureproof by using the __apple_build_version__ macro, TODO: check if problem persists with newer clang 2014-04-19 14:10:49 +02:00
Sergey Sharybin
fe3eb82520 Re-bundle Libmv to be sure it's all fine 2014-04-17 23:31:57 +06:00
Sergey Sharybin
5bf7d988ac Fix for 771a9dd: libmv build files are automatically generated
This means if one makes change to either SConscript or CMakeLists.txt
there he MUST update bundle.sh.

Also made it so *.cc files from intern/libmv are matching which would
make it easier to add more .cc files there if needed.

And one more thing is removing 'simple_pipeline/distortion_models.cc'
which doesn't match any of the files.
2014-04-17 22:38:31 +06:00
Jens Verwiebe
771a9dd335 Lbmv: fix scons compile after ed2ddc9 2014-04-17 17:00:29 +02:00
Antony Riakiotakis
87b86eee62 Fix compilation issue. 2014-04-17 15:53:34 +03:00
Sergey Sharybin
c4a9ec88c8 Fix crash when enabling undistorted display in MCE 2014-04-17 18:01:45 +06:00
Sergey Sharybin
ed2ddc9f70 Support multiple distortion models, including a new division model
This commit makes it so CameraIntrinsics is no longer hardcoded
to use the traditional polynomial radial distortion model. Currently
the distortion code has generic logic which is shared between
different distortion models, but had no other models until now.

This moves everything specific to the polynomial radial distortion
to a subclass PolynomialDistortionCameraIntrinsics(), and adds a
new division distortion model suitable for cameras such as the
GoPro which have much stronger distortion due to their fisheye lens.

This also cleans up the internal API of CameraIntrinsics to make
it easier to understand and reduces old C-style code.

New distortion model is available in the Lens panel of MCE.

- Polynomial is the old well-known model
- Division is the new one which s intended to deal better with huge
  distortion.

Coefficients of this model works independent from each other
and for division model one probably want to have positive values
to have a barrel distortion.
2014-04-17 17:28:41 +06:00
Jens Verwiebe
8a4210074c Bullet: better workaround for failing friction with clang 3.4, remove the obsolete compileflag magic 2014-04-17 00:25:25 +02:00
Campbell Barton
b3972aeea0 Math Lib: optimize axis_dominant_v3_to_m3, approx 6x speedup
build the matrix directly rather then calculating with axis/angle

also remove unused function calc_poly_plane
2014-04-16 21:07:28 +10:00
Antony Riakiotakis
7bf62f0c60 ...and linking, sorry for that! 2014-04-10 22:00:54 +03:00
Antony Riakiotakis
c0a9397a06 Fix compilation 2014-04-10 21:59:03 +03:00
Sergey Sharybin
df63e8fd93 Speedup track preview widget for byte images
This gives a huge speedup gain for cases when you've got
rather huge markers on a byte images.

Done by skipping IMB_float_from_rect()/IMB_rect_from_float()
for such cases. We can sample the buffers without color space
conversion.
2014-04-10 21:14:36 +06:00
Sergey Sharybin
ccf9afddba Fix T39608: Blender 2.70 crashes when performing union
This was a nasty bug which was caused by specific of how face-edge
attributes are stored in Carve.

Face pointer is used in the map key which works just fine in all
cases except for the cases when some face is getting freed after
it was stored in the map.

This might give real issues when new face is allocating because
it's possible new face would have the same address as the freed
one.

Such cases used to happen when union of separate manifolds is
needed for the operands AND jemalloc is enabled.

Solved by dropping attributes for the freed faces from the map.
Maybe not the fastest ever approach, but not sure how to make
it faster actually. Should work just fine. It only happens for
complex setups with intersecting manifolds in the operands.
2014-04-09 14:27:34 +06:00
Sergej Reich
6ffabfae85 Fix T39646: Rigid Body Constraints non functional on release builds
-ffast-math is evil, not sure why it was enabled...
I seems to work better on OSX but it's still not a good idea.

The SConscript for bullet is a mess, I don't understand why
we use different flags for different platforms in the first place.
Seems to be a historical artifact but I don't know enough about scons
to try and clean it up.
2014-04-09 01:48:44 +02:00
Campbell Barton
9bbb30bf03 Fix T39245: Crash when dynamic topology is enabled
Redundant decrement was crashing for systems which didnt optimize it out.
2014-04-03 17:13:31 +11:00
Sergey Sharybin
f0106d2985 Unbreak carve build for clang
Based on D420
2014-03-28 14:41:04 +06:00
Sergey Sharybin
af16d462e3 Fix T39419: Crash when solving camera motion
Stupid vector initialization error.

Should be in 'a'.
2014-03-26 17:47:13 +06:00
Sergey Sharybin
cf148edb26 Followup to Ceres changes -- need to update bundling script 2014-03-25 15:08:22 +06:00
Lukas Tönne
ddc959691a Fix for own commit: mixed up ceres build defines when replacing cmake
check with a generalized macro.

rBbbfcb0b1e44636b73b8c46f1cb800fa53dda5277
2014-03-25 09:49:39 +01:00
Lukas Tönne
bbfcb0b1e4 Build file macro for testing unordered_map C++ container support.
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
2014-03-25 09:25:00 +01:00
Jens Verwiebe
877706b8eb Cleanup: Restrict the debug -gline-tables-only to cxx_debug in cycles and spelling 2014-03-22 11:33:32 +01:00
Sergey Sharybin
356ec42bda Attempt to fix compilation error with msvc2013 2014-03-21 16:06:30 +06:00
Sergey Sharybin
3411146984 Update Eigen to version 3.2.1
Main purpose of this is to have SparseLU solver which
we can use now as a replacement to opennl library.
2014-03-21 16:04:53 +06:00
Sergey Sharybin
dfa5ced30e Follow up to the previous commit
Just update to the changelog
2014-03-20 23:45:29 +06:00
Sergey Sharybin
6ba5c0c268 Update Libmv to latest upstream
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.
2014-03-20 23:26:25 +06:00
Jens Verwiebe
3f89b92823 Ups, forgot to remove something i just placed temporary … 2014-03-19 11:26:41 +01:00
Jens Verwiebe
67f0290382 OSX/bullet/scons: a better workaround for clang 3.4 issues with actual bullet, according cmake ( less speed penalty ) 2014-03-19 11:21:36 +01:00
Jens Verwiebe
5ff0500593 OSX/cmake/bullet: fix ambigoius compiler ID and make deoptimize fix a bit stricter to reduce speed penalty 2014-03-18 12:18:03 +01:00
Sergey Sharybin
94379277dd Fix T39151: Boolean modifier freeze
This re-applied patch from 25cbd13 which was lost at some point
since missing patchset in series.

This revision is to be back-ported to the final release.
2014-03-13 15:40:55 +06:00
Sergey Sharybin
2e128baefd Fix T39111: Boolean assert failure on widows
In fact we had this change a while ago, not sue what happened.
2014-03-12 23:12:34 +06:00
Jens Verwiebe
d0ad48fdc9 OSX/bullet: i have to use -O0 again, else weird bullet behaviour comes back.
I overlooked in cmake my fix same time changed the optimization level to 0,
so not use optimization is the real fix ( postponed for after 2.70 ).
I appears we should investigate scons anyway: compileflags does not apply to c and c++ same time as expected.
2014-03-12 13:04:31 +01:00
Sergey Sharybin
de86b7097f Fix T39104: 2 clothes on a collision object cause crash
This was caused by static variables used in plNearestPoints().

For now solved by making the solvers allocated in the stack,
seems no noticeable affect on the simulation speed so far.
2014-03-12 14:48:47 +06:00
Jens Verwiebe
09b2531bb3 OSX/bullet: add -O2 to bt_cxx_flags, in cmake thats default, in scons CXXFLAGS start empty also in “Release” 2014-03-11 18:32:22 +01:00
Campbell Barton
6e9ee13de0 CMake: add fastmath for gcc release flags (OSX had already) 2014-03-12 03:39:12 +11:00
Jens Verwiebe
4e3f27032e OSX/bullet: do a last fix for scons. Now in both buildsystems the used flags are in sync for OSX 2014-03-11 17:34:31 +01:00
Jens Verwiebe
ce37400c0b OSX/cmake: tentative fix for T38746, conflictting flags somewhere 2014-03-11 15:56:50 +01:00
Jens Verwiebe
558fa43ffd OSX/bullet: Truely fix T38746 now, compile flags where not propagated right,
also remove gcc 4.6 workaround, i don’t think its needed any longer.
!!! pls check if this would be right thing todo for othere OS too !!!
2014-03-11 13:27:06 +01:00
Jens Verwiebe
ac0cdec90f OSX/clang3.4: tentative fix for T38746, strange bullet behaviour 2014-03-10 18:09:53 +01:00
Sergey Sharybin
a659d73b1d Added back code which was commented out for debug reasons
Also added a patchset for Carve's memory leak fix.
2014-03-05 14:52:00 +06:00
Sergey Sharybin
ef40e889ca Fix compilation error windows 2014-03-04 20:37:19 +06:00
Sergey Sharybin
34c7fd1a11 Fix T38918: Boolean modifier crashes when using specific topology
There were loads of issues in the code still which are mow likely fixed:

- Hole resolver hook had memory leak -- it didn't free face with holes
  when triangulating it.

- Original edge mapping didn't work correct. old code related on the fact
  that loop order is not changing when constructing the MeshSet class, but
  in fact it does change.

  Currently used edge map for this because it was easiest way to do it now,
  but after the release we're to change it. Main reason is that face mapping
  is not correct as well (and it was never correct actually). So we'll need
  to construct Mesh structures by our own to be sure we're using correct
  original index mapping.

- Carve might produce faces with ears, which is forbidden in Blender.
  it wasn't an issue in old integration because triangulation will remove
  the ears. So for now simply added ears removing back as a hook.

  But actual reason of the ears is to be investigated really.

  This hook will only work for NGons, quads are assumed not be able to
  have ears. So this additional hook shouldn't slow down things much.

- Carve's hole resolver produces duplicated faces in some cases. Still not
  sure what is the reason of this. Code here is not so much straightforward,
  this is to be investigated later.

  For now solved the issue as own hole resolver which checks for duplicated
  faces after the hole resolving.

  The additional checks here will only run if the mesh actually have hole
  and wouldn't introduce slowdown for faces which doesn't have holes.

- Made it so if edge user triangulation gets a split (for example, in cases
  when this edge intersects with the second operand) it wouldn't be dissolved.

  This prevents cases of crappy topology after dissolving in several cases.

- Edge dissolver didn't check for whether edge is a non-manifold. We couldn't
  really dissolve open manifold edges.

  The bad thing about this is that mesh triangulation might produce non-manifold
  edges and they wouldn't be dissolved. Not worst case in the world, but would
  be nice to have it solved somehow.

- Exporting mesh form Carve to Blender might have produced duplicated edges
  in cases when several non-manifold faces shared the edge. This is also fixed
  now.

- Mesh triangulation might have produced duplicated faces, which is really bad.
  Fixed by keeping a track on which faces we've created and skipping adding new
  triangle if we already have one.

This all might introduce some slowdown, but we're too close to the release now,
so would rather have it slower but robust. After the release we might look into
ways to speed things up.
2014-03-04 20:18:16 +06:00
Sergey Sharybin
6e970e1a33 Update patch for mesh_simplifier 2014-02-28 19:09:22 +06:00
Sergey Sharybin
8badec14f9 Implement separate BA step for tracks which have constant zero weight
This is needed to minimize their reprojection error over the footage.
Without this extra step positions of such tracks were calculated by
algebraic intersection code only, which doesn't give best precision.
2014-02-27 16:14:35 +06:00
Sergey Sharybin
00acb98436 Fix T38844: Crash if weight track = 0
Avoid zero-sized problem when doing euclidean intersection

Zero-sized problem might occur when intersecting track with
constant zero weight. For such tracks we'll just use result
of algebraic intersection.

TODO: We probably need to have a separate BA step to adjust
positions of tracks with constant zero weight.
2014-02-27 14:31:09 +06:00
Sergey Sharybin
8a5221750e Ignore zero weighted markers in keyframe selection
It doesn't make sense to use zero-weighted tracks as a correspondences
in keyframe selection.

Such tracks are not guaranteed to be tracked accurately because their
purpose is to add reference points in 3D space without affecting the
solution.
2014-02-26 17:56:10 +06:00
Sergey Sharybin
dbf653acb7 Disable eager-refinement step of region tracking
This gives much worse results on mango footage (see 04_2e)
so disabling for now for until proper prediction model is landed.

The thing is, currently blender sends input coordinates as the guess to
region tracker and in case of fast motion such an early out ruins the track.
2014-02-25 16:55:24 +06:00
Tamito Kajiyama
036d35dd24 Fix for MSVC 2008 compiler errors. 2014-02-25 01:16:52 +09:00
Sergey Sharybin
cefa733803 Followup for 90a86fe: libmv/ceres cmake/scons files are automatically generated
So don't forget to update generator scripts as well.
2014-02-24 20:13:33 +06:00
Sergey Sharybin
9643b2e5b5 Preserve non-flat faces in boolean modifier
This commit implements dissolving of edges which were used
to triangulate non-flat faces. This slows things down a bit
(around 5% on heave mesh with all faces triangulated).

We could improve speed of dissolve a bit here (so not a bell
to add an option for triangulation yet).

Also fixed wrong edge origindex mapping.
2014-02-24 18:10:33 +06:00
90a86fecee Fix T38684: cmake OS X build problem when changing deployment target.
Don't cache these variables as they are not cleared on such changes.
2014-02-18 19:38:43 +01:00
Sergey Sharybin
97b90d89f4 Fix T38637: Boolean produces faces with holes which isn't supported by BMesh
Simple fix -- use CarveHoleResolver hook for CSG which will split faces
containing holes.
2014-02-18 11:53:04 +06:00
Sergey Sharybin
7fb7ce789f Fix T38631: Blender crashes when selection faces after new boolean modifier
Own mistake in edges carve->blender export, didn't count them correct.
2014-02-14 14:26:26 +06:00
Jens Verwiebe
9185ab5d9c Fix scons compiling after carve changes 2014-02-13 23:21:13 +01:00
Sergey Sharybin
6a65161966 fixed an for loop variable type and delete operator in cave-utils.cc
Patch by wutzi (Benedikt Bergenthal), thanks!

Reviewers: sergey

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D314
2014-02-13 20:09:51 +06:00
Sergey Sharybin
83617d24d5 Rework carve integration into boolean modifier
Goal of this commit is to support NGons for boolean modifier
(currently mesh is being tessellated before performing boolean
operation) and also solve the limitation of loosing edge custom
data layers after boolean operation is performed.

Main idea is to make it so boolean modifier uses Carve library
directly via it's C-API, avoiding BSP intermediate level which
was doubling amount of memory needed for the operation and which
also used quite reasonable amount of overhead time.

Perhaps memory usage and CPU usage are the same after all the
features are implemented but we've got support now:

- ORIGINDEX for all the geometry
- Interpolation of edge custom data (seams, crease)
- NGons support

Triangulation rule is changed now as well, so now non-flat
polygons are not being merged back after Carve work. This is
so because it's not so trivial to support for NGons and
having different behavior for quads and NGons is even more
creepy.

Reviewers: lukastoenne, campbellbarton

Differential Revision: https://developer.blender.org/D274
2014-02-13 17:16:53 +06:00
Sergey Sharybin
5cbddd4ca4 Bye-bye FAST!
FAST detector has been replaced with fancier Harris,
so no need to keep FAST library in the sources now.
2014-02-06 18:13:12 +06:00
Sergey Sharybin
9896508e14 Fix compilation error with msvc2012 and 2013 as well 2014-01-31 15:33:48 +06:00
Sergey Sharybin
df471369e2 Bundle latest Libmv from upstream
Currently no functional changes, but we might want
to have scoped_array in the future.
2014-01-28 18:36:32 +06:00
Sergey Sharybin
be6643b5ec Followup to the previous commit
Need to take weight into account when drawing per-frame track
reprojection curve and when computing per-track average error.
2014-01-28 18:02:22 +06:00
Sergey Sharybin
59d1387c41 Improvements to weighted tracks behavior
First thing changed by this commit is making it so
Euclidean intersection takes track weight into account
when solving minimization problem. This behaves the
same exact way as it is for BA step.

Second thing is related on how average reprojection error
is being calculated. It didn't take track weight into
account which could confuse users. Now average reprojection
error will give the same result as intersection/BA uses
during minimization which gives much more predictable
behavior.

Differential Revision: https://developer.blender.org/D265
2014-01-28 17:25:47 +06:00
Sergey Sharybin
1c0cdc385f Fixes for keyframe selection
Using tracks with constant zero weight used to crash
keyframe selection since it was trying to use missing
parameter blocks for Jacobian evaluation,

Also fixed possible issues with wrong camera block being
marked as variable. This could technically happen when
having zero weighted tracks. Made it so all camera blocks
are marked as variable for now.
2014-01-28 16:54:50 +06:00
Sergey Sharybin
9178dc9d38 Rework detector API and implement Harris detector
Switch the detector API to a single function which accepts
a float image and detector options. This makes usage of
feature detection more unified across different algorithms.

Options structure is pretty much straightforward and contains
detector to be used and all the detector-specific settings.

Also implemented Harris feature detection algorithm which
is not as fast as FAST one but is expected to detect more
robust feature points. It is also likely that less features
are detected, but better quality than quantity.

Blender will now use Harris detector by default, later we'll
remove FAST detector.
2014-01-28 15:37:19 +06:00
Sergey Sharybin
3d408e10a4 Correct typo in the patch file as well 2014-01-28 02:16:44 +06:00
Thomas Dinges
8870556def Fix compilation on Windows, syntax error. 2014-01-27 20:53:42 +01:00
Sergey Sharybin
efaadc3104 Attempt to fix compilation error with MSVC-2008 2014-01-28 01:37:41 +06:00
Sergey Sharybin
31d679b667 Update Carve to latest update
Fixes some issues with NaN vertices in special cases.
Also adds edge interpolation routines which are currently
unused but which are requires to implement edge CD interpolation.
2014-01-27 17:04:06 +06:00
Sergey Sharybin
ef67b9eec4 Ceres: more warnings cleanup 2014-01-14 01:18:09 +06:00
Sergey Sharybin
a6ceb4a498 Re-bundle new Ceres library
- Fixes some harmless issues (in cases blender doesn't use Ceres yet)
- Fixes some compilation warnings
2014-01-13 19:17:28 +06:00
Sergey Sharybin
113ff51476 Compilation error fix for NetBSD
Based on the patch from Joerg Sonnenberger.
2014-01-09 16:15:24 +06:00
Sergey Sharybin
2d8545f87e Fix compilation error on NetBSD
Original patch is by Jeorg Sonnenberger, thanks!
2014-01-09 16:03:02 +06:00
Sergey Sharybin
f9353b8e8d Code cleanup: remove patch series from libmv
Since we're using own libmv branch from git.blender.org
we don't need to have local patches for libmv in blender
source tree.
2014-01-02 15:24:46 +06:00
Sergey Sharybin
f9e0ac4ced Code and style cleanup
Mainly fixed some style warnings reported by cpplint.

Also changed how camera (un)distortion happens internally
by replacing number of channels as a template argument
with number as channels passing as function argument.
Makes code easier to follow by eliminating loads checks
how much channels are used and which argument to pass to
the template.
2014-01-02 15:24:46 +06:00
Sergey Sharybin
5d701c6d25 Re-bundle libmv from new upstream repository
No functional changes, just to make sure all the patches
are ported nicely and that update scripts works fine.
2014-01-01 22:32:48 +06:00
Sergey Sharybin
5933b2455c Update Ceres to the latest upstream
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
2014-01-01 22:32:47 +06:00
Sergej Reich
05eebf49d3 Bullet: Update to svn r2719
Fixes part of T37905, fixed constraint didn't work correctly.
2013-12-26 12:45:57 +01:00
Campbell Barton
a7ac6481ef CMake: report messages as status (else ccmake treats like an error) 2013-12-10 13:18:46 +11:00
Alexandr Kuznetsov
e2429d6492 Woo Hoo. First git commit.
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.
2013-11-29 15:13:12 -05:00
Sergey Sharybin
28a2d5e264 Code cleanup: spelling fixes and verbosity prints 2013-11-29 01:46:08 +06:00
Sergey Sharybin
b7bca8663a Made collections port compatible with MSVC2008
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/
2013-11-28 23:28:11 +06:00
Sergey Sharybin
de6c1c9287 Update Ceres to latest upstream version
- 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 :)
2013-11-28 19:46:23 +06:00
Sergey Sharybin
dc71cb5f6e Fix Carve compilation on FreeBSD
Based on the patch from Marcus von Appen, thanks!
2013-11-28 14:00:10 +06:00
Sergey Sharybin
a628ca9ebe Update Carve to upstream version be054bc7ed86 2013-11-28 14:00:10 +06:00
Sergey Sharybin
1c14ead46f Carve bundler script cleanup
- random.hpp was only removed from actual include
  directory, but not from patches/files.

- Files list generator didn't ignore config.h file
  which in fact is not needed.
2013-11-28 14:00:10 +06:00
Sergey Sharybin
1de23f6c0d Tweaks and improvements to fundamental/homography estimation
- A bit more reasonable name for the estimation option
  structure and estimation functions.

- Get rid of unclear function and parameter tolerance,
  it wasn't clear at all in which units they are.

  Now we've got expected_average_symmetric_distance as
  an early output check and as soon as average symmetric
  error goes below this threshold refining finishes.

  This distance is measured in the same units as input
  points are.

  It is arguable whether we need callback for this or not,
  but seems Ceres doesn't have some kind of absolute
  threshold for function value and function_tolerance
  behaves different from logic behind expected symmetric
  error.

- Added option to normalize correspondences before
  estimating the homography in order to increase estimation
  stability. See

    R. Hartley and A. Zisserman. Multiple View Geometry in Computer
    Vision. Cambridge University Press, second edition, 2003.

    https://www.cs.ubc.ca/grads/resources/thesis/May09/Dubrofsky_Elan.pdf
2013-11-20 15:30:28 +06:00
Campbell Barton
cf9edb2610 rangetree: support for building on freebsd-10 2013-11-16 18:31:13 +11:00
Jens Verwiebe
a3ec6edc05 OSX/scons: make MACOSX_SDK_CHECK a local var is sconstruct and remove from env, also fix a longstanding misuse of MACOSX_SDK_CHECK in ceres, use MACOSX_SDK instead 2013-11-08 13:44:10 +00:00
Sergej Reich
13caf5cc14 bullet: Remove patch applied upstream 2013-11-04 17:02:01 +00:00
Keir Mierle
427844c28d Eagerly attempt to refine a track before doing a brute search
Before the refinement phase of tracking, a brute force SAD search
is run across the search area. This works well but is slow;
especially if the guess for the track's location is accurate.

This patch runs a refinement phase before running a brute force
search, hoping that the guessed position (in x2, y2) is close to
the best answer. If it is, then no brute search is done. If it is
not, then a normal brute force search followed by refinement is
done.

In some cases this may produce worse tracks than before; the
regressions will need investigation. The predictive motion model
(to be implemented) will reduce the probability of that happening.
2013-10-29 01:06:50 +00:00
Keir Mierle
d10abe6d4d Fix bug where libmv tracking incorrectly succeeds on failure
Before this patch, if Ceres returned USER_SUCCESS indicating that
Ceres was only changing the tracked quad slightly between
iterations (indicating convergence), no final correlation check
was done. This leads to incorrectly returning that the tracking
was successful, when it actually failed.
2013-10-28 18:34:19 +00:00
Sergey Sharybin
9f32e83175 Weighted tracks
Added a weight slider to track which defines
how much particular track affects in a final
reconstruction. This weight is for sure
animateable.

Currently it affects on BA step only which in
most cases will work just fine.

The usecase of this slider is to have it set
to 1.0 most of the time where the track is
good, but blend it's weight down to 0 when
tracker looses the track. This will prevent
camera from jump.

Tutorial is to be done by Sebastian.
2013-10-26 13:22:38 +00:00
Sergej Reich
451b60f1a3 Fix building with scons
Can't actually test here so hope this is enough.
2013-10-25 03:56:17 +00:00
Sergej Reich
472a021aca bullet: Update to version 2.82 (bullet revision 2705)
Remove patch that has been applied upstream.

Fixes several bugs.
2013-10-25 03:43:20 +00:00
Sergey Sharybin
dc46febec8 Code cleanup: move function prototype to header file 2013-10-15 15:21:44 +00:00
Sergey Sharybin
eb69cb7de3 Get rid of Allow Fallback option
It was rather confusing from the user usage point
of view and didn't get so much improvement after
new bundle adjuster was added.

In the future we might want to switch resection
to PPnP algorithm, which could also might be a
nice alternative to fallback option.
2013-10-15 15:21:41 +00:00
Sergey Sharybin
36039be6b5 Libmv: make sure CmakeList.txt is re-created with all needed headers on re-bundle 2013-10-09 20:21:12 +00:00
Sergey Sharybin
b5491291e4 Libmv: move platform-specific defines into own file 2013-10-09 20:02:02 +00:00
Sergey Sharybin
ccd2e4375a Fix compilation error after recent libmv change
- 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.
2013-10-09 19:49:09 +00:00
Sergey Sharybin
49bc310671 Move guarded objetc allocation to a guardedalloc header
Also made libmv-capi use guarded objetc allocation.
Run into some suspecious cases when it was not so
clear whether memory is being freed or not.

Now we'll know for sure whether there're leaks or not :)

Having this macros in a guardedalloc header helps
using them in other areas (for now it's OCIO and libmv,
but in the future it'll be more places).
2013-10-09 08:46:02 +00:00
Sergey Sharybin
724b015da2 libmv: fix matrix address being printed instead of actual values 2013-10-02 10:18:43 +00:00
Sergey Sharybin
3169e96ae2 Optimization for recent changes in keyframe selection 2013-10-01 14:55:34 +00:00
Sergey Sharybin
404274040b Fix issues according to codereview page
Mainly just a comment cleanups.
2013-10-01 11:15:24 +00:00
Sergey Sharybin
2ddbb5d1e1 Fix for plane track jittering
Jittering was caused by homography not being estimated
accurate enough.

Before this, only algebraic estimation was used, which
is indeed not so much great, Now use algebraic estimation
followed with refinement step using Ceres minimizer.

The code was already there since keyframe selection patch,
made such estimation a generic function in multiview/ and
changed API for estimation in order to pass all additional
options via an options structure (the same way as it's
done fr Ceres).

This includes changes to both homography and fundamental
estimation.

TODO:
- Need to document Ceres functors better.
- Need to support homogeneous coordinates (currently
  only euclidean coords are supported).
2013-09-30 09:35:04 +00:00
Joseph Mansfield
7114ab18a2 Code cleanup: spelling correction 2013-09-14 10:22:56 +00:00
Campbell Barton
29cbf93b07 correct error in libmv stub, also correct typo. 2013-09-13 03:49:11 +00:00
Jens Verwiebe
990e361a2c OSX/clang5: revert 59960, todo: make it global 2013-09-09 16:24:23 +00:00
Jens Verwiebe
0dfc9b1f00 OSX/clang5: fix broken compiling 2013-09-09 15:45:09 +00:00
Joseph Mansfield
9707bdfe75 Code cleanup: Minor function capitalization fix 2013-09-09 00:06:23 +00:00
Sergey Sharybin
4228463caa Update Ceres to 1.7.0 release
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.
2013-09-05 10:48:44 +00:00
Sergey Sharybin
08c49d8a12 Use reentrant qsort() in particle codes
Particle system code used global variable to sort hair by orig index,
which is not safe for threading at all.

Replaced this with usage of reentrant version of qsort, which is
now implemented in BLI. It was moved from recast navigation code
to BLI, so more areas could use it (if needed).

--
svn merge -r59086:59087 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:40:47 +00:00
Thomas Dinges
d75e14b31e * Compile fix, so disabling libmw works again. 2013-08-16 12:43:37 +00:00
Sergey Sharybin
24ce60cfe4 Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.

Movie clip editor changes:

- Artist might create a plane track out of multiple point
  tracks which belongs to the same track (minimum amount of
  point tracks is 4, maximum is not actually limited).

  When new plane track is added, it's getting "tracked"
  across all point tracks, which makes it stick to the same
  plane point tracks belong to.

- After plane track was added, it need to be manually adjusted
  in a way it covers feature one might to mask/replace.

  General transform tools (G, R, S) or sliding corners with
  a mouse could be sued for this. Plane corner which
  corresponds to left bottom image corner has got X/Y axis
  on it (red is for X axis, green for Y).

- Re-adjusting plane corners makes plane to be "re-tracked"
  for the frames sequence between current frame and next
  and previous keyframes.

- Kayframes might be removed from the plane, using Shit-X
  (Marker Delete) operator. However, currently manual
  re-adjustment or "re-track" trigger is needed.

Compositor changes:

- Added new node called Plane Track Deform.

- User selects which plane track to use (for this he need
  to select movie clip datablock, object and track names).

- Node gets an image input, which need to be warped into
  the plane.

- Node outputs:
  * Input image warped into the plane.
  * Plane, rasterized to a mask.

Masking changes:

- Mask points might be parented to a plane track, which
  makes this point deforming in a way as if it belongs
  to the tracked plane.

Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578

This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
Sergey Sharybin
cab2aef71a Add Procrustes PNP ("PPnP") resection algorithm to libmv
This adds a new Euclidean resection method, used to create the
initial reconstruction in the motion tracker, to libmv. The method
is based on the Procrustes PNP algorithm (aka "PPnP"). Currently
the algorithm is not connected with the motion tracker, but it
will be eventually since it supports initialization.

Having an initial guess when doing resection is important for
ambiguous cases where potentially the user could offer extra
guidance to the solver, in the form of "this point is in front of
that point".

--
svn merge -r58821:58822 ^/branches/soc-2011-tomato
2013-08-16 08:26:34 +00:00
Sergey Sharybin
43c21e91e1 Fix for uninitialized covariance matrix
This is likely a culptrit caused #36231: Motion tracker bug in 2.68
2013-08-14 05:30:35 +00:00
Sergey Sharybin
7eeaefb97c Potential fix for wrogn k3 value after solve 2013-08-01 16:34:55 +00:00
Joseph Mansfield
c15ae082bb Code cleanup: libmv C API
Clean up inconsistencies in the libmv C API:
- All type identifiers are libmv_TypeName
- All function identifiers libmv_functionName
- Prefer libmv_nounVerb function names (e.g. libmv_featuresDestroy)
- Match Blender code formatting rather than Google
- Spelling corrections

Code review: https://codereview.appspot.com/11494044/
2013-07-31 13:48:12 +00:00
Peter Schlaile
1c2ff55334 == libredcode / licence cleanup ==
Changed libredcode to GNU GPL v2 or later to make it more compatible
with additional libraries added to blender.
2013-07-14 20:38:55 +00:00
Sergey Sharybin
f32615653b Update libmv from own branch
Fixes compilation error on win32 and shall give few
cpu ticks boost by passing vectors by reference rather
than by value.
2013-06-01 10:30:46 +00:00
Sergey Sharybin
719c2f8163 Fixed compilation error after recent keyframes commit. 2013-05-30 12:05:28 +00:00
Sergey Sharybin
c5b4983eca Remove files unused by blender's tracker
They were giving compilation error with msvc2012,
and instead of having workaround in them let's
drop them away form blender (they're not used even).
2013-05-30 12:05:20 +00:00
Sergey Sharybin
cf5e979fb4 Motion tracking: automatic keyframe selection
Implements an automatic keyframe selection algorithm which uses
couple of approaches to find out best keyframes candidates:

- First, slightly modifier Pollefeys's criteria is used, which
  limits correspondence ration from 80% to 100%. This allows to
  reject keyframe candidate early without doing heavy math in
  cases there're not much common features with first keyframe.

- Second step is based on Geometric Robust Information Criteria
  (aka GRIC), which checks whether features motion between
  candidate keyframes is better defined by homography or
  fundamental matrices.

  To be a good keyframe candidate, fundamental matrix need to
  define motion better than homography (in this case F-GRIC will
  be smaller than H-GRIC).

  This two criteria are well described in this paper:
  http://www.cs.ait.ac.th/~mdailey/papers/Tahir-KeyFrame.pdf

- Final step is based on estimating reconstruction error of
  a full-scene solution using candidate keyframes. This part
  is based on the following paper:

  ftp://ftp.tnt.uni-hannover.de/pub/papers/2004/ECCV2004-TTHBAW.pdf

  This step requires reconstruction using candidate keyframes
  and obtaining covariance matrix of 3D points positions.
  Reconstruction was done pretty much straightforward using
  other simple pipeline routines, and for covariance estimation
  pseudo-inverse of Hessian is used, which is in this case
  (J^T * J)+, where + denotes pseudo-inverse.

  Jacobian matrix is estimating using Ceres evaluate API.

  This is also crucial to get rid of possible gauge ambiguity,
  which is in our case made by zero-ing 7 (by gauge freedoms
  number) eigen values in pseudo-inverse.

  There're still room for improving and optimizing the code,
  but we need some point to start with anyway :)

  Thanks to Keir Mierle and Sameer Agarwal who assisted a lot
  to make this feature working.
2013-05-30 09:03:49 +00:00
Campbell Barton
225c5fee6b move BLO_sys_types.h -> BLI_sys_types.h (it had nothing todo with loading)
remove MEM_sys_types.h which was a duplicate.
2013-05-28 19:35:26 +00:00
Campbell Barton
8982439383 quiet warnings from r56825
- using vars before checking they are defined
- /* within comment
2013-05-16 03:55:47 +00:00
Jürgen Herrmann
8a89d27b87 Libmv internal compiler error workaround for VC2012.
Will be reverted as soon as the x64 compiler is fixed.
For now it shouldn't have an impact on tracking performance. My test have shown no significant speed difference to official VC2008 build of 2.67.
2013-05-15 17:00:53 +00:00
Campbell Barton
ff1a587e1c update libmv stub. 2013-05-14 03:06:58 +00:00
Sergey Sharybin
d4c6ac9a60 Cleanup and small improvements to libmv
- Added const modifiers where it makes sense and
  helps keep code safe.
- Reshuffled argument to match <inputs>,<outputs>
  convention on parameters.
- Pass values to ApplyRadialDistortionCameraIntrinsics
  by a constant reference.
  This will save lots of CPU ticks passing relatively
  heavy jet objects to this function when running
  bundle adjustment.
2013-05-13 14:39:06 +00:00
Sergey Sharybin
4e5541a9a6 Headers cleanup. 2013-05-13 09:51:36 +00:00
Sergey Sharybin
91b659d174 Forgot this in one of previous commits
Idea here is to be able to have all files opened in IDE
and not confuse it by the same function implemented in
multiple files.
2013-05-12 22:40:12 +00:00
Sergey Sharybin
4dba8307f2 Compilation fix for recent commit. 2013-05-12 22:30:34 +00:00
Sergey Sharybin
32faec1a53 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.
2013-05-12 22:17:37 +00:00
Sergey Sharybin
5637b0d39b Update bundled version of libmv
- 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.
2013-05-12 17:06:00 +00:00
Sergey Sharybin
beb73831f6 Documentation for functions inside tracking.c
Additional changes:

- Cleaned up sources to reduce mess in some
  big functions.
- Removed unused function from libmv c-api.
- Made functions naming more consistent.
- Use bool for internal stuff in tracking.c.

Shall be no functional changes :)
2013-05-12 16:04:08 +00:00
Brecht Van Lommel
309db8032c Fix libmv build with visual studio 2012.
Patch #35158 by Jurgen Herrmann.
2013-05-11 13:10:39 +00:00
Sergey Sharybin
2cf1f1f4d6 Left extra logging print by accident. 2013-05-10 07:26:55 +00:00
Sergey Sharybin
4648ec3e82 Remove check for zero focal length in BA cost functor
This check is actually redundant, because empty intrinsics
will have focal length of 1.0, which means original comment
about BundleIntrinsics was not truth.

It is possible that external user will send focal length of
zero to be refined, but blender prevents this from happening.
2013-05-10 06:48:47 +00:00
Sergey Sharybin
3a309a8313 Synchronize changes between bunded libmv and own libmv branch. 2013-05-10 06:26:01 +00:00
Sergey Sharybin
ed131e67c4 Add check for points behind camera in euclidan BA cost functor
In cases keyframes are no so good, algebraic two frames construction
could produce result, for which more aggressive Ceres-based BA code
will fall to a solution for which points goes behind the camera,
which is not so nice.

Seems in newer Ceres returning false from cost functor wouldn't
abort solution, but will restrict solver from moving points behind
the camera.

Works fine in own tests, but requires more tests.
2013-05-09 16:38:58 +00:00
Sergey Sharybin
4f5f97254c Reconstructed scene scale ambiguity improvement
Made it so reconstructed scene always scaled in a way
that variance of camera centers is unity.

This solves "issues" when different keyframes will
give the same reprojection error but will give scenes
with different.scale, which could easily have been
considered as a bad keyframe combination.

This change is essential for automatic keyframe
selection algorithm to work reliable for user.
2013-05-09 16:38:43 +00:00
Sergej Reich
424e8b69f1 bullet: Don't use sse in api for windows.
Remove stray BT_USE_SSE_IN_API definitions.
Was causing problems especially for 32 bit windows.

It's not quite clear why they were added in the first place since
this should be defined in btScalar.h, needs further investigation.

Thanks to Francisco De La Cruz (xercesblue) for looking into this.

Should fix [#35071] Bullet Convex Hull Crashes on Win32 with SSE
2013-05-06 22:53:11 +00:00
Sergej Reich
c80ff61d40 bullet: Fix avoiding collision response between static/kinematic objects
Sent patch upstream.

Fixes [#35115] Character physics type fails collision with static type with an action on 2.67 rc
2013-04-28 21:40:54 +00:00
Sergey Sharybin
d2f61b36f9 Revert 56319, misunderstood API
This was completely skipping BA step when point
goes behind the camera.
2013-04-26 18:25:49 +00:00
Sergey Sharybin
126ca24dbf Fix for BA possible move bundles behind the camera
In some cases (was noticed on not good enough keyframe
pair) bundle adjuster could have moved bundles behind
the camera.

This could indeed lead to lower rewprojection error but
this is just pointless thing to do.

Now added check to residuals functor which will return
false to Ceres in cases point moved behind the camera
to prevent such issues.
2013-04-26 15:43:20 +00:00
Sergey Sharybin
d05f5da111 Update Ceres to current upstream version
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.
2013-04-22 09:25:37 +00:00
Sergey Sharybin
79ca1bd004 Make it so FATAL messages from libmv are print to the console
even when --debug-libmv is not passed via command line.
2013-04-15 10:02:33 +00:00
Sergey Sharybin
8cca2fec82 Fix for bundle adjusting with motion restricted
This commit bundles new libmv version from own branch
which brings fix for wrong parameter block used for
modal solver parameterization.

Fixes #34985: Crash with Motion tracker (Tripod Motion)
2013-04-14 23:43:00 +00:00
Sergey Sharybin
d2b55d1171 Bundle adjustment improvements
- Get rid of rotation matrix parameterization,
  use angle-axis instead.

  Also Joined rotation and translation into a
  single parameter block.

  This made minimization go significantly faster,
  like 1.3x times in average.

- Fix first camera when bundling. This is to
  address orientation ambiguity.

  Reconstruction result could still vary in
  size, but that's another issue to be addressed
  later.

Additional change:

Split EuclideanBundleCommonIntrinsics into
smaller functions, so it's now a bit easier
to follow.
2013-04-08 17:05:52 +00:00
Sergey Sharybin
8e8823be12 Update ceres to current upstream version
Brings fixes for BLAS.
2013-04-08 17:05:48 +00:00
Sergey Sharybin
f62d2669de Revert change made to bilinear sampler in libmv
This made preview working but that broke internals
of tracking.

Namely, BlurredImageAndDerivativesChannels is giving
much more blurred image because it was assuming pixel
center is an integer position.

Guess other parts of libmv used to suffer because of
this issue.

Now pixel centering happens in blender side, and
libmv assumes integer position is a pixel center.
2013-04-06 14:47:45 +00:00
Sergey Sharybin
898ba93a12 Update libmv to current upstream version
- Solves some strict compilation warning
- Style/code cleanup
2013-04-05 09:23:20 +00:00
Sergey Sharybin
43b61fb8bd Bundle current master of ceres-solver
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.
2013-04-05 09:22:54 +00:00
Campbell Barton
1777a69818 misc minor edits.
- pass string size to BLI_timestr() to avoid possible buffer overrun.
- quiet warning for mingw.
- include guards for windows utf conversion funcs.
- fix for mistage in edge-angle-selection check.
- some style cleanup.
2013-03-29 06:25:22 +00:00
Sergey Sharybin
729b76eb79 Update ceres to current git version.
Mainly to support msvc2010, bit also includes some minor fixes.
2013-03-21 18:07:03 +00:00
Sergey Sharybin
8a7ce9c924 Fix #34707: Blender crash on enabling of boolean modifier
Stupid mistake by my own with recent Carve update which
undid fix for MSVC STL library.
2013-03-21 08:47:18 +00:00
Campbell Barton
3966722057 code cleanup: misc warnings/style 2013-03-21 02:58:21 +00:00
Sergey Sharybin
6dc4ea34e4 Multi-threaded frame calculation for movie clip proxies
This commit implements multi-threaded calculation of frames
when building proxies. Both scaling and undistortion steps
are now threaded.

Frames and proxy resolution are still handled one-by-one,
saving files after every single step. So if HDD is not so
fast, this commit could have not so much benefit.

Internal changes:

- Added IMB_scaleImBuf_threaded which scales given image
  buffer in multiple threads and uses bilinear filtering.

- libmv's camera intrinsics now have SetThreads() method
  which is used to specify how many OpenMP threads to use
  for buffer distortion/undistortion.

  And yeah, this code is using OpenMP for threading.

- Reshuffled a bit libmv-capi calls and added function
  BKE_tracking_distortion_set_threads to specify number
  of threads used by intrinscis.
2013-03-15 11:59:46 +00:00
Irie Shinsuke
5792e77239 Patch [#34373] Use i18n monospace font in Text editor and Python console
This patch allows Blender to display i18n monospace font in the text
editor and the Python interactive console. Wide characters that occupy
multiple columns such as CJK characters can be displayed correctly.
Furthermore, wrapping, selection, suggestion, cursor drawing, and
syntax highlighting should work.

Also fixes a bug [#34543]: In Text Editor false color in comment on cyrillic

To estimate how many columns each character occupies, this patch uses
wcwidth.c written by Markus Kuhn and distributed under MIT-style license:

  http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c

wcwidth.c is stored in extern/wcwidth and used as a static library.

This patch adds new API to blenfont, blenlib and blenkernel:

BLF_get_unifont_mono()
BLF_free_unifont_mono()
BLF_draw_mono()
BLI_wcwidth()
BLI_wcswidth()
BLI_str_utf8_char_width()
BLI_str_utf8_char_width_safe()
txt_utf8_offset_to_column()
txt_utf8_column_to_offset()
2013-03-12 07:25:53 +00:00
Jens Verwiebe
373de9e936 OSX/gcc-4.6: workaround a compilerbug, use apple-gcc instead 2013-03-07 22:12:23 +00:00
Sergej Reich
643b0be4cb bullet: Update to current svn, r2636
Apply patches in patches directory, remove patches that were applied
upstream.
If you made changes without adding a patch, please check.

Fixes [#32233] exporting bullet format results in corrupt files.
2013-03-07 17:53:16 +00:00
Sergey Sharybin
f81b594790 Switch from DENSE_NORMAL_CHOLESKY to DENSE_QR
DENSE_QR is better behaved numerically and after recent
changes from Sameer there's no big difference in speed.
2013-03-05 09:38:50 +00:00
Sergey Sharybin
3a0d62f4f4 Update Ceres to 1.5RC3
It brings optimization of DENSE_QR and DENSE_SCHUR solvers.
2013-03-05 09:38:43 +00:00
Sergey Sharybin
9da36d3ab1 Updates to libmv's bundle.sh to make sure libmv upstream
is copying properly to our sources.
2013-03-01 11:52:38 +00:00
Sergey Sharybin
1a7ab1da09 Hrm, gcc became broken after recent commit.
Hope now gcc and 32bit msvc would both work.
2013-03-01 08:56:04 +00:00
Sergey Sharybin
a2027237ed Pass data to modal reprojection cost functor by reference
Seems it solves alignment error reported by 32bit MSVC.
2013-03-01 08:20:13 +00:00
Sergey Sharybin
aada0e4a29 Header cleanup in libmv c-api 2013-02-28 14:25:40 +00:00
Sergey Sharybin
d68e766c8c This lines are also not so much useful for now. 2013-02-28 14:25:33 +00:00
Sergey Sharybin
3e320a67e3 Remove unused rigid registration code
There're some features planned which would
require rigid registration, but this code
would need to be re-done anyway to use new
minimizer and solving some issues with ICP
algorithm there.
2013-02-28 14:24:52 +00:00
Sergey Sharybin
52f34f017d Modal (aka tripod) solver rework
Several major things are done in this commit:

- First of all, logic of modal solver was changed.
  We do not rely on only minimizer to take care of
  guessing rotation for frame, but we're using
  analytical rotation computation for point clouds
  to obtain initial rotation.

  Then this rotation is being refined using Ceres
  minimizer and now instead of minimizing average
  distance between points of point of two clouds,
  minimization of reprojection error of point
  cloud onto frame happens.

  This gives quite a bit of precision improvement.

- Second bigger improvement here is using bundle
  adjustment for a result of first step when we're
  only estimating rotation between neighbor images
  and reprojecting markers.

  This averages error across the image sequence
  avoiding error accumulation. Also, this will
  tweak bundles themselves a bit for better match.

- And last bigger improvement here is support of
  camera intrinsics refirenment.

  This allowed to significantly improve solution
  for real-life footage and results after such
  refining are much more usable than it were before.

Thanks to Keir for the help and code review.
2013-02-28 14:24:42 +00:00
Sergey Sharybin
2a5ed5293d Increase verbosity level for reprojected markers info
This information is useful, but in cases when you, say,
working on a bundler it's annoying to scroll all the
information up.

Now behavior would be:
- running `./blender --debug-libmv` will print all the
  debug messages
- running `./blender --debug-libmv --verbose 0` will
  print only debug messages from solvers, recosntruction
  and so, but will bypass final reprojection bunch of
  messages
- running `./blender --debug-lib,v --verbose 1` will
  include final reprojection messages.
2013-02-28 14:24:25 +00:00
Sergey Sharybin
9bfe99281c Move radial distortion code to own templated function
This shall not lead to any functional changes, just
avoids radial distortion code duplicated in camera
intrinsics and bundling code.

For fancier bundle adjustment supprting different
distortion models this is not actually enough and
would need to make some bigger changes, but this
changes makes code a bit easier to maintain already.
2013-02-28 14:24:17 +00:00
Sergey Sharybin
1d20f2496a Use threaded cost function and jacobian computation
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.
2013-02-26 17:52:10 +00:00
Sergey Sharybin
0ec75be1c6 Camera tracking: support refining radial K1, K2 only
This commits adds extra refirenment entry in the menu which is
"K1, K2" and which will apparently refine only this distortion
coefficients.

This would be useful in cases when you know for sure focal length
(which could be obtained from lens, EXIF and so) but not sure
about how good you manual calibration is.

Be careful tho, there're no internal constraints on this
coefficients so distortion model could just screw up into insane
values.
2013-02-26 11:46:38 +00:00
Sergey Sharybin
05a5cbbda2 Camera tracking: switch euclidean intersection code to use Ceres
Would not expect any significant changes in solver behavior, but
it could be more accurate in some cases.

Switching projective intersection to ceres is marked as a TODO
for now.
2013-02-26 11:46:27 +00:00
Sergey Sharybin
b7af3207cc Bye-bye, SSBA!
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.
2013-02-25 20:15:42 +00:00
Keir Mierle
2833994a71 Switch motion tracker bundle adjustment to Ceres.
Patch originally written by me, then finished by Sergey. Big
thanks to Sergey for troopering through and fixing the many issues
with my original (not compilable) patch.

The Ceres implementation uses 2 parameter blocks for each camera
(1 for rotation and 1 for translation), 1 parameter block for
common intrinsics (focal length etc) and 1 parameter block for
each track (e.g. bundle or 3D point).

We turn on some fancy optimizer options to get better performance,
in particular:

  options.preconditioner_type = ceres::SCHUR_JACOBI;
  options.linear_solver_type = ceres::ITERATIVE_SCHUR;
  options.use_inner_iterations = true;
  options.use_nonmonotonic_steps = true;
  options.max_num_iterations = 100;

Special thanks to Sameer Agarwal of Ceres fame for splitting out
the SCHUR_JACOBI preconditioner so that it didn't depend on
CHOLMOD.  Previously we could not use that preconditioner in
Blender because CHOLMOD is too large of a dependency for Blender.

BundleIntrinsicsLogMessage:
- Moved bunch of if(foo) LG << "bar" into this function, to make
  EuclideanBundleCommonIntrinsics a little bit easier to follow.

EuclideanBundle:
- Fix RMSE logging.
2013-02-25 20:00:48 +00:00
Sergey Sharybin
18fd4bd9f4 Update Carve to newest upstream version with some assorted fixes
Perhaps some warnings could be silenced, but not in mood of writing
local patches at this moment. They're all harmless anyway.
2013-02-25 10:02:43 +00:00
Sergey Sharybin
ff6ca7dcd0 code cleanup: remove unused and unsupported functions from libmv-capi
---
svn merge -r52855:52856 ^/branches/soc-2011-tomato
2013-02-25 09:38:59 +00:00
Sergey Sharybin
2df945d8ff Camera tracking: libmv distortion API now also uses camera intrinsics
structure instead of passing all the parameters to every function.

Makes it much easier to tweak distortion model.

---
svn merge -r52854:52855 ^/branches/soc-2011-tomato
2013-02-25 09:36:52 +00:00
Sergey Sharybin
a0d646d186 Synchronize libmv with own branch
Should be no functional changes, just would help a lot
checking on which stuff was/shall be merged from tomato
and which is not.
2013-02-25 09:27:57 +00:00
Sergey Sharybin
12baa00b6a code cleanup: camera tracking
- Moved keyframes and refirement flags into reconstruction options structure
- Moved distortion coefficients and other camera intrinsics into own structure
- Cleaned up reconstruction functions in libmv c-api

---
svn merge -r52853:52854 ^/branches/soc-2011-tomato
2013-02-25 09:24:31 +00:00
Sergey Sharybin
66cca267b1 Upgrade Ceres library to current master which is current 1.5RC
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.
2013-02-25 08:59:26 +00:00
Sergey Sharybin
23d603bdbf Update bundled version of minilzo
This updates minilzo from version 2.03 to version 2.06 which
is like 3 years newer.

The main reason of this update is that older minilzo had some
strange valgrind warnings. Likely they're harmless, but it was
still annoying to troubleshot bakes with valgrind.
2013-02-25 08:16:28 +00:00
Sergey Sharybin
4cf9034f6d Remove extern_ssba workaround
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.
2013-02-22 10:06:54 +00:00
Sergey Sharybin
ea99b9a392 Made ldl code a part of extern_ssba library, otherwise gcc fails to
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.
2013-02-20 12:07:27 +00:00
Sergey Sharybin
705d2ab417 Correction to previous release -- scons on linux was broken 2013-02-20 11:41:33 +00:00
Sergey Sharybin
1f88ee6213 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.
2013-02-20 11:29:43 +00:00
Sergey Sharybin
de23a9bfd5 Correction to previous commit, needed to tweak some include
directories after shuffling order of subdirectories and
compiler flags tweaks.
2013-02-18 11:50:03 +00:00
Sergey Sharybin
971b0f1ed6 Correction to cmake rules for libmv/ceres
libmv still requires optimization switched off because
of some incompatibility of SSBA and MSVC optimizer which
makes bundle adjustment work just wrong.

This shall not be an issue for Ceres and no need to
disable optimization for extern_ceres
2013-02-18 10:45:46 +00:00
Campbell Barton
a78cf854b4 add missing bullet header to cmake, quiet reports from 'make test_cmake' 2013-02-06 04:16:28 +00:00