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:
@@ -1213,6 +1213,7 @@ void CascadeClassifierImpl::detectMultiScaleNoGrouping( InputArray _image, std::
|
||||
if( maxObjectSize.height == 0 || maxObjectSize.width == 0 )
|
||||
maxObjectSize = imgsz;
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
bool use_ocl = tryOpenCL && ocl::useOpenCL() &&
|
||||
featureEvaluator->getLocalSize().area() > 0 &&
|
||||
ocl::Device::getDefault().type() != ocl::Device::TYPE_CPU &&
|
||||
@@ -1220,6 +1221,7 @@ void CascadeClassifierImpl::detectMultiScaleNoGrouping( InputArray _image, std::
|
||||
!isOldFormatCascade() &&
|
||||
maskGenerator.empty() &&
|
||||
!outputRejectLevels;
|
||||
#endif
|
||||
|
||||
/*if( use_ocl )
|
||||
{
|
||||
@@ -1262,8 +1264,8 @@ void CascadeClassifierImpl::detectMultiScaleNoGrouping( InputArray _image, std::
|
||||
return;
|
||||
|
||||
// OpenCL code
|
||||
if( use_ocl && ocl_detectMultiScaleNoGrouping( scales, candidates ))
|
||||
return;
|
||||
CV_OCL_RUN(use_ocl, ocl_detectMultiScaleNoGrouping( scales, candidates ))
|
||||
|
||||
tryOpenCL = false;
|
||||
|
||||
// CPU code
|
||||
|
@@ -159,7 +159,7 @@ icvReleaseHidHaarClassifierCascade( CvHidHaarClassifierCascade** _cascade )
|
||||
{
|
||||
#ifdef HAVE_IPP
|
||||
CvHidHaarClassifierCascade* cascade = *_cascade;
|
||||
if( cascade->ipp_stages )
|
||||
if( CV_IPP_CHECK_COND && cascade->ipp_stages )
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < cascade->count; i++ )
|
||||
@@ -338,7 +338,7 @@ icvCreateHidHaarClassifierCascade( CvHaarClassifierCascade* cascade )
|
||||
}
|
||||
/*
|
||||
#ifdef HAVE_IPP
|
||||
int can_use_ipp = !out->has_tilted_features && !out->is_tree && out->isStumpBased;
|
||||
int can_use_ipp = CV_IPP_CHECK_COND && (!out->has_tilted_features && !out->is_tree && out->isStumpBased);
|
||||
|
||||
if( can_use_ipp )
|
||||
{
|
||||
@@ -1315,7 +1315,7 @@ public:
|
||||
int x, y, ystep = factor > 2 ? 1 : 2;
|
||||
|
||||
#ifdef HAVE_IPP
|
||||
if( cascade->hid_cascade->ipp_stages )
|
||||
if(CV_IPP_CHECK_COND && cascade->hid_cascade->ipp_stages )
|
||||
{
|
||||
IppiRect iequRect = {equRect.x, equRect.y, equRect.width, equRect.height};
|
||||
ippiRectStdDev_32f_C1R(sum1.ptr<float>(y1), (int)sum1.step,
|
||||
@@ -1351,6 +1351,7 @@ public:
|
||||
if( positive <= 0 )
|
||||
break;
|
||||
}
|
||||
CV_IMPL_ADD(CV_IMPL_IPP|CV_IMPL_MT);
|
||||
|
||||
if( positive > 0 )
|
||||
for( y = y1; y < y2; y += ystep )
|
||||
@@ -1561,7 +1562,7 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
|
||||
{
|
||||
CvSize winSize0 = cascade->orig_window_size;
|
||||
#ifdef HAVE_IPP
|
||||
int use_ipp = cascade->hid_cascade->ipp_stages != 0;
|
||||
int use_ipp = CV_IPP_CHECK_COND && (cascade->hid_cascade->ipp_stages != 0);
|
||||
|
||||
if( use_ipp )
|
||||
normImg.reset(cvCreateMat( img->rows, img->cols, CV_32FC1));
|
||||
|
Reference in New Issue
Block a user