From: Leonid Beynenson Date: Tue, 24 May 2011 16:13:55 +0000 (+0000) Subject: Small change in the SURF algorithm to be sure that without TBB the template parallel_... X-Git-Tag: accepted/2.0/20130307.220821~3051 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=555e9c64bc142027e637c4dde4f2f85e1b366b22;p=profile%2Fivi%2Fopencv.git Small change in the SURF algorithm to be sure that without TBB the template parallel_for is not used (the reason: the parallelization in the SURF algorithm conflicts with ThreadingFramework, which is a temporary substitute of TBB for ARMs) --- diff --git a/modules/features2d/src/surf.cpp b/modules/features2d/src/surf.cpp index e916775..e3a64c9 100644 --- a/modules/features2d/src/surf.cpp +++ b/modules/features2d/src/surf.cpp @@ -490,6 +490,7 @@ static CvSeq* icvFastHessianDetector( const CvMat* sum, const CvMat* mask_sum, step*=2; } +#ifdef HAVE_TBB /* Calculate hessian determinant and trace samples in each layer*/ cv::parallel_for( cv::BlockedRange(0, nTotalLayers), cv::SURFBuildInvoker(sum,sizes,sampleSteps,dets,traces) ); @@ -498,6 +499,13 @@ static CvSeq* icvFastHessianDetector( const CvMat* sum, const CvMat* mask_sum, cv::parallel_for( cv::BlockedRange(0, nMiddleLayers), cv::SURFFindInvoker(sum,mask_sum,params,dets,traces,sizes, sampleSteps,middleIndices,points) ); +#else + cv::SURFBuildInvoker(sum,sizes,sampleSteps,dets,traces) + (cv::BlockedRange(0, nTotalLayers)); + + cv::SURFFindInvoker(sum,mask_sum,params,dets,traces,sizes, sampleSteps,middleIndices,points) + ( cv::BlockedRange(0, nMiddleLayers) ); +#endif /* Clean-up */ for( layer = 0; layer < nTotalLayers; layer++ ) @@ -873,8 +881,15 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask, if ( N > 0 ) + { +#ifdef HAVE_TBB cv::parallel_for(cv::BlockedRange(0, N), cv::SURFInvoker(¶ms, keypoints, descriptors, img, sum) ); +#else + cv::SURFInvoker invoker(¶ms, keypoints, descriptors, img, sum); + invoker(cv::BlockedRange(0, N)); +#endif + } /* remove keypoints that were marked for deletion */