#1349 tbb::mutex is moved to outer scope to be sure that its initialization is completed before the parallel loop
This commit is contained in:
parent
4eda1662aa
commit
8f970caa56
@ -257,6 +257,10 @@ interpolateKeypoint( float N9[3][9], int dx, int dy, int ds, KeyPoint& kpt )
|
||||
return ok;
|
||||
}
|
||||
|
||||
#ifdef HAVE_TBB
|
||||
static tbb::mutex findMaximaInLayer_m;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find the maxima in the determinant of the Hessian in a layer of the
|
||||
* scale-space pyramid
|
||||
@ -352,10 +356,9 @@ findMaximaInLayer( const Mat& sum, const Mat& mask_sum,
|
||||
if( interp_ok )
|
||||
{
|
||||
/*printf( "KeyPoint %f %f %d\n", point.pt.x, point.pt.y, point.size );*/
|
||||
#ifdef HAVE_TBB
|
||||
static tbb::mutex m;
|
||||
tbb::mutex::scoped_lock lock(m);
|
||||
#endif
|
||||
#ifdef HAVE_TBB
|
||||
tbb::mutex::scoped_lock lock(findMaximaInLayer_m);
|
||||
#endif
|
||||
keypoints.push_back(kpt);
|
||||
}
|
||||
}
|
||||
@ -411,6 +414,11 @@ struct SURFFindInvoker
|
||||
keypoints = &_keypoints;
|
||||
nOctaveLayers = _nOctaveLayers;
|
||||
hessianThreshold = _hessianThreshold;
|
||||
|
||||
#ifdef HAVE_TBB
|
||||
//touch the mutex to ensure that it's initialization is finished
|
||||
CV_Assert(&findMaximaInLayer_m > 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void operator()(const BlockedRange& range) const
|
||||
|
Loading…
x
Reference in New Issue
Block a user