pmoulon / CMVS-PMVS

This software (CMVS) takes the output of a structure-from-motion (SfM) software as input, then decomposes the input images into a set of image clusters of managable size. An MVS software can be used to process each cluster independently and in parallel, where the union of reconstructions from all the clusters should not miss any details that can be otherwise obtained from the whole image set. CMVS should be used in conjunction with an SfM software Bundler and an MVS software PMVS2 (PMVS version 2).
http://opensourcephotogrammetry.blogspot.com/
939 stars 464 forks source link

Fix nondeterminism due to uninitialized memory #37

Closed nh2 closed 5 years ago

nh2 commented 5 years ago

Fixes #35.

The Patch class does not initialise various fields, most importantly not float m_dscale, which is used e.g. in numeric optimizations.

It is set in "CpatchOrganizerS::setScales" but that setting uses only +=, /= and so on, thus depending on the previous value. This works "out of luck" in most cases because the memory for patches are re-used and the final m_dscale of the previous patch often happens to be close to 0.

This change makes my testing invocation of pmvs2 valgrind-clean, while before it would immediately warn about use of unititialized values.

pmoulon commented 5 years ago

Thank you