1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Implementation detector and selector for IPP and OpenCL;

IPP can be switched on and off on runtime;

Optional implementation collector was added (switched off by default in CMake). Gathers data of implementation used in functions and report this info through performance TS;

TS modifications for implementations control;
This commit is contained in:
Pavel Vlasov
2014-10-03 15:17:28 +04:00
parent 83ef276697
commit 45958eaabc
49 changed files with 4279 additions and 2799 deletions
+44 -20
View File
@@ -688,13 +688,19 @@ static void distanceTransform_L1_8U(InputArray _src, OutputArray _dst)
_dst.create( src.size(), CV_8UC1);
Mat dst = _dst.getMat();
#ifdef HAVE_IPP
#ifdef HAVE_IPP
CV_IPP_CHECK()
{
IppiSize roi = { src.cols, src.rows };
Ipp32s pMetrics[2] = { 1, 2 }; //L1, 3x3 mask
if (ippiDistanceTransform_3x3_8u_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<uchar>(), (int)dst.step, roi, pMetrics)>=0)
{
CV_IMPL_ADD(CV_IMPL_IPP);
return;
}
setIppErrorStatus();
#endif
}
#endif
distanceATS_L1_8u(src, dst);
}
@@ -735,22 +741,28 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
{
#ifdef HAVE_IPP
if ((currentParallelFramework()==NULL) || (src.total()<(int)(1<<14)))
CV_IPP_CHECK()
{
IppStatus status;
IppiSize roi = { src.cols, src.rows };
Ipp8u *pBuffer;
int bufSize=0;
status = ippiTrueDistanceTransformGetBufferSize_8u32f_C1R(roi, &bufSize);
if (status>=0)
if ((currentParallelFramework()==NULL) || (src.total()<(int)(1<<14)))
{
pBuffer = (Ipp8u *)ippMalloc( bufSize );
status = ippiTrueDistanceTransform_8u32f_C1R(src.ptr<uchar>(),(int)src.step, dst.ptr<float>(), (int)dst.step, roi, pBuffer);
ippFree( pBuffer );
IppStatus status;
IppiSize roi = { src.cols, src.rows };
Ipp8u *pBuffer;
int bufSize=0;
status = ippiTrueDistanceTransformGetBufferSize_8u32f_C1R(roi, &bufSize);
if (status>=0)
return;
setIppErrorStatus();
{
pBuffer = (Ipp8u *)ippMalloc( bufSize );
status = ippiTrueDistanceTransform_8u32f_C1R(src.ptr<uchar>(),(int)src.step, dst.ptr<float>(), (int)dst.step, roi, pBuffer);
ippFree( pBuffer );
if (status>=0)
{
CV_IMPL_ADD(CV_IMPL_IPP);
return;
}
setIppErrorStatus();
}
}
}
#endif
@@ -773,23 +785,35 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
{
if( maskSize == CV_DIST_MASK_3 )
{
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
CV_IPP_CHECK()
{
IppiSize roi = { src.cols, src.rows };
if (ippiDistanceTransform_3x3_8u32f_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<float>(), (int)dst.step, roi, _mask)>=0)
{
CV_IMPL_ADD(CV_IMPL_IPP);
return;
}
setIppErrorStatus();
#endif
}
#endif
distanceTransform_3x3(src, temp, dst, _mask);
}
else
{
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
IppiSize roi = { src.cols, src.rows };
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
CV_IPP_CHECK()
{
IppiSize roi = { src.cols, src.rows };
if (ippiDistanceTransform_5x5_8u32f_C1R(src.ptr<uchar>(), (int)src.step, dst.ptr<float>(), (int)dst.step, roi, _mask)>=0)
{
CV_IMPL_ADD(CV_IMPL_IPP);
return;
}
setIppErrorStatus();
#endif
}
#endif
distanceTransform_5x5(src, temp, dst, _mask);
}