#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;
|
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
|
* Find the maxima in the determinant of the Hessian in a layer of the
|
||||||
* scale-space pyramid
|
* scale-space pyramid
|
||||||
@ -352,10 +356,9 @@ findMaximaInLayer( const Mat& sum, const Mat& mask_sum,
|
|||||||
if( interp_ok )
|
if( interp_ok )
|
||||||
{
|
{
|
||||||
/*printf( "KeyPoint %f %f %d\n", point.pt.x, point.pt.y, point.size );*/
|
/*printf( "KeyPoint %f %f %d\n", point.pt.x, point.pt.y, point.size );*/
|
||||||
#ifdef HAVE_TBB
|
#ifdef HAVE_TBB
|
||||||
static tbb::mutex m;
|
tbb::mutex::scoped_lock lock(findMaximaInLayer_m);
|
||||||
tbb::mutex::scoped_lock lock(m);
|
#endif
|
||||||
#endif
|
|
||||||
keypoints.push_back(kpt);
|
keypoints.push_back(kpt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -411,6 +414,11 @@ struct SURFFindInvoker
|
|||||||
keypoints = &_keypoints;
|
keypoints = &_keypoints;
|
||||||
nOctaveLayers = _nOctaveLayers;
|
nOctaveLayers = _nOctaveLayers;
|
||||||
hessianThreshold = _hessianThreshold;
|
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
|
void operator()(const BlockedRange& range) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user