Replaced most of the usages of parallel_for with that of parallel_for_.

This should allow many algorithms to take advantage of more parallelization
technologies.
This commit is contained in:
Roman Donchenko
2013-05-30 18:44:33 +04:00
parent 37091b086c
commit 29b13ec1de
24 changed files with 232 additions and 352 deletions

View File

@@ -66,7 +66,7 @@ struct DistIdxPair
};
struct MatchPairsBody
struct MatchPairsBody : ParallelLoopBody
{
MatchPairsBody(const MatchPairsBody& other)
: matcher(other.matcher), features(other.features),
@@ -77,10 +77,10 @@ struct MatchPairsBody
: matcher(_matcher), features(_features),
pairwise_matches(_pairwise_matches), near_pairs(_near_pairs) {}
void operator ()(const BlockedRange &r) const
void operator ()(const Range &r) const
{
const int num_images = static_cast<int>(features.size());
for (int i = r.begin(); i < r.end(); ++i)
for (int i = r.start; i < r.end; ++i)
{
int from = near_pairs[i].first;
int to = near_pairs[i].second;
@@ -526,9 +526,9 @@ void FeaturesMatcher::operator ()(const vector<ImageFeatures> &features, vector<
MatchPairsBody body(*this, features, pairwise_matches, near_pairs);
if (is_thread_safe_)
parallel_for(BlockedRange(0, static_cast<int>(near_pairs.size())), body);
parallel_for_(Range(0, static_cast<int>(near_pairs.size())), body);
else
body(BlockedRange(0, static_cast<int>(near_pairs.size())));
body(Range(0, static_cast<int>(near_pairs.size())));
LOGLN_CHAT("");
}