diff --git a/modules/calib3d/src/calibinit.cpp b/modules/calib3d/src/calibinit.cpp index 55fadcb4f0..d6f5995587 100644 --- a/modules/calib3d/src/calibinit.cpp +++ b/modules/calib3d/src/calibinit.cpp @@ -2120,6 +2120,8 @@ cvDrawChessboardCorners( CvArr* _image, CvSize pattern_size, bool cv::findChessboardCorners( InputArray _image, Size patternSize, OutputArray corners, int flags ) { + CV_INSTRUMENT_REGION() + int count = patternSize.area()*2; std::vector tmpcorners(count+1); Mat image = _image.getMat(); CvMat c_image = image; @@ -2149,6 +2151,8 @@ void cv::drawChessboardCorners( InputOutputArray _image, Size patternSize, InputArray _corners, bool patternWasFound ) { + CV_INSTRUMENT_REGION() + Mat corners = _corners.getMat(); if( corners.empty() ) return; @@ -2162,6 +2166,8 @@ void cv::drawChessboardCorners( InputOutputArray _image, Size patternSize, bool cv::findCirclesGrid( InputArray _image, Size patternSize, OutputArray _centers, int flags, const Ptr &blobDetector ) { + CV_INSTRUMENT_REGION() + bool isAsymmetricGrid = (flags & CALIB_CB_ASYMMETRIC_GRID) ? true : false; bool isSymmetricGrid = (flags & CALIB_CB_SYMMETRIC_GRID ) ? true : false; CV_Assert(isAsymmetricGrid ^ isSymmetricGrid); diff --git a/modules/calib3d/src/calibration.cpp b/modules/calib3d/src/calibration.cpp index 313c14ac05..fae4f601d7 100644 --- a/modules/calib3d/src/calibration.cpp +++ b/modules/calib3d/src/calibration.cpp @@ -2750,6 +2750,8 @@ void cv::reprojectImageTo3D( InputArray _disparity, OutputArray __3dImage, InputArray _Qmat, bool handleMissingValues, int dtype ) { + CV_INSTRUMENT_REGION() + Mat disparity = _disparity.getMat(), Q = _Qmat.getMat(); int stype = disparity.type(); @@ -3178,6 +3180,8 @@ static Mat prepareDistCoeffs(Mat& distCoeffs0, int rtype, int outputSize = 14) void cv::Rodrigues(InputArray _src, OutputArray _dst, OutputArray _jacobian) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); bool v2m = src.cols == 1 || src.rows == 1; _dst.create(3, v2m ? 3 : 1, src.depth()); @@ -3196,6 +3200,8 @@ void cv::Rodrigues(InputArray _src, OutputArray _dst, OutputArray _jacobian) void cv::matMulDeriv( InputArray _Amat, InputArray _Bmat, OutputArray _dABdA, OutputArray _dABdB ) { + CV_INSTRUMENT_REGION() + Mat A = _Amat.getMat(), B = _Bmat.getMat(); _dABdA.create(A.rows*B.cols, A.rows*A.cols, A.type()); _dABdB.create(A.rows*B.cols, B.rows*B.cols, A.type()); @@ -3330,6 +3336,8 @@ cv::Mat cv::initCameraMatrix2D( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size imageSize, double aspectRatio ) { + CV_INSTRUMENT_REGION() + Mat objPt, imgPt, npoints, cameraMatrix(3, 3, CV_64F); collectCalibrationData( objectPoints, imagePoints, noArray(), objPt, imgPt, 0, npoints ); @@ -3346,6 +3354,8 @@ double cv::calibrateCamera( InputArrayOfArrays _objectPoints, Size imageSize, InputOutputArray _cameraMatrix, InputOutputArray _distCoeffs, OutputArrayOfArrays _rvecs, OutputArrayOfArrays _tvecs, int flags, TermCriteria criteria ) { + CV_INSTRUMENT_REGION() + return calibrateCamera(_objectPoints, _imagePoints, imageSize, _cameraMatrix, _distCoeffs, _rvecs, _tvecs, noArray(), noArray(), noArray(), flags, criteria); } @@ -3358,6 +3368,8 @@ double cv::calibrateCamera(InputArrayOfArrays _objectPoints, OutputArray stdDeviationsExtrinsics, OutputArray _perViewErrors, int flags, TermCriteria criteria ) { + CV_INSTRUMENT_REGION() + int rtype = CV_64F; Mat cameraMatrix = _cameraMatrix.getMat(); cameraMatrix = prepareCameraMatrix(cameraMatrix, rtype); @@ -3470,6 +3482,8 @@ void cv::calibrationMatrixValues( InputArray _cameraMatrix, Size imageSize, double& fovx, double& fovy, double& focalLength, Point2d& principalPoint, double& aspectRatio ) { + CV_INSTRUMENT_REGION() + if(_cameraMatrix.size() != Size(3, 3)) CV_Error(CV_StsUnmatchedSizes, "Size of cameraMatrix must be 3x3!"); @@ -3609,6 +3623,8 @@ bool cv::stereoRectifyUncalibrated( InputArray _points1, InputArray _points2, InputArray _Fmat, Size imgSize, OutputArray _Hmat1, OutputArray _Hmat2, double threshold ) { + CV_INSTRUMENT_REGION() + int rtype = CV_64F; _Hmat1.create(3, 3, rtype); _Hmat2.create(3, 3, rtype); @@ -3626,6 +3642,8 @@ cv::Mat cv::getOptimalNewCameraMatrix( InputArray _cameraMatrix, Size imgSize, double alpha, Size newImgSize, Rect* validPixROI, bool centerPrincipalPoint ) { + CV_INSTRUMENT_REGION() + Mat cameraMatrix = _cameraMatrix.getMat(), distCoeffs = _distCoeffs.getMat(); CvMat c_cameraMatrix = cameraMatrix, c_distCoeffs = distCoeffs; @@ -3646,6 +3664,8 @@ cv::Vec3d cv::RQDecomp3x3( InputArray _Mmat, OutputArray _Qy, OutputArray _Qz ) { + CV_INSTRUMENT_REGION() + Mat M = _Mmat.getMat(); _Rmat.create(3, 3, M.type()); _Qmat.create(3, 3, M.type()); @@ -3677,6 +3697,8 @@ void cv::decomposeProjectionMatrix( InputArray _projMatrix, OutputArray _cameraM OutputArray _rotMatrixX, OutputArray _rotMatrixY, OutputArray _rotMatrixZ, OutputArray _eulerAngles ) { + CV_INSTRUMENT_REGION() + Mat projMatrix = _projMatrix.getMat(); int type = projMatrix.type(); _cameraMatrix.create(3, 3, type); diff --git a/modules/calib3d/src/fisheye.cpp b/modules/calib3d/src/fisheye.cpp index 45fe230db9..f7e210e153 100644 --- a/modules/calib3d/src/fisheye.cpp +++ b/modules/calib3d/src/fisheye.cpp @@ -62,12 +62,16 @@ namespace cv { namespace void cv::fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d& affine, InputArray K, InputArray D, double alpha, OutputArray jacobian) { + CV_INSTRUMENT_REGION() + projectPoints(objectPoints, imagePoints, affine.rvec(), affine.translation(), K, D, alpha, jacobian); } void cv::fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray _rvec, InputArray _tvec, InputArray _K, InputArray _D, double alpha, OutputArray jacobian) { + CV_INSTRUMENT_REGION() + // will support only 3-channel data now for points CV_Assert(objectPoints.type() == CV_32FC3 || objectPoints.type() == CV_64FC3); imagePoints.create(objectPoints.size(), CV_MAKETYPE(objectPoints.depth(), 2)); @@ -249,6 +253,8 @@ void cv::fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints void cv::fisheye::distortPoints(InputArray undistorted, OutputArray distorted, InputArray K, InputArray D, double alpha) { + CV_INSTRUMENT_REGION() + // will support only 2-channel data now for points CV_Assert(undistorted.type() == CV_32FC2 || undistorted.type() == CV_64FC2); distorted.create(undistorted.size(), undistorted.type()); @@ -311,6 +317,8 @@ void cv::fisheye::distortPoints(InputArray undistorted, OutputArray distorted, I void cv::fisheye::undistortPoints( InputArray distorted, OutputArray undistorted, InputArray K, InputArray D, InputArray R, InputArray P) { + CV_INSTRUMENT_REGION() + // will support only 2-channel data now for points CV_Assert(distorted.type() == CV_32FC2 || distorted.type() == CV_64FC2); undistorted.create(distorted.size(), distorted.type()); @@ -401,6 +409,8 @@ void cv::fisheye::undistortPoints( InputArray distorted, OutputArray undistorted void cv::fisheye::initUndistortRectifyMap( InputArray K, InputArray D, InputArray R, InputArray P, const cv::Size& size, int m1type, OutputArray map1, OutputArray map2 ) { + CV_INSTRUMENT_REGION() + CV_Assert( m1type == CV_16SC2 || m1type == CV_32F || m1type <=0 ); map1.create( size, m1type <= 0 ? CV_16SC2 : m1type ); map2.create( size, map1.type() == CV_16SC2 ? CV_16UC1 : CV_32F ); @@ -497,6 +507,8 @@ void cv::fisheye::initUndistortRectifyMap( InputArray K, InputArray D, InputArra void cv::fisheye::undistortImage(InputArray distorted, OutputArray undistorted, InputArray K, InputArray D, InputArray Knew, const Size& new_size) { + CV_INSTRUMENT_REGION() + Size size = new_size.area() != 0 ? new_size : distorted.size(); cv::Mat map1, map2; @@ -511,6 +523,8 @@ void cv::fisheye::undistortImage(InputArray distorted, OutputArray undistorted, void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, InputArray D, const Size &image_size, InputArray R, OutputArray P, double balance, const Size& new_size, double fov_scale) { + CV_INSTRUMENT_REGION() + CV_Assert( K.size() == Size(3, 3) && (K.depth() == CV_32F || K.depth() == CV_64F)); CV_Assert(D.empty() || ((D.total() == 4) && (D.depth() == CV_32F || D.depth() == CV_64F))); @@ -609,6 +623,8 @@ void cv::fisheye::stereoRectify( InputArray K1, InputArray D1, InputArray K2, In InputArray _R, InputArray _tvec, OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, int flags, const Size& newImageSize, double balance, double fov_scale) { + CV_INSTRUMENT_REGION() + CV_Assert((_R.size() == Size(3, 3) || _R.total() * _R.channels() == 3) && (_R.depth() == CV_32F || _R.depth() == CV_64F)); CV_Assert(_tvec.total() * _tvec.channels() == 3 && (_tvec.depth() == CV_32F || _tvec.depth() == CV_64F)); @@ -691,6 +707,8 @@ double cv::fisheye::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArray InputOutputArray K, InputOutputArray D, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags , cv::TermCriteria criteria) { + CV_INSTRUMENT_REGION() + CV_Assert(!objectPoints.empty() && !imagePoints.empty() && objectPoints.total() == imagePoints.total()); CV_Assert(objectPoints.type() == CV_32FC3 || objectPoints.type() == CV_64FC3); CV_Assert(imagePoints.type() == CV_32FC2 || imagePoints.type() == CV_64FC2); @@ -828,6 +846,8 @@ double cv::fisheye::stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayO InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize, OutputArray R, OutputArray T, int flags, TermCriteria criteria) { + CV_INSTRUMENT_REGION() + CV_Assert(!objectPoints.empty() && !imagePoints1.empty() && !imagePoints2.empty()); CV_Assert(objectPoints.total() == imagePoints1.total() || imagePoints1.total() == imagePoints2.total()); CV_Assert(objectPoints.type() == CV_32FC3 || objectPoints.type() == CV_64FC3); @@ -1150,6 +1170,8 @@ void cv::internal::projectPoints(cv::InputArray objectPoints, cv::OutputArray im cv::InputArray _rvec,cv::InputArray _tvec, const IntrinsicParams& param, cv::OutputArray jacobian) { + CV_INSTRUMENT_REGION() + CV_Assert(!objectPoints.empty() && objectPoints.type() == CV_64FC3); Matx33d K(param.f[0], param.f[0] * param.alpha, param.c[0], 0, param.f[1], param.c[1], @@ -1202,6 +1224,8 @@ void cv::internal::ComputeExtrinsicRefine(const Mat& imagePoints, const Mat& obj cv::Mat cv::internal::ComputeHomography(Mat m, Mat M) { + CV_INSTRUMENT_REGION() + int Np = m.cols; if (m.rows < 3) @@ -1301,6 +1325,8 @@ cv::Mat cv::internal::ComputeHomography(Mat m, Mat M) cv::Mat cv::internal::NormalizePixels(const Mat& imagePoints, const IntrinsicParams& param) { + CV_INSTRUMENT_REGION() + CV_Assert(!imagePoints.empty() && imagePoints.type() == CV_64FC2); Mat distorted((int)imagePoints.total(), 1, CV_64FC2), undistorted; diff --git a/modules/calib3d/src/five-point.cpp b/modules/calib3d/src/five-point.cpp index 92e652b0e8..1d39e20f87 100644 --- a/modules/calib3d/src/five-point.cpp +++ b/modules/calib3d/src/five-point.cpp @@ -405,6 +405,8 @@ protected: cv::Mat cv::findEssentialMat( InputArray _points1, InputArray _points2, InputArray _cameraMatrix, int method, double prob, double threshold, OutputArray _mask) { + CV_INSTRUMENT_REGION() + Mat points1, points2, cameraMatrix; _points1.getMat().convertTo(points1, CV_64F); _points2.getMat().convertTo(points2, CV_64F); @@ -450,6 +452,8 @@ cv::Mat cv::findEssentialMat( InputArray _points1, InputArray _points2, InputArr cv::Mat cv::findEssentialMat( InputArray _points1, InputArray _points2, double focal, Point2d pp, int method, double prob, double threshold, OutputArray _mask) { + CV_INSTRUMENT_REGION() + Mat cameraMatrix = (Mat_(3,3) << focal, 0, pp.x, 0, focal, pp.y, 0, 0, 1); return cv::findEssentialMat(_points1, _points2, cameraMatrix, method, prob, threshold, _mask); } @@ -457,6 +461,8 @@ cv::Mat cv::findEssentialMat( InputArray _points1, InputArray _points2, double f int cv::recoverPose( InputArray E, InputArray _points1, InputArray _points2, InputArray _cameraMatrix, OutputArray _R, OutputArray _t, InputOutputArray _mask) { + CV_INSTRUMENT_REGION() + Mat points1, points2, cameraMatrix; _points1.getMat().convertTo(points1, CV_64F); _points2.getMat().convertTo(points2, CV_64F); @@ -616,6 +622,8 @@ int cv::recoverPose( InputArray E, InputArray _points1, InputArray _points2, Out void cv::decomposeEssentialMat( InputArray _E, OutputArray _R1, OutputArray _R2, OutputArray _t ) { + CV_INSTRUMENT_REGION() + Mat E = _E.getMat().reshape(1, 3); CV_Assert(E.cols == 3 && E.rows == 3); diff --git a/modules/calib3d/src/fundam.cpp b/modules/calib3d/src/fundam.cpp index 4a7db9689d..cdcbeadd77 100644 --- a/modules/calib3d/src/fundam.cpp +++ b/modules/calib3d/src/fundam.cpp @@ -343,6 +343,8 @@ cv::Mat cv::findHomography( InputArray _points1, InputArray _points2, int method, double ransacReprojThreshold, OutputArray _mask, const int maxIters, const double confidence) { + CV_INSTRUMENT_REGION() + const double defaultRANSACReprojThreshold = 3; bool result = false; @@ -714,6 +716,8 @@ cv::Mat cv::findFundamentalMat( InputArray _points1, InputArray _points2, int method, double param1, double param2, OutputArray _mask ) { + CV_INSTRUMENT_REGION() + Mat points1 = _points1.getMat(), points2 = _points2.getMat(); Mat m1, m2, F; int npoints = -1; @@ -783,6 +787,8 @@ cv::Mat cv::findFundamentalMat( InputArray _points1, InputArray _points2, void cv::computeCorrespondEpilines( InputArray _points, int whichImage, InputArray _Fmat, OutputArray _lines ) { + CV_INSTRUMENT_REGION() + double f[9]; Mat tempF(3, 3, CV_64F, f); Mat points = _points.getMat(), F = _Fmat.getMat(); @@ -856,6 +862,8 @@ void cv::computeCorrespondEpilines( InputArray _points, int whichImage, void cv::convertPointsFromHomogeneous( InputArray _src, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); if( !src.isContinuous() ) src = src.clone(); @@ -955,6 +963,8 @@ void cv::convertPointsFromHomogeneous( InputArray _src, OutputArray _dst ) void cv::convertPointsToHomogeneous( InputArray _src, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); if( !src.isContinuous() ) src = src.clone(); @@ -1036,6 +1046,8 @@ void cv::convertPointsToHomogeneous( InputArray _src, OutputArray _dst ) void cv::convertPointsHomogeneous( InputArray _src, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + int stype = _src.type(), dtype = _dst.type(); CV_Assert( _dst.fixedType() ); @@ -1045,7 +1057,10 @@ void cv::convertPointsHomogeneous( InputArray _src, OutputArray _dst ) convertPointsToHomogeneous(_src, _dst); } -double cv::sampsonDistance(InputArray _pt1, InputArray _pt2, InputArray _F) { +double cv::sampsonDistance(InputArray _pt1, InputArray _pt2, InputArray _F) +{ + CV_INSTRUMENT_REGION() + CV_Assert(_pt1.type() == CV_64F && _pt2.type() == CV_64F && _F.type() == CV_64F); CV_DbgAssert(_pt1.rows() == 3 && _F.size() == Size(3, 3) && _pt1.rows() == _pt2.rows()); diff --git a/modules/calib3d/src/p3p.cpp b/modules/calib3d/src/p3p.cpp index 882868d6b8..f91925b219 100644 --- a/modules/calib3d/src/p3p.cpp +++ b/modules/calib3d/src/p3p.cpp @@ -33,6 +33,8 @@ p3p::p3p(double _fx, double _fy, double _cx, double _cy) bool p3p::solve(cv::Mat& R, cv::Mat& tvec, const cv::Mat& opoints, const cv::Mat& ipoints) { + CV_INSTRUMENT_REGION() + double rotation_matrix[3][3], translation[3]; std::vector points; if (opoints.depth() == ipoints.depth()) diff --git a/modules/calib3d/src/ptsetreg.cpp b/modules/calib3d/src/ptsetreg.cpp index 463027d510..830fa8ae1a 100644 --- a/modules/calib3d/src/ptsetreg.cpp +++ b/modules/calib3d/src/ptsetreg.cpp @@ -507,6 +507,8 @@ int cv::estimateAffine3D(InputArray _from, InputArray _to, OutputArray _out, OutputArray _inliers, double param1, double param2) { + CV_INSTRUMENT_REGION() + Mat from = _from.getMat(), to = _to.getMat(); int count = from.checkVector(3); diff --git a/modules/calib3d/src/quadsubpix.cpp b/modules/calib3d/src/quadsubpix.cpp index 2e98a462b5..a640a67e40 100644 --- a/modules/calib3d/src/quadsubpix.cpp +++ b/modules/calib3d/src/quadsubpix.cpp @@ -163,6 +163,8 @@ static int segment_hist_max(const Mat& hist, int& low_thresh, int& high_thresh) bool cv::find4QuadCornerSubpix(InputArray _img, InputOutputArray _corners, Size region_size) { + CV_INSTRUMENT_REGION() + Mat img = _img.getMat(), cornersM = _corners.getMat(); int ncorners = cornersM.checkVector(2, CV_32F); CV_Assert( ncorners >= 0 ); diff --git a/modules/calib3d/src/solvepnp.cpp b/modules/calib3d/src/solvepnp.cpp index 12dcb4a6ca..84a3256739 100644 --- a/modules/calib3d/src/solvepnp.cpp +++ b/modules/calib3d/src/solvepnp.cpp @@ -56,6 +56,8 @@ bool solvePnP( InputArray _opoints, InputArray _ipoints, InputArray _cameraMatrix, InputArray _distCoeffs, OutputArray _rvec, OutputArray _tvec, bool useExtrinsicGuess, int flags ) { + CV_INSTRUMENT_REGION() + Mat opoints = _opoints.getMat(), ipoints = _ipoints.getMat(); int npoints = std::max(opoints.checkVector(3, CV_32F), opoints.checkVector(3, CV_64F)); CV_Assert( npoints >= 0 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) ); @@ -214,6 +216,7 @@ bool solvePnPRansac(InputArray _opoints, InputArray _ipoints, int iterationsCount, float reprojectionError, double confidence, OutputArray _inliers, int flags) { + CV_INSTRUMENT_REGION() Mat opoints0 = _opoints.getMat(), ipoints0 = _ipoints.getMat(); Mat opoints, ipoints; diff --git a/modules/calib3d/src/stereobm.cpp b/modules/calib3d/src/stereobm.cpp index c4278b3617..3c868b97a7 100644 --- a/modules/calib3d/src/stereobm.cpp +++ b/modules/calib3d/src/stereobm.cpp @@ -1061,6 +1061,8 @@ public: void compute( InputArray leftarr, InputArray rightarr, OutputArray disparr ) { + CV_INSTRUMENT_REGION() + int dtype = disparr.fixedType() ? disparr.type() : params.dispType; Size leftsize = leftarr.size(); diff --git a/modules/calib3d/src/stereosgbm.cpp b/modules/calib3d/src/stereosgbm.cpp index c7dd8b9fcd..cb14a1c89a 100644 --- a/modules/calib3d/src/stereosgbm.cpp +++ b/modules/calib3d/src/stereosgbm.cpp @@ -1494,6 +1494,8 @@ public: void compute( InputArray leftarr, InputArray rightarr, OutputArray disparr ) { + CV_INSTRUMENT_REGION() + Mat left = leftarr.getMat(), right = rightarr.getMat(); CV_Assert( left.size() == right.size() && left.type() == right.type() && left.depth() == CV_8U ); @@ -1728,6 +1730,8 @@ void filterSpecklesImpl(cv::Mat& img, int newVal, int maxSpeckleSize, int maxDif #ifdef HAVE_IPP static bool ipp_filterSpeckles(Mat &img, int maxSpeckleSize, int newVal, int maxDiff) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 810 int type = img.type(); Ipp32s bufsize = 0; @@ -1745,12 +1749,12 @@ static bool ipp_filterSpeckles(Mat &img, int maxSpeckleSize, int newVal, int max if (type == CV_8UC1) { - status = ippiMarkSpeckles_8u_C1IR(img.ptr(), (int)img.step, roisize, + status = CV_INSTRUMENT_FUN_IPP(ippiMarkSpeckles_8u_C1IR, img.ptr(), (int)img.step, roisize, (Ipp8u)newVal, maxSpeckleSize, (Ipp8u)maxDiff, ippiNormL1, pBuffer); } else { - status = ippiMarkSpeckles_16s_C1IR(img.ptr(), (int)img.step, roisize, + status = CV_INSTRUMENT_FUN_IPP(ippiMarkSpeckles_16s_C1IR, img.ptr(), (int)img.step, roisize, (Ipp16s)newVal, maxSpeckleSize, (Ipp16s)maxDiff, ippiNormL1, pBuffer); } if(pBuffer) ippFree(pBuffer); @@ -1769,6 +1773,8 @@ static bool ipp_filterSpeckles(Mat &img, int maxSpeckleSize, int newVal, int max void cv::filterSpeckles( InputOutputArray _img, double _newval, int maxSpeckleSize, double _maxDiff, InputOutputArray __buf ) { + CV_INSTRUMENT_REGION() + Mat img = _img.getMat(); int type = img.type(); Mat temp, &_buf = __buf.needed() ? __buf.getMatRef() : temp; @@ -1787,6 +1793,8 @@ void cv::filterSpeckles( InputOutputArray _img, double _newval, int maxSpeckleSi void cv::validateDisparity( InputOutputArray _disp, InputArray _cost, int minDisparity, int numberOfDisparities, int disp12MaxDiff ) { + CV_INSTRUMENT_REGION() + Mat disp = _disp.getMat(), cost = _cost.getMat(); int cols = disp.cols, rows = disp.rows; int minD = minDisparity, maxD = minDisparity + numberOfDisparities; diff --git a/modules/calib3d/src/triangulate.cpp b/modules/calib3d/src/triangulate.cpp index 0fa5e3d9ef..33c7fd774d 100644 --- a/modules/calib3d/src/triangulate.cpp +++ b/modules/calib3d/src/triangulate.cpp @@ -393,6 +393,8 @@ void cv::triangulatePoints( InputArray _projMatr1, InputArray _projMatr2, InputArray _projPoints1, InputArray _projPoints2, OutputArray _points4D ) { + CV_INSTRUMENT_REGION() + Mat matr1 = _projMatr1.getMat(), matr2 = _projMatr2.getMat(); Mat points1 = _projPoints1.getMat(), points2 = _projPoints2.getMat(); @@ -414,6 +416,8 @@ void cv::triangulatePoints( InputArray _projMatr1, InputArray _projMatr2, void cv::correctMatches( InputArray _F, InputArray _points1, InputArray _points2, OutputArray _newPoints1, OutputArray _newPoints2 ) { + CV_INSTRUMENT_REGION() + Mat F = _F.getMat(); Mat points1 = _points1.getMat(), points2 = _points2.getMat(); diff --git a/modules/core/include/opencv2/core/utility.hpp b/modules/core/include/opencv2/core/utility.hpp index 911f779f38..ba1f5c3c74 100644 --- a/modules/core/include/opencv2/core/utility.hpp +++ b/modules/core/include/opencv2/core/utility.hpp @@ -1096,11 +1096,6 @@ enum FLAGS_MAPPING = 0x01, }; -enum -{ - COMMAND_RESET = 0x01, -}; - class CV_EXPORTS NodeData { public: diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index fc20a18311..4b1c67339b 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -369,58 +369,78 @@ static BinaryFuncC* getMinTab() void cv::bitwise_and(InputArray a, InputArray b, OutputArray c, InputArray mask) { + CV_INSTRUMENT_REGION() + BinaryFuncC f = (BinaryFuncC)GET_OPTIMIZED(cv::hal::and8u); binary_op(a, b, c, mask, &f, true, OCL_OP_AND); } void cv::bitwise_or(InputArray a, InputArray b, OutputArray c, InputArray mask) { + CV_INSTRUMENT_REGION() + BinaryFuncC f = (BinaryFuncC)GET_OPTIMIZED(cv::hal::or8u); binary_op(a, b, c, mask, &f, true, OCL_OP_OR); } void cv::bitwise_xor(InputArray a, InputArray b, OutputArray c, InputArray mask) { + CV_INSTRUMENT_REGION() + BinaryFuncC f = (BinaryFuncC)GET_OPTIMIZED(cv::hal::xor8u); binary_op(a, b, c, mask, &f, true, OCL_OP_XOR); } void cv::bitwise_not(InputArray a, OutputArray c, InputArray mask) { + CV_INSTRUMENT_REGION() + BinaryFuncC f = (BinaryFuncC)GET_OPTIMIZED(cv::hal::not8u); binary_op(a, a, c, mask, &f, true, OCL_OP_NOT); } void cv::max( InputArray src1, InputArray src2, OutputArray dst ) { + CV_INSTRUMENT_REGION() + binary_op(src1, src2, dst, noArray(), getMaxTab(), false, OCL_OP_MAX ); } void cv::min( InputArray src1, InputArray src2, OutputArray dst ) { + CV_INSTRUMENT_REGION() + binary_op(src1, src2, dst, noArray(), getMinTab(), false, OCL_OP_MIN ); } void cv::max(const Mat& src1, const Mat& src2, Mat& dst) { + CV_INSTRUMENT_REGION() + OutputArray _dst(dst); binary_op(src1, src2, _dst, noArray(), getMaxTab(), false, OCL_OP_MAX ); } void cv::min(const Mat& src1, const Mat& src2, Mat& dst) { + CV_INSTRUMENT_REGION() + OutputArray _dst(dst); binary_op(src1, src2, _dst, noArray(), getMinTab(), false, OCL_OP_MIN ); } void cv::max(const UMat& src1, const UMat& src2, UMat& dst) { + CV_INSTRUMENT_REGION() + OutputArray _dst(dst); binary_op(src1, src2, _dst, noArray(), getMaxTab(), false, OCL_OP_MAX ); } void cv::min(const UMat& src1, const UMat& src2, UMat& dst) { + CV_INSTRUMENT_REGION() + OutputArray _dst(dst); binary_op(src1, src2, _dst, noArray(), getMinTab(), false, OCL_OP_MIN ); } @@ -901,12 +921,16 @@ static BinaryFuncC* getAbsDiffTab() void cv::add( InputArray src1, InputArray src2, OutputArray dst, InputArray mask, int dtype ) { + CV_INSTRUMENT_REGION() + arithm_op(src1, src2, dst, mask, dtype, getAddTab(), false, 0, OCL_OP_ADD ); } void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst, InputArray mask, int dtype ) { + CV_INSTRUMENT_REGION() + #ifdef HAVE_TEGRA_OPTIMIZATION if (tegra::useTegra()) { @@ -965,6 +989,8 @@ void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst, void cv::absdiff( InputArray src1, InputArray src2, OutputArray dst ) { + CV_INSTRUMENT_REGION() + arithm_op(src1, src2, dst, noArray(), -1, getAbsDiffTab(), false, 0, OCL_OP_ABSDIFF); } @@ -1016,6 +1042,8 @@ static BinaryFuncC* getRecipTab() void cv::multiply(InputArray src1, InputArray src2, OutputArray dst, double scale, int dtype) { + CV_INSTRUMENT_REGION() + arithm_op(src1, src2, dst, noArray(), dtype, getMulTab(), true, &scale, std::abs(scale - 1.0) < DBL_EPSILON ? OCL_OP_MUL : OCL_OP_MUL_SCALE); } @@ -1023,12 +1051,16 @@ void cv::multiply(InputArray src1, InputArray src2, void cv::divide(InputArray src1, InputArray src2, OutputArray dst, double scale, int dtype) { + CV_INSTRUMENT_REGION() + arithm_op(src1, src2, dst, noArray(), dtype, getDivTab(), true, &scale, OCL_OP_DIV_SCALE); } void cv::divide(double scale, InputArray src2, OutputArray dst, int dtype) { + CV_INSTRUMENT_REGION() + arithm_op(src2, src2, dst, noArray(), dtype, getRecipTab(), true, &scale, OCL_OP_RECIP_SCALE); } @@ -1056,6 +1088,8 @@ static BinaryFuncC* getAddWeightedTab() void cv::addWeighted( InputArray src1, double alpha, InputArray src2, double beta, double gamma, OutputArray dst, int dtype ) { + CV_INSTRUMENT_REGION() + double scalars[] = {alpha, beta, gamma}; arithm_op(src1, src2, dst, noArray(), dtype, getAddWeightedTab(), true, scalars, OCL_OP_ADDW); } @@ -1194,6 +1228,8 @@ static bool ocl_compare(InputArray _src1, InputArray _src2, OutputArray _dst, in void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op) { + CV_INSTRUMENT_REGION() + CV_Assert( op == CMP_LT || op == CMP_LE || op == CMP_EQ || op == CMP_NE || op == CMP_GE || op == CMP_GT ); @@ -1889,6 +1925,8 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb, void cv::inRange(InputArray _src, InputArray _lowerb, InputArray _upperb, OutputArray _dst) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_src.dims() <= 2 && _lowerb.dims() <= 2 && _upperb.dims() <= 2 && OCL_PERFORMANCE_CHECK(_dst.isUMat()), ocl_inRange(_src, _lowerb, _upperb, _dst)) @@ -2274,7 +2312,7 @@ static inline void fixSteps(int width, int height, size_t elemSize, size_t& step CV_IPP_CHECK() \ { \ fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \ - if (0 <= fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), 0)) \ + if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), 0)) \ { \ CV_IMPL_ADD(CV_IMPL_IPP); \ return; \ @@ -2286,7 +2324,7 @@ static inline void fixSteps(int width, int height, size_t elemSize, size_t& step CV_IPP_CHECK() \ { \ fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \ - if (0 <= fun(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(width, height), 0)) \ + if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(width, height), 0)) \ { \ CV_IMPL_ADD(CV_IMPL_IPP); \ return; \ @@ -2298,7 +2336,7 @@ static inline void fixSteps(int width, int height, size_t elemSize, size_t& step CV_IPP_CHECK() \ { \ fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \ - if (0 <= fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height))) \ + if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height))) \ { \ CV_IMPL_ADD(CV_IMPL_IPP); \ return; \ @@ -2310,7 +2348,7 @@ static inline void fixSteps(int width, int height, size_t elemSize, size_t& step CV_IPP_CHECK() \ { \ fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \ - if (0 <= fun(src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(width, height))) \ + if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src2, (int)step2, src1, (int)step1, dst, (int)step, ippiSize(width, height))) \ { \ CV_IMPL_ADD(CV_IMPL_IPP); \ return; \ @@ -2467,7 +2505,7 @@ void sub64f( const double* src1, size_t step1, int i = 0; \ for(; i < height; i++) \ { \ - if (0 > fun(s1, s2, d, width)) \ + if (0 > CV_INSTRUMENT_FUN_IPP(fun, s1, s2, d, width)) \ break; \ s1 = (type*)((uchar*)s1 + step1); \ s2 = (type*)((uchar*)s2 + step2); \ @@ -2684,7 +2722,7 @@ void absdiff64f( const double* src1, size_t step1, CV_IPP_CHECK() \ { \ fixSteps(width, height, sizeof(dst[0]), step1, step2, step); (void)src2; \ - if (0 <= fun(src1, (int)step1, dst, (int)step, ippiSize(width, height))) \ + if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, dst, (int)step, ippiSize(width, height))) \ { \ CV_IMPL_ADD(CV_IMPL_IPP); \ return; \ @@ -2750,7 +2788,7 @@ inline static IppCmpOp convert_cmp(int _cmpop) if( op >= 0 ) \ { \ fixSteps(width, height, sizeof(dst[0]), step1, step2, step); \ - if (0 <= fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), op)) \ + if (0 <= CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), op)) \ { \ CV_IMPL_ADD(CV_IMPL_IPP); \ return; \ @@ -3023,7 +3061,7 @@ void cmp64f(const double* src1, size_t step1, const double* src2, size_t step2, { \ if (std::fabs(fscale - 1) <= FLT_EPSILON) \ { \ - if (fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), 0) >= 0) \ + if (CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height), 0) >= 0) \ { \ CV_IMPL_ADD(CV_IMPL_IPP); \ return; \ @@ -3037,7 +3075,7 @@ void cmp64f(const double* src1, size_t step1, const double* src2, size_t step2, { \ if (std::fabs(fscale - 1) <= FLT_EPSILON) \ { \ - if (fun(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height)) >= 0) \ + if (CV_INSTRUMENT_FUN_IPP(fun, src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(width, height)) >= 0) \ { \ CV_IMPL_ADD(CV_IMPL_IPP); \ return; \ diff --git a/modules/core/src/convert.cpp b/modules/core/src/convert.cpp index 1b7f77cb8d..a547777cba 100644 --- a/modules/core/src/convert.cpp +++ b/modules/core/src/convert.cpp @@ -84,6 +84,8 @@ static MergeFunc getMergeFunc(int depth) void cv::split(const Mat& src, Mat* mv) { + CV_INSTRUMENT_REGION() + int k, depth = src.depth(), cn = src.channels(); if( cn == 1 ) { @@ -176,6 +178,8 @@ static bool ocl_split( InputArray _m, OutputArrayOfArrays _mv ) void cv::split(InputArray _m, OutputArrayOfArrays _mv) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_m.dims() <= 2 && _mv.isUMatVector(), ocl_split(_m, _mv)) @@ -201,6 +205,8 @@ void cv::split(InputArray _m, OutputArrayOfArrays _mv) void cv::merge(const Mat* mv, size_t n, OutputArray _dst) { + CV_INSTRUMENT_REGION() + CV_Assert( mv && n > 0 ); int depth = mv[0].depth(); @@ -345,6 +351,8 @@ static bool ocl_merge( InputArrayOfArrays _mv, OutputArray _dst ) void cv::merge(InputArrayOfArrays _mv, OutputArray _dst) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_mv.isUMatVector() && _dst.isUMat(), ocl_merge(_mv, _dst)) @@ -439,6 +447,8 @@ static MixChannelsFunc getMixchFunc(int depth) void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, const int* fromTo, size_t npairs ) { + CV_INSTRUMENT_REGION() + if( npairs == 0 ) return; CV_Assert( src && nsrcs > 0 && dst && ndsts > 0 && fromTo && npairs > 0 ); @@ -615,6 +625,8 @@ static bool ocl_mixChannels(InputArrayOfArrays _src, InputOutputArrayOfArrays _d void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst, const int* fromTo, size_t npairs) { + CV_INSTRUMENT_REGION() + if (npairs == 0 || fromTo == NULL) return; @@ -644,6 +656,8 @@ void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst, void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst, const std::vector& fromTo) { + CV_INSTRUMENT_REGION() + if (fromTo.empty()) return; @@ -672,6 +686,8 @@ void cv::mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst, void cv::extractChannel(InputArray _src, OutputArray _dst, int coi) { + CV_INSTRUMENT_REGION() + int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); CV_Assert( 0 <= coi && coi < cn ); int ch[] = { coi, 0 }; @@ -693,6 +709,8 @@ void cv::extractChannel(InputArray _src, OutputArray _dst, int coi) void cv::insertChannel(InputArray _src, InputOutputArray _dst, int coi) { + CV_INSTRUMENT_REGION() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype); int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype), dcn = CV_MAT_CN(dtype); CV_Assert( _src.sameSize(_dst) && sdepth == ddepth ); @@ -4777,7 +4795,7 @@ dtype* dst, size_t dstep, Size size, double* scale) \ static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \ dtype* dst, size_t dstep, Size size, double*) \ { \ - CV_IPP_RUN(src && dst, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0)\ + CV_IPP_RUN(src && dst, CV_INSTRUMENT_FUN_IPP(ippiConvert_##ippFavor, src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height)) >= 0) \ cvt_(src, sstep, dst, dstep, size); \ } @@ -4785,7 +4803,7 @@ static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \ static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \ dtype* dst, size_t dstep, Size size, double*) \ { \ - CV_IPP_RUN(src && dst, ippiConvert_##ippFavor(src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0)\ + CV_IPP_RUN(src && dst, CV_INSTRUMENT_FUN_IPP(ippiConvert_##ippFavor, src, (int)sstep, dst, (int)dstep, ippiSize(size.width, size.height), ippRndFinancial, 0) >= 0) \ cvt_(src, sstep, dst, dstep, size); \ } #else @@ -5112,6 +5130,8 @@ static bool ocl_convertScaleAbs( InputArray _src, OutputArray _dst, double alpha void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, double beta ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(), ocl_convertScaleAbs(_src, _dst, alpha, beta)) @@ -5142,6 +5162,8 @@ void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, doubl void cv::convertFp16( InputArray _src, OutputArray _dst) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); int ddepth = 0; @@ -5184,6 +5206,8 @@ void cv::convertFp16( InputArray _src, OutputArray _dst) void cv::Mat::convertTo(OutputArray _dst, int _type, double alpha, double beta) const { + CV_INSTRUMENT_REGION() + bool noScale = fabs(alpha-1) < DBL_EPSILON && fabs(beta) < DBL_EPSILON; if( _type < 0 ) @@ -5408,7 +5432,7 @@ public: CV_DbgAssert(lutcn == 3 || lutcn == 4); if (lutcn == 3) { - IppStatus status = ippiCopy_8u_C3P3R(lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256); + IppStatus status = CV_INSTRUMENT_FUN_IPP(ippiCopy_8u_C3P3R, lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256); if (status < 0) { setIppErrorStatus(); @@ -5418,7 +5442,7 @@ public: } else if (lutcn == 4) { - IppStatus status = ippiCopy_8u_C4P4R(lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256); + IppStatus status = CV_INSTRUMENT_FUN_IPP(ippiCopy_8u_C4P4R, lut.ptr(), (int)lut.step[0], lutTable, (int)lut.step[0], sz256); if (status < 0) { setIppErrorStatus(); @@ -5451,7 +5475,7 @@ public: if (lutcn == 3) { - if (ippiLUTPalette_8u_C3R( + if (CV_INSTRUMENT_FUN_IPP(ippiLUTPalette_8u_C3R, src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0], ippiSize(dst.size()), lutTable, 8) >= 0) { @@ -5461,7 +5485,7 @@ public: } else if (lutcn == 4) { - if (ippiLUTPalette_8u_C4R( + if (CV_INSTRUMENT_FUN_IPP(ippiLUTPalette_8u_C4R, src.ptr(), (int)src.step[0], dst.ptr(), (int)dst.step[0], ippiSize(dst.size()), lutTable, 8) >= 0) { @@ -5480,6 +5504,8 @@ private: static bool ipp_lut(Mat &src, Mat &lut, Mat &dst) { + CV_INSTRUMENT_REGION_IPP() + int lutcn = lut.channels(); if(src.dims > 2) @@ -5565,6 +5591,8 @@ private: void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + int cn = _src.channels(), depth = _src.depth(); int lutcn = _lut.channels(); @@ -5712,6 +5740,8 @@ static bool ocl_normalize( InputArray _src, InputOutputArray _dst, InputArray _m void cv::normalize( InputArray _src, InputOutputArray _dst, double a, double b, int norm_type, int rtype, InputArray _mask ) { + CV_INSTRUMENT_REGION() + double scale = 1, shift = 0; if( norm_type == CV_MINMAX ) { diff --git a/modules/core/src/copy.cpp b/modules/core/src/copy.cpp index 5acb1dac0a..7149b8f37f 100644 --- a/modules/core/src/copy.cpp +++ b/modules/core/src/copy.cpp @@ -82,7 +82,7 @@ copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, ucha template<> void copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size) { - CV_IPP_RUN(true, ippiCopy_8u_C1MR(_src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0) + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippiCopy_8u_C1MR, _src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0) for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep ) { @@ -122,7 +122,7 @@ copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mste template<> void copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, uchar* _dst, size_t dstep, Size size) { - CV_IPP_RUN(true, ippiCopy_16u_C1MR((const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0) + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippiCopy_16u_C1MR, (const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0) for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep ) { @@ -194,7 +194,7 @@ static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask, static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask, size_t mstep, \ uchar* dst, size_t dstep, Size size, void*) \ { \ - CV_IPP_RUN(true, ippiCopy_##ippfavor((const ipptype *)src, (int)sstep, (ipptype *)dst, (int)dstep, ippiSize(size), (const Ipp8u *)mask, (int)mstep) >= 0)\ + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippiCopy_##ippfavor, (const ipptype *)src, (int)sstep, (ipptype *)dst, (int)dstep, ippiSize(size), (const Ipp8u *)mask, (int)mstep) >= 0)\ copyMask_(src, sstep, mask, mstep, dst, dstep, size); \ } #else @@ -251,6 +251,8 @@ BinaryFunc getCopyMaskFunc(size_t esz) /* dst = src */ void Mat::copyTo( OutputArray _dst ) const { + CV_INSTRUMENT_REGION() + int dtype = _dst.type(); if( _dst.fixedType() && dtype != type() ) { @@ -296,7 +298,7 @@ void Mat::copyTo( OutputArray _dst ) const (size_t)step <= (size_t)INT_MAX && (size_t)dst.step <= (size_t)INT_MAX , - ippiCopy_8u_C1R(sptr, (int)step, dptr, (int)dst.step, ippiSize((int)(cols*elemSize()), rows)) >= 0 + CV_INSTRUMENT_FUN_IPP(ippiCopy_8u_C1R, sptr, (int)step, dptr, (int)dst.step, ippiSize((int)(cols*elemSize()), rows)) >= 0 ) Size sz = getContinuousSize(*this, dst); @@ -327,6 +329,8 @@ void Mat::copyTo( OutputArray _dst ) const void Mat::copyTo( OutputArray _dst, InputArray _mask ) const { + CV_INSTRUMENT_REGION() + Mat mask = _mask.getMat(); if( !mask.data ) { @@ -367,6 +371,8 @@ void Mat::copyTo( OutputArray _dst, InputArray _mask ) const Mat& Mat::operator = (const Scalar& s) { + CV_INSTRUMENT_REGION() + const Mat* arrays[] = { this }; uchar* dptr; NAryMatIterator it(arrays, &dptr, 1); @@ -435,6 +441,8 @@ Mat& Mat::operator = (const Scalar& s) #if defined HAVE_IPP static bool ipp_Mat_setTo(Mat *src, Mat &value, Mat &mask) { + CV_INSTRUMENT_REGION_IPP() + int cn = src->channels(), depth0 = src->depth(); if (!mask.empty() && (src->dims <= 2 || (src->isContinuous() && mask.isContinuous())) && @@ -460,13 +468,13 @@ static bool ipp_Mat_setTo(Mat *src, Mat &value, Mat &mask) /*if (depth0 == CV_8U) status = ippiSet_8u_C1MR(*(Ipp8u *)buf, (Ipp8u *)data, dstep, roisize, mask.data, mstep); else*/ if (depth0 == CV_16U) - status = ippiSet_16u_C1MR(*(Ipp16u *)buf, (Ipp16u *)src->data, dstep, roisize, mask.data, mstep); + status = CV_INSTRUMENT_FUN_IPP(ippiSet_16u_C1MR, *(Ipp16u *)buf, (Ipp16u *)src->data, dstep, roisize, mask.data, mstep); else if (depth0 == CV_16S) - status = ippiSet_16s_C1MR(*(Ipp16s *)buf, (Ipp16s *)src->data, dstep, roisize, mask.data, mstep); + status = CV_INSTRUMENT_FUN_IPP(ippiSet_16s_C1MR, *(Ipp16s *)buf, (Ipp16s *)src->data, dstep, roisize, mask.data, mstep); else if (depth0 == CV_32S) - status = ippiSet_32s_C1MR(*(Ipp32s *)buf, (Ipp32s *)src->data, dstep, roisize, mask.data, mstep); + status = CV_INSTRUMENT_FUN_IPP(ippiSet_32s_C1MR, *(Ipp32s *)buf, (Ipp32s *)src->data, dstep, roisize, mask.data, mstep); else if (depth0 == CV_32F) - status = ippiSet_32f_C1MR(*(Ipp32f *)buf, (Ipp32f *)src->data, dstep, roisize, mask.data, mstep); + status = CV_INSTRUMENT_FUN_IPP(ippiSet_32f_C1MR, *(Ipp32f *)buf, (Ipp32f *)src->data, dstep, roisize, mask.data, mstep); } else if (cn == 3 || cn == 4) { @@ -476,7 +484,7 @@ static bool ipp_Mat_setTo(Mat *src, Mat &value, Mat &mask) { \ typedef Ipp##ippfavor ipptype; \ ipptype ippvalue[4] = { ((ipptype *)buf)[0], ((ipptype *)buf)[1], ((ipptype *)buf)[2], ((ipptype *)buf)[3] }; \ - status = ippiSet_##ippfavor##_C##ippcn##MR(ippvalue, (ipptype *)src->data, dstep, roisize, mask.data, mstep); \ + status = CV_INSTRUMENT_FUN_IPP(ippiSet_##ippfavor##_C##ippcn##MR, ippvalue, (ipptype *)src->data, dstep, roisize, mask.data, mstep); \ } while ((void)0, 0) #define IPP_SET_CN(ippcn) \ @@ -515,6 +523,8 @@ static bool ipp_Mat_setTo(Mat *src, Mat &value, Mat &mask) Mat& Mat::setTo(InputArray _value, InputArray _mask) { + CV_INSTRUMENT_REGION() + if( empty() ) return *this; @@ -523,7 +533,7 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask) CV_Assert( checkScalar(value, type(), _value.kind(), _InputArray::MAT )); CV_Assert( mask.empty() || (mask.type() == CV_8U && size == mask.size) ); - CV_IPP_RUN(true, ipp_Mat_setTo((cv::Mat*)this, value, mask), *this) + CV_IPP_RUN_FAST(ipp_Mat_setTo((cv::Mat*)this, value, mask), *this) size_t esz = elemSize(); BinaryFunc copymask = getCopyMaskFunc(esz); @@ -700,65 +710,67 @@ static bool ocl_flip(InputArray _src, OutputArray _dst, int flipCode ) #if defined HAVE_IPP static bool ipp_flip( Mat &src, Mat &dst, int flip_mode ) { + CV_INSTRUMENT_REGION_IPP() + int type = src.type(); - typedef IppStatus (CV_STDCALL * ippiMirror)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize, IppiAxis flip); - typedef IppStatus (CV_STDCALL * ippiMirrorI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize, IppiAxis flip); - ippiMirror ippFunc = 0; - ippiMirrorI ippFuncI = 0; + typedef IppStatus (CV_STDCALL * IppiMirror)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize, IppiAxis flip); + typedef IppStatus (CV_STDCALL * IppiMirrorI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize, IppiAxis flip); + IppiMirror ippiMirror = 0; + IppiMirrorI ippiMirror_I = 0; if (src.data == dst.data) { CV_SUPPRESS_DEPRECATED_START - ippFuncI = - type == CV_8UC1 ? (ippiMirrorI)ippiMirror_8u_C1IR : - type == CV_8UC3 ? (ippiMirrorI)ippiMirror_8u_C3IR : - type == CV_8UC4 ? (ippiMirrorI)ippiMirror_8u_C4IR : - type == CV_16UC1 ? (ippiMirrorI)ippiMirror_16u_C1IR : - type == CV_16UC3 ? (ippiMirrorI)ippiMirror_16u_C3IR : - type == CV_16UC4 ? (ippiMirrorI)ippiMirror_16u_C4IR : - type == CV_16SC1 ? (ippiMirrorI)ippiMirror_16s_C1IR : - type == CV_16SC3 ? (ippiMirrorI)ippiMirror_16s_C3IR : - type == CV_16SC4 ? (ippiMirrorI)ippiMirror_16s_C4IR : - type == CV_32SC1 ? (ippiMirrorI)ippiMirror_32s_C1IR : - type == CV_32SC3 ? (ippiMirrorI)ippiMirror_32s_C3IR : - type == CV_32SC4 ? (ippiMirrorI)ippiMirror_32s_C4IR : - type == CV_32FC1 ? (ippiMirrorI)ippiMirror_32f_C1IR : - type == CV_32FC3 ? (ippiMirrorI)ippiMirror_32f_C3IR : - type == CV_32FC4 ? (ippiMirrorI)ippiMirror_32f_C4IR : 0; + ippiMirror_I = + type == CV_8UC1 ? (IppiMirrorI)ippiMirror_8u_C1IR : + type == CV_8UC3 ? (IppiMirrorI)ippiMirror_8u_C3IR : + type == CV_8UC4 ? (IppiMirrorI)ippiMirror_8u_C4IR : + type == CV_16UC1 ? (IppiMirrorI)ippiMirror_16u_C1IR : + type == CV_16UC3 ? (IppiMirrorI)ippiMirror_16u_C3IR : + type == CV_16UC4 ? (IppiMirrorI)ippiMirror_16u_C4IR : + type == CV_16SC1 ? (IppiMirrorI)ippiMirror_16s_C1IR : + type == CV_16SC3 ? (IppiMirrorI)ippiMirror_16s_C3IR : + type == CV_16SC4 ? (IppiMirrorI)ippiMirror_16s_C4IR : + type == CV_32SC1 ? (IppiMirrorI)ippiMirror_32s_C1IR : + type == CV_32SC3 ? (IppiMirrorI)ippiMirror_32s_C3IR : + type == CV_32SC4 ? (IppiMirrorI)ippiMirror_32s_C4IR : + type == CV_32FC1 ? (IppiMirrorI)ippiMirror_32f_C1IR : + type == CV_32FC3 ? (IppiMirrorI)ippiMirror_32f_C3IR : + type == CV_32FC4 ? (IppiMirrorI)ippiMirror_32f_C4IR : 0; CV_SUPPRESS_DEPRECATED_END } else { - ippFunc = - type == CV_8UC1 ? (ippiMirror)ippiMirror_8u_C1R : - type == CV_8UC3 ? (ippiMirror)ippiMirror_8u_C3R : - type == CV_8UC4 ? (ippiMirror)ippiMirror_8u_C4R : - type == CV_16UC1 ? (ippiMirror)ippiMirror_16u_C1R : - type == CV_16UC3 ? (ippiMirror)ippiMirror_16u_C3R : - type == CV_16UC4 ? (ippiMirror)ippiMirror_16u_C4R : - type == CV_16SC1 ? (ippiMirror)ippiMirror_16s_C1R : - type == CV_16SC3 ? (ippiMirror)ippiMirror_16s_C3R : - type == CV_16SC4 ? (ippiMirror)ippiMirror_16s_C4R : - type == CV_32SC1 ? (ippiMirror)ippiMirror_32s_C1R : - type == CV_32SC3 ? (ippiMirror)ippiMirror_32s_C3R : - type == CV_32SC4 ? (ippiMirror)ippiMirror_32s_C4R : - type == CV_32FC1 ? (ippiMirror)ippiMirror_32f_C1R : - type == CV_32FC3 ? (ippiMirror)ippiMirror_32f_C3R : - type == CV_32FC4 ? (ippiMirror)ippiMirror_32f_C4R : 0; + ippiMirror = + type == CV_8UC1 ? (IppiMirror)ippiMirror_8u_C1R : + type == CV_8UC3 ? (IppiMirror)ippiMirror_8u_C3R : + type == CV_8UC4 ? (IppiMirror)ippiMirror_8u_C4R : + type == CV_16UC1 ? (IppiMirror)ippiMirror_16u_C1R : + type == CV_16UC3 ? (IppiMirror)ippiMirror_16u_C3R : + type == CV_16UC4 ? (IppiMirror)ippiMirror_16u_C4R : + type == CV_16SC1 ? (IppiMirror)ippiMirror_16s_C1R : + type == CV_16SC3 ? (IppiMirror)ippiMirror_16s_C3R : + type == CV_16SC4 ? (IppiMirror)ippiMirror_16s_C4R : + type == CV_32SC1 ? (IppiMirror)ippiMirror_32s_C1R : + type == CV_32SC3 ? (IppiMirror)ippiMirror_32s_C3R : + type == CV_32SC4 ? (IppiMirror)ippiMirror_32s_C4R : + type == CV_32FC1 ? (IppiMirror)ippiMirror_32f_C1R : + type == CV_32FC3 ? (IppiMirror)ippiMirror_32f_C3R : + type == CV_32FC4 ? (IppiMirror)ippiMirror_32f_C4R : 0; } IppiAxis axis = flip_mode == 0 ? ippAxsHorizontal : flip_mode > 0 ? ippAxsVertical : ippAxsBoth; IppiSize roisize = { dst.cols, dst.rows }; - if (ippFunc != 0) + if (ippiMirror != 0) { - if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, ippiSize(src.cols, src.rows), axis) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiMirror, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, ippiSize(src.cols, src.rows), axis) >= 0) return true; } - else if (ippFuncI != 0) + else if (ippiMirror_I != 0) { - if (ippFuncI(dst.ptr(), (int)dst.step, roisize, axis) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiMirror_I, dst.ptr(), (int)dst.step, roisize, axis) >= 0) return true; } @@ -769,6 +781,8 @@ static bool ipp_flip( Mat &src, Mat &dst, int flip_mode ) void flip( InputArray _src, OutputArray _dst, int flip_mode ) { + CV_INSTRUMENT_REGION() + CV_Assert( _src.dims() <= 2 ); Size size = _src.size(); @@ -794,7 +808,7 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode ) _dst.create( size, type ); Mat dst = _dst.getMat(); - CV_IPP_RUN(true, ipp_flip(src, dst, flip_mode)); + CV_IPP_RUN_FAST(ipp_flip(src, dst, flip_mode)); size_t esz = CV_ELEM_SIZE(type); @@ -839,6 +853,8 @@ static bool ocl_repeat(InputArray _src, int ny, int nx, OutputArray _dst) void repeat(InputArray _src, int ny, int nx, OutputArray _dst) { + CV_INSTRUMENT_REGION() + CV_Assert( _src.dims() <= 2 ); CV_Assert( ny > 0 && nx > 0 ); @@ -890,6 +906,8 @@ Mat repeat(const Mat& src, int ny, int nx) */ int cv::borderInterpolate( int p, int len, int borderType ) { + CV_INSTRUMENT_REGION() + if( (unsigned)p < (unsigned)len ) ; else if( borderType == BORDER_REPLICATE ) @@ -1119,6 +1137,8 @@ static bool ocl_copyMakeBorder( InputArray _src, OutputArray _dst, int top, int void cv::copyMakeBorder( InputArray _src, OutputArray _dst, int top, int bottom, int left, int right, int borderType, const Scalar& value ) { + CV_INSTRUMENT_REGION() + CV_Assert( top >= 0 && bottom >= 0 && left >= 0 && right >= 0 ); CV_OCL_RUN(_dst.isUMat() && _src.dims() <= 2, diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index 162052667b..b52ba93032 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -469,53 +469,53 @@ template<> struct DFT_VecR4 static IppStatus ippsDFTFwd_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - return ippsDFTFwd_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, + return CV_INSTRUMENT_FUN_IPP(ippsDFTFwd_CToC_32fc, (const Ipp32fc*)src, (Ipp32fc*)dst, (const IppsDFTSpec_C_32fc*)spec, buf); } static IppStatus ippsDFTFwd_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - return ippsDFTFwd_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, + return CV_INSTRUMENT_FUN_IPP(ippsDFTFwd_CToC_64fc, (const Ipp64fc*)src, (Ipp64fc*)dst, (const IppsDFTSpec_C_64fc*)spec, buf); } static IppStatus ippsDFTInv_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - return ippsDFTInv_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, + return CV_INSTRUMENT_FUN_IPP(ippsDFTInv_CToC_32fc, (const Ipp32fc*)src, (Ipp32fc*)dst, (const IppsDFTSpec_C_32fc*)spec, buf); } static IppStatus ippsDFTInv_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - return ippsDFTInv_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, + return CV_INSTRUMENT_FUN_IPP(ippsDFTInv_CToC_64fc, (const Ipp64fc*)src, (Ipp64fc*)dst, (const IppsDFTSpec_C_64fc*)spec, buf); } static IppStatus ippsDFTFwd_RToPack( const float* src, float* dst, const void* spec, uchar* buf) { - return ippsDFTFwd_RToPack_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); + return CV_INSTRUMENT_FUN_IPP(ippsDFTFwd_RToPack_32f, src, dst, (const IppsDFTSpec_R_32f*)spec, buf); } static IppStatus ippsDFTFwd_RToPack( const double* src, double* dst, const void* spec, uchar* buf) { - return ippsDFTFwd_RToPack_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); + return CV_INSTRUMENT_FUN_IPP(ippsDFTFwd_RToPack_64f, src, dst, (const IppsDFTSpec_R_64f*)spec, buf); } static IppStatus ippsDFTInv_PackToR( const float* src, float* dst, const void* spec, uchar* buf) { - return ippsDFTInv_PackToR_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); + return CV_INSTRUMENT_FUN_IPP(ippsDFTInv_PackToR_32f, src, dst, (const IppsDFTSpec_R_32f*)spec, buf); } static IppStatus ippsDFTInv_PackToR( const double* src, double* dst, const void* spec, uchar* buf) { - return ippsDFTInv_PackToR_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); + return CV_INSTRUMENT_FUN_IPP(ippsDFTInv_PackToR_64f, src, dst, (const IppsDFTSpec_R_64f*)spec, buf); } #endif @@ -1564,6 +1564,8 @@ public: virtual void operator()(const Range& range) const { + CV_INSTRUMENT_REGION_IPP(); + IppStatus status; Ipp8u* pBuffer = 0; Ipp8u* pMemInit= 0; @@ -1645,6 +1647,8 @@ public: virtual void operator()(const Range& range) const { + CV_INSTRUMENT_REGION_IPP(); + IppStatus status; Ipp8u* pBuffer = 0; Ipp8u* pMemInit= 0; @@ -1728,30 +1732,32 @@ bool Dft_R_IPPLoop(const uchar * src, size_t src_step, uchar * dst, size_t dst_s struct IPPDFT_C_Functor { - IPPDFT_C_Functor(ippiDFT_C_Func _func) : func(_func){} + IPPDFT_C_Functor(ippiDFT_C_Func _func) : ippiDFT_CToC_32fc_C1R(_func){} bool operator()(const Ipp32fc* src, size_t srcStep, Ipp32fc* dst, size_t dstStep, const IppiDFTSpec_C_32fc* pDFTSpec, Ipp8u* pBuffer) const { - return func ? func(src, static_cast(srcStep), dst, static_cast(dstStep), pDFTSpec, pBuffer) >= 0 : false; + return ippiDFT_CToC_32fc_C1R ? CV_INSTRUMENT_FUN_IPP(ippiDFT_CToC_32fc_C1R, src, static_cast(srcStep), dst, static_cast(dstStep), pDFTSpec, pBuffer) >= 0 : false; } private: - ippiDFT_C_Func func; + ippiDFT_C_Func ippiDFT_CToC_32fc_C1R; }; struct IPPDFT_R_Functor { - IPPDFT_R_Functor(ippiDFT_R_Func _func) : func(_func){} + IPPDFT_R_Functor(ippiDFT_R_Func _func) : ippiDFT_PackToR_32f_C1R(_func){} bool operator()(const Ipp32f* src, size_t srcStep, Ipp32f* dst, size_t dstStep, const IppiDFTSpec_R_32f* pDFTSpec, Ipp8u* pBuffer) const { - return func ? func(src, static_cast(srcStep), dst, static_cast(dstStep), pDFTSpec, pBuffer) >= 0 : false; + return ippiDFT_PackToR_32f_C1R ? CV_INSTRUMENT_FUN_IPP(ippiDFT_PackToR_32f_C1R, src, static_cast(srcStep), dst, static_cast(dstStep), pDFTSpec, pBuffer) >= 0 : false; } private: - ippiDFT_R_Func func; + ippiDFT_R_Func ippiDFT_PackToR_32f_C1R; }; static bool ippi_DFT_C_32F(const uchar * src, size_t src_step, uchar * dst, size_t dst_step, int width, int height, bool inv, int norm_flag) { + CV_INSTRUMENT_REGION_IPP() + IppStatus status; Ipp8u* pBuffer = 0; Ipp8u* pMemInit= 0; @@ -1787,9 +1793,9 @@ static bool ippi_DFT_C_32F(const uchar * src, size_t src_step, uchar * dst, size } if (!inv) - status = ippiDFTFwd_CToC_32fc_C1R( (Ipp32fc*)src, static_cast(src_step), (Ipp32fc*)dst, static_cast(dst_step), pDFTSpec, pBuffer ); + status = CV_INSTRUMENT_FUN_IPP(ippiDFTFwd_CToC_32fc_C1R, (Ipp32fc*)src, static_cast(src_step), (Ipp32fc*)dst, static_cast(dst_step), pDFTSpec, pBuffer); else - status = ippiDFTInv_CToC_32fc_C1R( (Ipp32fc*)src, static_cast(src_step), (Ipp32fc*)dst, static_cast(dst_step), pDFTSpec, pBuffer ); + status = CV_INSTRUMENT_FUN_IPP(ippiDFTInv_CToC_32fc_C1R, (Ipp32fc*)src, static_cast(src_step), (Ipp32fc*)dst, static_cast(dst_step), pDFTSpec, pBuffer); if ( sizeBuffer > 0 ) ippFree( pBuffer ); @@ -1806,6 +1812,8 @@ static bool ippi_DFT_C_32F(const uchar * src, size_t src_step, uchar * dst, size static bool ippi_DFT_R_32F(const uchar * src, size_t src_step, uchar * dst, size_t dst_step, int width, int height, bool inv, int norm_flag) { + CV_INSTRUMENT_REGION_IPP() + IppStatus status; Ipp8u* pBuffer = 0; Ipp8u* pMemInit= 0; @@ -1841,9 +1849,9 @@ static bool ippi_DFT_R_32F(const uchar * src, size_t src_step, uchar * dst, size } if (!inv) - status = ippiDFTFwd_RToPack_32f_C1R( (float*)src, static_cast(src_step), (float*)dst, static_cast(dst_step), pDFTSpec, pBuffer ); + status = CV_INSTRUMENT_FUN_IPP(ippiDFTFwd_RToPack_32f_C1R, (float*)src, static_cast(src_step), (float*)dst, static_cast(dst_step), pDFTSpec, pBuffer); else - status = ippiDFTInv_PackToR_32f_C1R( (float*)src, static_cast(src_step), (float*)dst, static_cast(dst_step), pDFTSpec, pBuffer ); + status = CV_INSTRUMENT_FUN_IPP(ippiDFTInv_PackToR_32f_C1R, (float*)src, static_cast(src_step), (float*)dst, static_cast(dst_step), pDFTSpec, pBuffer); if ( sizeBuffer > 0 ) ippFree( pBuffer ); @@ -3318,6 +3326,8 @@ Ptr DFT2D::create(int width, int height, int depth, void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows ) { + CV_INSTRUMENT_REGION() + #ifdef HAVE_CLAMDFFT CV_OCL_RUN(ocl::haveAmdFft() && ocl::Device::getDefault().type() != ocl::Device::TYPE_CPU && _dst.isUMat() && _src0.dims() <= 2 && nonzero_rows == 0, @@ -3363,6 +3373,8 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows ) void cv::idft( InputArray src, OutputArray dst, int flags, int nonzero_rows ) { + CV_INSTRUMENT_REGION() + dft( src, dst, flags | DFT_INVERSE, nonzero_rows ); } @@ -3407,6 +3419,8 @@ static bool ocl_mulSpectrums( InputArray _srcA, InputArray _srcB, void cv::mulSpectrums( InputArray _srcA, InputArray _srcB, OutputArray _dst, int flags, bool conjB ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_dst.isUMat() && _srcA.dims() <= 2 && _srcB.dims() <= 2, ocl_mulSpectrums(_srcA, _srcB, _dst, flags, conjB)) @@ -3795,6 +3809,8 @@ public: virtual void operator()(const Range& range) const { + CV_INSTRUMENT_REGION_IPP() + if(*ok == false) return; @@ -3818,7 +3834,7 @@ public: ippFree(pInitBuf); \ return; - ippiDCTFunc ippDctFun = inv ? (ippiDCTFunc)ippiDCTInv_32f_C1R : (ippiDCTFunc)ippiDCTFwd_32f_C1R; + ippiDCTFunc ippiDCT_32f_C1R = inv ? (ippiDCTFunc)ippiDCTInv_32f_C1R : (ippiDCTFunc)ippiDCTFwd_32f_C1R; ippiDCTInit ippDctInit = inv ? (ippiDCTInit)ippiDCTInvInit_32f : (ippiDCTInit)ippiDCTFwdInit_32f; ippiDCTGetSize ippDctGetSize = inv ? (ippiDCTGetSize)ippiDCTInvGetSize_32f : (ippiDCTGetSize)ippiDCTFwdGetSize_32f; @@ -3856,7 +3872,7 @@ public: for(int i = range.start; i < range.end; ++i) { - if(ippDctFun((float*)(src + src_step * i), static_cast(src_step), (float*)(dst + dst_step * i), static_cast(dst_step), pDCTSpec, pBuffer) < 0) + if(CV_INSTRUMENT_FUN_IPP(ippiDCT_32f_C1R, (float*)(src + src_step * i), static_cast(src_step), (float*)(dst + dst_step * i), static_cast(dst_step), pDCTSpec, pBuffer) < 0) { *ok = false; IPP_RETURN @@ -3925,6 +3941,8 @@ static bool DctIPPLoop(const uchar * src, size_t src_step, uchar * dst, size_t d static bool ippi_DCT_32f(const uchar * src, size_t src_step, uchar * dst, size_t dst_step, int width, int height, bool inv, bool row) { + CV_INSTRUMENT_REGION_IPP() + if(row) return DctIPPLoop(src, src_step, dst, dst_step, width, height, inv); else @@ -3948,7 +3966,7 @@ static bool ippi_DCT_32f(const uchar * src, size_t src_step, uchar * dst, size_t if(pInitBuf) \ ippFree(pInitBuf); \ - ippiDCTFunc ippDctFun = inv ? (ippiDCTFunc)ippiDCTInv_32f_C1R : (ippiDCTFunc)ippiDCTFwd_32f_C1R; + ippiDCTFunc ippiDCT_32f_C1R = inv ? (ippiDCTFunc)ippiDCTInv_32f_C1R : (ippiDCTFunc)ippiDCTFwd_32f_C1R; ippiDCTInit ippDctInit = inv ? (ippiDCTInit)ippiDCTInvInit_32f : (ippiDCTInit)ippiDCTFwdInit_32f; ippiDCTGetSize ippDctGetSize = inv ? (ippiDCTGetSize)ippiDCTInvGetSize_32f : (ippiDCTGetSize)ippiDCTFwdGetSize_32f; @@ -3978,7 +3996,7 @@ static bool ippi_DCT_32f(const uchar * src, size_t src_step, uchar * dst, size_t return false; } - if(ippDctFun((float*)src, static_cast(src_step), (float*)dst, static_cast(dst_step), pDCTSpec, pBuffer) < 0) + if(CV_INSTRUMENT_FUN_IPP(ippiDCT_32f_C1R, (float*)src, static_cast(src_step), (float*)dst, static_cast(dst_step), pDCTSpec, pBuffer) < 0) { IPP_RELEASE return false; @@ -4218,6 +4236,8 @@ Ptr DCT2D::create(int width, int height, int depth, int flags) void cv::dct( InputArray _src0, OutputArray _dst, int flags ) { + CV_INSTRUMENT_REGION() + Mat src0 = _src0.getMat(), src = src0; int type = src.type(), depth = src.depth(); @@ -4240,6 +4260,8 @@ void cv::dct( InputArray _src0, OutputArray _dst, int flags ) void cv::idct( InputArray src, OutputArray dst, int flags ) { + CV_INSTRUMENT_REGION() + dct( src, dst, flags | DCT_INVERSE ); } diff --git a/modules/core/src/glob.cpp b/modules/core/src/glob.cpp index e0c7f66a3a..9bd3bdbfca 100644 --- a/modules/core/src/glob.cpp +++ b/modules/core/src/glob.cpp @@ -259,6 +259,8 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s void cv::glob(String pattern, std::vector& result, bool recursive) { + CV_INSTRUMENT_REGION() + result.clear(); String path, wildchart; diff --git a/modules/core/src/kmeans.cpp b/modules/core/src/kmeans.cpp index a81334aa8f..df017adca3 100644 --- a/modules/core/src/kmeans.cpp +++ b/modules/core/src/kmeans.cpp @@ -219,6 +219,8 @@ double cv::kmeans( InputArray _data, int K, TermCriteria criteria, int attempts, int flags, OutputArray _centers ) { + CV_INSTRUMENT_REGION() + const int SPP_TRIALS = 3; Mat data0 = _data.getMat(); bool isrow = data0.rows == 1; diff --git a/modules/core/src/lapack.cpp b/modules/core/src/lapack.cpp index 3711ca9e17..eed86b4d55 100644 --- a/modules/core/src/lapack.cpp +++ b/modules/core/src/lapack.cpp @@ -52,21 +52,29 @@ namespace cv int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n) { + CV_INSTRUMENT_REGION() + return hal::LU32f(A, astep, m, b, bstep, n); } int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n) { + CV_INSTRUMENT_REGION() + return hal::LU64f(A, astep, m, b, bstep, n); } bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n) { + CV_INSTRUMENT_REGION() + return hal::Cholesky32f(A, astep, m, b, bstep, n); } bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n) { + CV_INSTRUMENT_REGION() + return hal::Cholesky64f(A, astep, m, b, bstep, n); } @@ -746,6 +754,8 @@ SVBkSb( int m, int n, const double* w, size_t wstep, double cv::determinant( InputArray _mat ) { + CV_INSTRUMENT_REGION() + Mat mat = _mat.getMat(); double result = 0; int type = mat.type(), rows = mat.rows; @@ -822,6 +832,8 @@ double cv::determinant( InputArray _mat ) double cv::invert( InputArray _src, OutputArray _dst, int method ) { + CV_INSTRUMENT_REGION() + bool result = false; Mat src = _src.getMat(); int type = src.type(); @@ -1080,6 +1092,8 @@ double cv::invert( InputArray _src, OutputArray _dst, int method ) bool cv::solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int method ) { + CV_INSTRUMENT_REGION() + bool result = true; Mat src = _src.getMat(), _src2 = _src2arg.getMat(); int type = src.type(); @@ -1356,6 +1370,8 @@ bool cv::solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int meth bool cv::eigen( InputArray _src, OutputArray _evals, OutputArray _evects ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); int type = src.type(); int n = src.rows; @@ -1464,11 +1480,15 @@ static void _SVDcompute( InputArray _aarr, OutputArray _w, void SVD::compute( InputArray a, OutputArray w, OutputArray u, OutputArray vt, int flags ) { + CV_INSTRUMENT_REGION() + _SVDcompute(a, w, u, vt, flags); } void SVD::compute( InputArray a, OutputArray w, int flags ) { + CV_INSTRUMENT_REGION() + _SVDcompute(a, w, noArray(), noArray(), flags); } @@ -1517,11 +1537,15 @@ void SVD::backSubst( InputArray rhs, OutputArray dst ) const void cv::SVDecomp(InputArray src, OutputArray w, OutputArray u, OutputArray vt, int flags) { + CV_INSTRUMENT_REGION() + SVD::compute(src, w, u, vt, flags); } void cv::SVBackSubst(InputArray w, InputArray u, InputArray vt, InputArray rhs, OutputArray dst) { + CV_INSTRUMENT_REGION() + SVD::backSubst(w, u, vt, rhs, dst); } diff --git a/modules/core/src/lda.cpp b/modules/core/src/lda.cpp index c52833b41c..4ccbf8a834 100644 --- a/modules/core/src/lda.cpp +++ b/modules/core/src/lda.cpp @@ -898,6 +898,8 @@ public: // National Institute of Standards and Technology (NIST). void compute(InputArray src) { + CV_INSTRUMENT_REGION() + if(isSymmetric(src)) { // Fall back to OpenCV for a symmetric matrix! cv::eigen(src, _eigenvalues, _eigenvectors); diff --git a/modules/core/src/mathfuncs.cpp b/modules/core/src/mathfuncs.cpp index f69381061b..b9bdf49eb3 100644 --- a/modules/core/src/mathfuncs.cpp +++ b/modules/core/src/mathfuncs.cpp @@ -101,6 +101,8 @@ static bool ocl_math_op(InputArray _src1, InputArray _src2, OutputArray _dst, in \* ************************************************************************** */ float cubeRoot( float value ) { + CV_INSTRUMENT_REGION() + float fr; Cv32suf v, m; int ix, s; @@ -142,6 +144,8 @@ float cubeRoot( float value ) void magnitude( InputArray src1, InputArray src2, OutputArray dst ) { + CV_INSTRUMENT_REGION() + int type = src1.type(), depth = src1.depth(), cn = src1.channels(); CV_Assert( src1.size() == src2.size() && type == src2.type() && (depth == CV_32F || depth == CV_64F)); @@ -176,6 +180,8 @@ void magnitude( InputArray src1, InputArray src2, OutputArray dst ) void phase( InputArray src1, InputArray src2, OutputArray dst, bool angleInDegrees ) { + CV_INSTRUMENT_REGION() + int type = src1.type(), depth = src1.depth(), cn = src1.channels(); CV_Assert( src1.size() == src2.size() && type == src2.type() && (depth == CV_32F || depth == CV_64F)); @@ -260,6 +266,8 @@ static bool ocl_cartToPolar( InputArray _src1, InputArray _src2, void cartToPolar( InputArray src1, InputArray src2, OutputArray dst1, OutputArray dst2, bool angleInDegrees ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(dst1.isUMat() && dst2.isUMat(), ocl_cartToPolar(src1, src2, dst1, dst2, angleInDegrees)) @@ -492,6 +500,8 @@ static bool ocl_polarToCart( InputArray _mag, InputArray _angle, void polarToCart( InputArray src1, InputArray src2, OutputArray dst1, OutputArray dst2, bool angleInDegrees ) { + CV_INSTRUMENT_REGION() + int type = src2.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); CV_Assert((depth == CV_32F || depth == CV_64F) && (src1.empty() || src1.type() == type)); @@ -509,14 +519,14 @@ void polarToCart( InputArray src1, InputArray src2, { if (Mag.isContinuous() && Angle.isContinuous() && X.isContinuous() && Y.isContinuous() && !angleInDegrees) { - typedef IppStatus (CV_STDCALL * ippsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase, + typedef IppStatus (CV_STDCALL * IppsPolarToCart)(const void * pSrcMagn, const void * pSrcPhase, void * pDstRe, void * pDstIm, int len); - ippsPolarToCart ippFunc = - depth == CV_32F ? (ippsPolarToCart)ippsPolarToCart_32f : - depth == CV_64F ? (ippsPolarToCart)ippsPolarToCart_64f : 0; - CV_Assert(ippFunc != 0); + IppsPolarToCart ippsPolarToCart = + depth == CV_32F ? (IppsPolarToCart)ippsPolarToCart_32f : + depth == CV_64F ? (IppsPolarToCart)ippsPolarToCart_64f : 0; + CV_Assert(ippsPolarToCart != 0); - IppStatus status = ippFunc(Mag.ptr(), Angle.ptr(), X.ptr(), Y.ptr(), static_cast(cn * X.total())); + IppStatus status = CV_INSTRUMENT_FUN_IPP(ippsPolarToCart, Mag.ptr(), Angle.ptr(), X.ptr(), Y.ptr(), static_cast(cn * X.total())); if (status >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); @@ -620,6 +630,8 @@ void polarToCart( InputArray src1, InputArray src2, void exp( InputArray _src, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + int type = _src.type(), depth = _src.depth(), cn = _src.channels(); CV_Assert( depth == CV_32F || depth == CV_64F ); @@ -651,6 +663,8 @@ void exp( InputArray _src, OutputArray _dst ) void log( InputArray _src, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + int type = _src.type(), depth = _src.depth(), cn = _src.channels(); CV_Assert( depth == CV_32F || depth == CV_64F ); @@ -1160,6 +1174,8 @@ static void Sqrt_64f(const double* src, double* dst, int n) { hal::sqrt64f(src, void pow( InputArray _src, double power, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type), ipower = cvRound(power); bool is_ipower = fabs(ipower - power) < DBL_EPSILON; @@ -1245,12 +1261,12 @@ void pow( InputArray _src, double power, OutputArray _dst ) { int bsz = std::min(len - j, blockSize); - #if defined(HAVE_IPP) +#if defined(HAVE_IPP) CV_IPP_CHECK() { IppStatus status = depth == CV_32F ? - ippsPowx_32f_A21((const float*)ptrs[0], (float)power, (float*)ptrs[1], bsz) : - ippsPowx_64f_A50((const double*)ptrs[0], (double)power, (double*)ptrs[1], bsz); + CV_INSTRUMENT_FUN_IPP(ippsPowx_32f_A21, (const float*)ptrs[0], (float)power, (float*)ptrs[1], bsz) : + CV_INSTRUMENT_FUN_IPP(ippsPowx_64f_A50, (const double*)ptrs[0], (double)power, (double*)ptrs[1], bsz); if (status >= 0) { @@ -1261,7 +1277,7 @@ void pow( InputArray _src, double power, OutputArray _dst ) } setIppErrorStatus(); } - #endif +#endif if( depth == CV_32F ) { @@ -1327,6 +1343,8 @@ void pow( InputArray _src, double power, OutputArray _dst ) void sqrt(InputArray a, OutputArray b) { + CV_INSTRUMENT_REGION() + cv::pow(a, 0.5, b); } @@ -1412,6 +1430,8 @@ check_range_function check_range_functions[] = bool checkRange(InputArray _src, bool quiet, Point* pt, double minVal, double maxVal) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); if ( src.dims > 2 ) @@ -1549,6 +1569,8 @@ static bool ocl_patchNaNs( InputOutputArray _a, float value ) void patchNaNs( InputOutputArray _a, double _val ) { + CV_INSTRUMENT_REGION() + CV_Assert( _a.depth() == CV_32F ); CV_OCL_RUN(_a.isUMat() && _a.dims() <= 2, @@ -1714,6 +1736,8 @@ CV_IMPL int cvCheckArr( const CvArr* arr, int flags, int cv::solveCubic( InputArray _coeffs, OutputArray _roots ) { + CV_INSTRUMENT_REGION() + const int n0 = 3; Mat coeffs = _coeffs.getMat(); int ctype = coeffs.type(); @@ -1859,6 +1883,8 @@ int cv::solveCubic( InputArray _coeffs, OutputArray _roots ) http://en.wikipedia.org/wiki/Durand%E2%80%93Kerner_method */ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters ) { + CV_INSTRUMENT_REGION() + typedef Complex C; double maxDiff = 0; diff --git a/modules/core/src/mathfuncs_core.cpp b/modules/core/src/mathfuncs_core.cpp index 25fb951775..c021812247 100644 --- a/modules/core/src/mathfuncs_core.cpp +++ b/modules/core/src/mathfuncs_core.cpp @@ -203,12 +203,16 @@ namespace cv { namespace hal { void fastAtan32f(const float *Y, const float *X, float *angle, int len, bool angleInDegrees ) { + CV_INSTRUMENT_REGION() + CALL_HAL(fastAtan32f, cv_hal_fastAtan32f, Y, X, angle, len, angleInDegrees); atanImpl(Y, X, angle, len, angleInDegrees); } void fastAtan64f(const double *Y, const double *X, double *angle, int len, bool angleInDegrees) { + CV_INSTRUMENT_REGION() + CALL_HAL(fastAtan64f, cv_hal_fastAtan64f, Y, X, angle, len, angleInDegrees); atanImpl(Y, X, angle, len, angleInDegrees); } @@ -216,13 +220,17 @@ void fastAtan64f(const double *Y, const double *X, double *angle, int len, bool // deprecated void fastAtan2(const float *Y, const float *X, float *angle, int len, bool angleInDegrees ) { + CV_INSTRUMENT_REGION() + fastAtan32f(Y, X, angle, len, angleInDegrees); } void magnitude32f(const float* x, const float* y, float* mag, int len) { + CV_INSTRUMENT_REGION() + CALL_HAL(magnitude32f, cv_hal_magnitude32f, x, y, mag, len); - CV_IPP_RUN_FAST(ippsMagnitude_32f(x, y, mag, len) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsMagnitude_32f, x, y, mag, len) >= 0); int i = 0; @@ -247,8 +255,10 @@ void magnitude32f(const float* x, const float* y, float* mag, int len) void magnitude64f(const double* x, const double* y, double* mag, int len) { + CV_INSTRUMENT_REGION() + CALL_HAL(magnitude64f, cv_hal_magnitude64f, x, y, mag, len); - CV_IPP_RUN_FAST(ippsMagnitude_64f(x, y, mag, len) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsMagnitude_64f, x, y, mag, len) >= 0); int i = 0; @@ -274,8 +284,10 @@ void magnitude64f(const double* x, const double* y, double* mag, int len) void invSqrt32f(const float* src, float* dst, int len) { + CV_INSTRUMENT_REGION() + CALL_HAL(invSqrt32f, cv_hal_invSqrt32f, src, dst, len); - CV_IPP_RUN_FAST(ippsInvSqrt_32f_A21(src, dst, len) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsInvSqrt_32f_A21, src, dst, len) >= 0); int i = 0; @@ -296,8 +308,10 @@ void invSqrt32f(const float* src, float* dst, int len) void invSqrt64f(const double* src, double* dst, int len) { + CV_INSTRUMENT_REGION() + CALL_HAL(invSqrt64f, cv_hal_invSqrt64f, src, dst, len); - CV_IPP_RUN_FAST(ippsInvSqrt_64f_A50(src, dst, len) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsInvSqrt_64f_A50, src, dst, len) >= 0); int i = 0; @@ -314,8 +328,10 @@ void invSqrt64f(const double* src, double* dst, int len) void sqrt32f(const float* src, float* dst, int len) { + CV_INSTRUMENT_REGION() + CALL_HAL(sqrt32f, cv_hal_sqrt32f, src, dst, len); - CV_IPP_RUN_FAST(ippsSqrt_32f_A21(src, dst, len) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsSqrt_32f_A21, src, dst, len) >= 0); int i = 0; @@ -336,8 +352,10 @@ void sqrt32f(const float* src, float* dst, int len) void sqrt64f(const double* src, double* dst, int len) { + CV_INSTRUMENT_REGION() + CALL_HAL(sqrt64f, cv_hal_sqrt64f, src, dst, len); - CV_IPP_RUN_FAST(ippsSqrt_64f_A50(src, dst, len) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsSqrt_64f_A50, src, dst, len) >= 0); int i = 0; @@ -458,8 +476,10 @@ static const double exp_max_val = 3000.*(1 << EXPTAB_SCALE); // log10(DBL_MAX) < void exp32f( const float *_x, float *y, int n ) { + CV_INSTRUMENT_REGION() + CALL_HAL(exp32f, cv_hal_exp32f, _x, y, n); - CV_IPP_RUN_FAST(ippsExp_32f_A21(_x, y, n) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsExp_32f_A21, _x, y, n) >= 0); static const float A4 = (float)(1.000000000000002438532970795181890933776 / EXPPOLY_32F_A0), @@ -660,8 +680,10 @@ void exp32f( const float *_x, float *y, int n ) void exp64f( const double *_x, double *y, int n ) { + CV_INSTRUMENT_REGION() + CALL_HAL(exp64f, cv_hal_exp64f, _x, y, n); - CV_IPP_RUN_FAST(ippsExp_64f_A50(_x, y, n) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsExp_64f_A50, _x, y, n) >= 0); static const double A5 = .99999999999999999998285227504999 / EXPPOLY_32F_A0, @@ -1107,8 +1129,10 @@ static const double ln_2 = 0.69314718055994530941723212145818; void log32f( const float *_x, float *y, int n ) { + CV_INSTRUMENT_REGION() + CALL_HAL(log32f, cv_hal_log32f, _x, y, n); - CV_IPP_RUN_FAST(ippsLn_32f_A21(_x, y, n) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsLn_32f_A21, _x, y, n) >= 0); static const float shift[] = { 0, -1.f/512 }; static const float @@ -1254,8 +1278,10 @@ void log32f( const float *_x, float *y, int n ) void log64f( const double *x, double *y, int n ) { + CV_INSTRUMENT_REGION() + CALL_HAL(log64f, cv_hal_log64f, x, y, n); - CV_IPP_RUN_FAST(ippsLn_64f_A50(x, y, n) >= 0); + CV_IPP_RUN_FAST(CV_INSTRUMENT_FUN_IPP(ippsLn_64f_A50, x, y, n) >= 0); static const double shift[] = { 0, -1./512 }; static const double diff --git a/modules/core/src/matmul.cpp b/modules/core/src/matmul.cpp index 88097ca00b..477d4ab9e6 100644 --- a/modules/core/src/matmul.cpp +++ b/modules/core/src/matmul.cpp @@ -868,6 +868,8 @@ static bool ocl_gemm( InputArray matA, InputArray matB, double alpha, static void gemmImpl( Mat A, Mat B, double alpha, Mat C, double beta, Mat D, int flags ) { + CV_INSTRUMENT_REGION() + const int block_lin_size = 128; const int block_size = block_lin_size * block_lin_size; @@ -2082,6 +2084,8 @@ static TransformFunc getDiagTransformFunc(int depth) void cv::transform( InputArray _src, OutputArray _dst, InputArray _mtx ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(), m = _mtx.getMat(); int depth = src.depth(), scn = src.channels(), dcn = m.rows; CV_Assert( scn == m.cols || scn + 1 == m.cols ); @@ -2260,6 +2264,8 @@ perspectiveTransform_64f(const double* src, double* dst, const double* m, int le void cv::perspectiveTransform( InputArray _src, OutputArray _dst, InputArray _mtx ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(), m = _mtx.getMat(); int depth = src.depth(), scn = src.channels(), dcn = m.rows-1; CV_Assert( scn + 1 == m.cols ); @@ -2454,6 +2460,8 @@ static bool ocl_scaleAdd( InputArray _src1, double alpha, InputArray _src2, Outp void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + int type = _src1.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); CV_Assert( type == _src2.type() ); @@ -2499,6 +2507,8 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray void cv::calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean, int flags, int ctype ) { + CV_INSTRUMENT_REGION() + CV_Assert( data && nsamples > 0 ); Size size = data[0].size(); int sz = size.width * size.height, esz = (int)data[0].elemSize(); @@ -2539,6 +2549,8 @@ void cv::calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean, void cv::calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray _mean, int flags, int ctype ) { + CV_INSTRUMENT_REGION() + if(_src.kind() == _InputArray::STD_VECTOR_MAT) { std::vector src; @@ -2626,6 +2638,8 @@ void cv::calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray double cv::Mahalanobis( InputArray _v1, InputArray _v2, InputArray _icovar ) { + CV_INSTRUMENT_REGION() + Mat v1 = _v1.getMat(), v2 = _v2.getMat(), icovar = _icovar.getMat(); int type = v1.type(), depth = v1.depth(); Size sz = v1.size(); @@ -2916,6 +2930,8 @@ typedef void (*MulTransposedFunc)(const Mat& src, Mat& dst, const Mat& delta, do void cv::mulTransposed( InputArray _src, OutputArray _dst, bool ata, InputArray _delta, double scale, int dtype ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(), delta = _delta.getMat(); const int gemm_level = 100; // boundary above which GEMM is faster. int stype = src.type(); @@ -3059,9 +3075,9 @@ static double dotProd_8u(const uchar* src1, const uchar* src2, int len) #if ARITHM_USE_IPP && IPP_DISABLE_BLOCK CV_IPP_CHECK() { - if (0 <= ippiDotProd_8u64f_C1R(src1, (int)(len*sizeof(src1[0])), + if (0 <= CV_INSTRUMENT_FUN_IPP(ippiDotProd_8u64f_C1R, (src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), - ippiSize(len, 1), &r)) + ippiSize(len, 1), &r))) { CV_IMPL_ADD(CV_IMPL_IPP); return r; @@ -3258,7 +3274,7 @@ static double dotProd_16u(const ushort* src1, const ushort* src2, int len) CV_IPP_CHECK() { double r = 0; - if (0 <= ippiDotProd_16u64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) + if (0 <= CV_INSTRUMENT_FUN_IPP(ippiDotProd_16u64f_C1R, src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) { CV_IMPL_ADD(CV_IMPL_IPP); return r; @@ -3275,7 +3291,7 @@ static double dotProd_16s(const short* src1, const short* src2, int len) CV_IPP_CHECK() { double r = 0; - if (0 <= ippiDotProd_16s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) + if (0 <= CV_INSTRUMENT_FUN_IPP(ippiDotProd_16s64f_C1R, src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) { CV_IMPL_ADD(CV_IMPL_IPP); return r; @@ -3292,7 +3308,7 @@ static double dotProd_32s(const int* src1, const int* src2, int len) CV_IPP_CHECK() { double r = 0; - if (0 <= ippiDotProd_32s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) + if (0 <= CV_INSTRUMENT_FUN_IPP(ippiDotProd_32s64f_C1R, src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) { CV_IMPL_ADD(CV_IMPL_IPP); return r; @@ -3311,7 +3327,7 @@ static double dotProd_32f(const float* src1, const float* src2, int len) #if (ARITHM_USE_IPP == 1) CV_IPP_CHECK() { - if (0 <= ippsDotProd_32f64f(src1, src2, len, &r)) + if (0 <= CV_INSTRUMENT_FUN_IPP(ippsDotProd_32f64f, src1, src2, len, &r)) { CV_IMPL_ADD(CV_IMPL_IPP); return r; @@ -3349,7 +3365,7 @@ static double dotProd_64f(const double* src1, const double* src2, int len) CV_IPP_CHECK() { double r = 0; - if (0 <= ippsDotProd_64f(src1, src2, len, &r)) + if (0 <= CV_INSTRUMENT_FUN_IPP(ippsDotProd_64f, src1, src2, len, &r)) { CV_IMPL_ADD(CV_IMPL_IPP); return r; @@ -3378,6 +3394,8 @@ static DotProdFunc getDotProdFunc(int depth) double Mat::dot(InputArray _mat) const { + CV_INSTRUMENT_REGION() + Mat mat = _mat.getMat(); int cn = channels(); DotProdFunc func = getDotProdFunc(depth()); diff --git a/modules/core/src/matop.cpp b/modules/core/src/matop.cpp index 2a6ec2635c..e7cfa01730 100644 --- a/modules/core/src/matop.cpp +++ b/modules/core/src/matop.cpp @@ -333,6 +333,8 @@ void MatOp::augAssignXor(const MatExpr& expr, Mat& m) const void MatOp::add(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const { + CV_INSTRUMENT_REGION() + if( this == e2.op ) { double alpha = 1, beta = 1; @@ -364,6 +366,8 @@ void MatOp::add(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const void MatOp::add(const MatExpr& expr1, const Scalar& s, MatExpr& res) const { + CV_INSTRUMENT_REGION() + Mat m1; expr1.op->assign(expr1, m1); MatOp_AddEx::makeExpr(res, m1, Mat(), 1, 0, s); @@ -372,6 +376,8 @@ void MatOp::add(const MatExpr& expr1, const Scalar& s, MatExpr& res) const void MatOp::subtract(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const { + CV_INSTRUMENT_REGION() + if( this == e2.op ) { double alpha = 1, beta = -1; @@ -403,6 +409,8 @@ void MatOp::subtract(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const void MatOp::subtract(const Scalar& s, const MatExpr& expr, MatExpr& res) const { + CV_INSTRUMENT_REGION() + Mat m; expr.op->assign(expr, m); MatOp_AddEx::makeExpr(res, m, Mat(), -1, 0, s); @@ -411,6 +419,8 @@ void MatOp::subtract(const Scalar& s, const MatExpr& expr, MatExpr& res) const void MatOp::multiply(const MatExpr& e1, const MatExpr& e2, MatExpr& res, double scale) const { + CV_INSTRUMENT_REGION() + if( this == e2.op ) { Mat m1, m2; @@ -462,6 +472,8 @@ void MatOp::multiply(const MatExpr& e1, const MatExpr& e2, MatExpr& res, double void MatOp::multiply(const MatExpr& expr, double s, MatExpr& res) const { + CV_INSTRUMENT_REGION() + Mat m; expr.op->assign(expr, m); MatOp_AddEx::makeExpr(res, m, Mat(), s, 0); @@ -470,6 +482,8 @@ void MatOp::multiply(const MatExpr& expr, double s, MatExpr& res) const void MatOp::divide(const MatExpr& e1, const MatExpr& e2, MatExpr& res, double scale) const { + CV_INSTRUMENT_REGION() + if( this == e2.op ) { if( isReciprocal(e1) && isReciprocal(e2) ) @@ -510,6 +524,8 @@ void MatOp::divide(const MatExpr& e1, const MatExpr& e2, MatExpr& res, double sc void MatOp::divide(double s, const MatExpr& expr, MatExpr& res) const { + CV_INSTRUMENT_REGION() + Mat m; expr.op->assign(expr, m); MatOp_Bin::makeExpr(res, '/', m, Mat(), s); @@ -518,6 +534,8 @@ void MatOp::divide(double s, const MatExpr& expr, MatExpr& res) const void MatOp::abs(const MatExpr& expr, MatExpr& res) const { + CV_INSTRUMENT_REGION() + Mat m; expr.op->assign(expr, m); MatOp_Bin::makeExpr(res, 'a', m, Mat()); @@ -526,6 +544,8 @@ void MatOp::abs(const MatExpr& expr, MatExpr& res) const void MatOp::transpose(const MatExpr& expr, MatExpr& res) const { + CV_INSTRUMENT_REGION() + Mat m; expr.op->assign(expr, m); MatOp_T::makeExpr(res, m, 1); @@ -590,6 +610,8 @@ Size MatOp::size(const MatExpr& expr) const int MatOp::type(const MatExpr& expr) const { + CV_INSTRUMENT_REGION() + return !expr.a.empty() ? expr.a.type() : expr.b.empty() ? expr.b.type() : expr.c.type(); } @@ -1038,6 +1060,8 @@ MatExpr operator > (double s, const Mat& a) MatExpr min(const Mat& a, const Mat& b) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Bin::makeExpr(e, 'm', a, b); return e; @@ -1045,6 +1069,8 @@ MatExpr min(const Mat& a, const Mat& b) MatExpr min(const Mat& a, double s) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Bin::makeExpr(e, 'n', a, s); return e; @@ -1052,6 +1078,8 @@ MatExpr min(const Mat& a, double s) MatExpr min(double s, const Mat& a) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Bin::makeExpr(e, 'n', a, s); return e; @@ -1059,6 +1087,8 @@ MatExpr min(double s, const Mat& a) MatExpr max(const Mat& a, const Mat& b) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Bin::makeExpr(e, 'M', a, b); return e; @@ -1066,6 +1096,8 @@ MatExpr max(const Mat& a, const Mat& b) MatExpr max(const Mat& a, double s) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Bin::makeExpr(e, 'N', a, s); return e; @@ -1073,6 +1105,8 @@ MatExpr max(const Mat& a, double s) MatExpr max(double s, const Mat& a) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Bin::makeExpr(e, 'N', a, s); return e; @@ -1150,6 +1184,8 @@ MatExpr operator ~(const Mat& a) MatExpr abs(const Mat& a) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Bin::makeExpr(e, 'a', a, Scalar()); return e; @@ -1157,6 +1193,8 @@ MatExpr abs(const Mat& a) MatExpr abs(const MatExpr& e) { + CV_INSTRUMENT_REGION() + MatExpr en; e.op->abs(e, en); return en; @@ -1179,6 +1217,8 @@ Size MatExpr::size() const int MatExpr::type() const { + CV_INSTRUMENT_REGION() + if( isInitializer(*this) ) return a.type(); if( isCmp(*this) ) @@ -1261,6 +1301,8 @@ void MatOp_AddEx::assign(const MatExpr& e, Mat& m, int _type) const void MatOp_AddEx::add(const MatExpr& e, const Scalar& s, MatExpr& res) const { + CV_INSTRUMENT_REGION() + res = e; res.s += s; } @@ -1268,6 +1310,8 @@ void MatOp_AddEx::add(const MatExpr& e, const Scalar& s, MatExpr& res) const void MatOp_AddEx::subtract(const Scalar& s, const MatExpr& e, MatExpr& res) const { + CV_INSTRUMENT_REGION() + res = e; res.alpha = -res.alpha; res.beta = -res.beta; @@ -1276,6 +1320,8 @@ void MatOp_AddEx::subtract(const Scalar& s, const MatExpr& e, MatExpr& res) cons void MatOp_AddEx::multiply(const MatExpr& e, double s, MatExpr& res) const { + CV_INSTRUMENT_REGION() + res = e; res.alpha *= s; res.beta *= s; @@ -1284,6 +1330,8 @@ void MatOp_AddEx::multiply(const MatExpr& e, double s, MatExpr& res) const void MatOp_AddEx::divide(double s, const MatExpr& e, MatExpr& res) const { + CV_INSTRUMENT_REGION() + if( isScaled(e) ) MatOp_Bin::makeExpr(res, '/', e.a, Mat(), s/e.alpha); else @@ -1293,6 +1341,8 @@ void MatOp_AddEx::divide(double s, const MatExpr& e, MatExpr& res) const void MatOp_AddEx::transpose(const MatExpr& e, MatExpr& res) const { + CV_INSTRUMENT_REGION() + if( isScaled(e) ) MatOp_T::makeExpr(res, e.a, e.alpha); else @@ -1301,6 +1351,8 @@ void MatOp_AddEx::transpose(const MatExpr& e, MatExpr& res) const void MatOp_AddEx::abs(const MatExpr& e, MatExpr& res) const { + CV_INSTRUMENT_REGION() + if( (!e.b.data || e.beta == 0) && fabs(e.alpha) == 1 ) MatOp_Bin::makeExpr(res, 'a', e.a, -e.s*e.alpha); else if( e.b.data && e.alpha + e.beta == 0 && e.alpha*e.beta == -1 ) @@ -1361,6 +1413,8 @@ void MatOp_Bin::assign(const MatExpr& e, Mat& m, int _type) const void MatOp_Bin::multiply(const MatExpr& e, double s, MatExpr& res) const { + CV_INSTRUMENT_REGION() + if( e.flags == '*' || e.flags == '/' ) { res = e; @@ -1372,6 +1426,8 @@ void MatOp_Bin::multiply(const MatExpr& e, double s, MatExpr& res) const void MatOp_Bin::divide(double s, const MatExpr& e, MatExpr& res) const { + CV_INSTRUMENT_REGION() + if( e.flags == '/' && (!e.b.data || e.beta == 0) ) MatOp_AddEx::makeExpr(res, e.a, Mat(), s/e.alpha, 0); else @@ -1427,12 +1483,16 @@ void MatOp_T::assign(const MatExpr& e, Mat& m, int _type) const void MatOp_T::multiply(const MatExpr& e, double s, MatExpr& res) const { + CV_INSTRUMENT_REGION() + res = e; res.alpha *= s; } void MatOp_T::transpose(const MatExpr& e, MatExpr& res) const { + CV_INSTRUMENT_REGION() + if( e.alpha == 1 ) MatOp_Identity::makeExpr(res, e.a); else @@ -1457,6 +1517,8 @@ void MatOp_GEMM::assign(const MatExpr& e, Mat& m, int _type) const void MatOp_GEMM::add(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const { + CV_INSTRUMENT_REGION() + bool i1 = isIdentity(e1), i2 = isIdentity(e2); double alpha1 = i1 ? 1 : e1.alpha, alpha2 = i2 ? 1 : e2.alpha; @@ -1474,6 +1536,8 @@ void MatOp_GEMM::add(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const void MatOp_GEMM::subtract(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const { + CV_INSTRUMENT_REGION() + bool i1 = isIdentity(e1), i2 = isIdentity(e2); double alpha1 = i1 ? 1 : e1.alpha, alpha2 = i2 ? 1 : e2.alpha; @@ -1491,6 +1555,8 @@ void MatOp_GEMM::subtract(const MatExpr& e1, const MatExpr& e2, MatExpr& res) co void MatOp_GEMM::multiply(const MatExpr& e, double s, MatExpr& res) const { + CV_INSTRUMENT_REGION() + res = e; res.alpha *= s; res.beta *= s; @@ -1498,6 +1564,8 @@ void MatOp_GEMM::multiply(const MatExpr& e, double s, MatExpr& res) const void MatOp_GEMM::transpose(const MatExpr& e, MatExpr& res) const { + CV_INSTRUMENT_REGION() + res = e; res.flags = (!(e.flags & CV_GEMM_A_T) ? CV_GEMM_B_T : 0) | (!(e.flags & CV_GEMM_B_T) ? CV_GEMM_A_T : 0) | @@ -1577,6 +1645,8 @@ void MatOp_Initializer::assign(const MatExpr& e, Mat& m, int _type) const void MatOp_Initializer::multiply(const MatExpr& e, double s, MatExpr& res) const { + CV_INSTRUMENT_REGION() + res = e; res.alpha *= s; } @@ -1595,6 +1665,8 @@ inline void MatOp_Initializer::makeExpr(MatExpr& res, int method, int ndims, con MatExpr Mat::t() const { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_T::makeExpr(e, *this); return e; @@ -1602,6 +1674,8 @@ MatExpr Mat::t() const MatExpr Mat::inv(int method) const { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Invert::makeExpr(e, method, *this); return e; @@ -1610,6 +1684,8 @@ MatExpr Mat::inv(int method) const MatExpr Mat::mul(InputArray m, double scale) const { + CV_INSTRUMENT_REGION() + MatExpr e; if(m.kind() == _InputArray::EXPR) { @@ -1623,6 +1699,8 @@ MatExpr Mat::mul(InputArray m, double scale) const MatExpr Mat::zeros(int rows, int cols, int type) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Initializer::makeExpr(e, '0', Size(cols, rows), type); return e; @@ -1630,6 +1708,8 @@ MatExpr Mat::zeros(int rows, int cols, int type) MatExpr Mat::zeros(Size size, int type) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Initializer::makeExpr(e, '0', size, type); return e; @@ -1637,6 +1717,8 @@ MatExpr Mat::zeros(Size size, int type) MatExpr Mat::zeros(int ndims, const int* sizes, int type) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Initializer::makeExpr(e, '0', ndims, sizes, type); return e; @@ -1644,6 +1726,8 @@ MatExpr Mat::zeros(int ndims, const int* sizes, int type) MatExpr Mat::ones(int rows, int cols, int type) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Initializer::makeExpr(e, '1', Size(cols, rows), type); return e; @@ -1651,6 +1735,8 @@ MatExpr Mat::ones(int rows, int cols, int type) MatExpr Mat::ones(Size size, int type) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Initializer::makeExpr(e, '1', size, type); return e; @@ -1658,6 +1744,8 @@ MatExpr Mat::ones(Size size, int type) MatExpr Mat::ones(int ndims, const int* sizes, int type) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Initializer::makeExpr(e, '1', ndims, sizes, type); return e; @@ -1665,6 +1753,8 @@ MatExpr Mat::ones(int ndims, const int* sizes, int type) MatExpr Mat::eye(int rows, int cols, int type) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Initializer::makeExpr(e, 'I', Size(cols, rows), type); return e; @@ -1672,6 +1762,8 @@ MatExpr Mat::eye(int rows, int cols, int type) MatExpr Mat::eye(Size size, int type) { + CV_INSTRUMENT_REGION() + MatExpr e; MatOp_Initializer::makeExpr(e, 'I', size, type); return e; diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 02160ecd61..f98155cd3c 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -130,6 +130,8 @@ void MatAllocator::copy(UMatData* usrc, UMatData* udst, int dims, const size_t s const size_t srcofs[], const size_t srcstep[], const size_t dstofs[], const size_t dststep[], bool /*sync*/) const { + CV_INSTRUMENT_REGION() + if(!usrc || !udst) return; int isz[CV_MAX_DIM]; @@ -1056,6 +1058,8 @@ int Mat::checkVector(int _elemChannels, int _depth, bool _requireContinuous) con void scalarToRawData(const Scalar& s, void* _buf, int type, int unroll_to) { + CV_INSTRUMENT_REGION() + int i, depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); CV_Assert(cn <= 4); switch(depth) @@ -2802,6 +2806,8 @@ InputOutputArray noArray() { return _none; } void cv::hconcat(const Mat* src, size_t nsrc, OutputArray _dst) { + CV_INSTRUMENT_REGION() + if( nsrc == 0 || !src ) { _dst.release(); @@ -2829,12 +2835,16 @@ void cv::hconcat(const Mat* src, size_t nsrc, OutputArray _dst) void cv::hconcat(InputArray src1, InputArray src2, OutputArray dst) { + CV_INSTRUMENT_REGION() + Mat src[] = {src1.getMat(), src2.getMat()}; hconcat(src, 2, dst); } void cv::hconcat(InputArray _src, OutputArray dst) { + CV_INSTRUMENT_REGION() + std::vector src; _src.getMatVector(src); hconcat(!src.empty() ? &src[0] : 0, src.size(), dst); @@ -2842,6 +2852,8 @@ void cv::hconcat(InputArray _src, OutputArray dst) void cv::vconcat(const Mat* src, size_t nsrc, OutputArray _dst) { + CV_INSTRUMENT_REGION() + if( nsrc == 0 || !src ) { _dst.release(); @@ -2869,12 +2881,16 @@ void cv::vconcat(const Mat* src, size_t nsrc, OutputArray _dst) void cv::vconcat(InputArray src1, InputArray src2, OutputArray dst) { + CV_INSTRUMENT_REGION() + Mat src[] = {src1.getMat(), src2.getMat()}; vconcat(src, 2, dst); } void cv::vconcat(InputArray _src, OutputArray dst) { + CV_INSTRUMENT_REGION() + std::vector src; _src.getMatVector(src); vconcat(!src.empty() ? &src[0] : 0, src.size(), dst); @@ -2924,6 +2940,8 @@ static bool ocl_setIdentity( InputOutputArray _m, const Scalar& s ) void cv::setIdentity( InputOutputArray _m, const Scalar& s ) { + CV_INSTRUMENT_REGION() + CV_Assert( _m.dims() <= 2 ); CV_OCL_RUN(_m.isUMat(), @@ -2969,6 +2987,8 @@ void cv::setIdentity( InputOutputArray _m, const Scalar& s ) cv::Scalar cv::trace( InputArray _m ) { + CV_INSTRUMENT_REGION() + Mat m = _m.getMat(); CV_Assert( m.dims <= 2 ); int i, type = m.type(); @@ -3170,62 +3190,64 @@ static bool ocl_transpose( InputArray _src, OutputArray _dst ) #ifdef HAVE_IPP static bool ipp_transpose( Mat &src, Mat &dst ) { + CV_INSTRUMENT_REGION_IPP() + int type = src.type(); - typedef IppStatus (CV_STDCALL * ippiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize); - typedef IppStatus (CV_STDCALL * ippiTransposeI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize); - ippiTranspose ippFunc = 0; - ippiTransposeI ippFuncI = 0; + typedef IppStatus (CV_STDCALL * IppiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize); + typedef IppStatus (CV_STDCALL * IppiTransposeI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize); + IppiTranspose ippiTranspose = 0; + IppiTransposeI ippiTranspose_I = 0; if (dst.data == src.data && dst.cols == dst.rows) { CV_SUPPRESS_DEPRECATED_START - ippFuncI = - type == CV_8UC1 ? (ippiTransposeI)ippiTranspose_8u_C1IR : - type == CV_8UC3 ? (ippiTransposeI)ippiTranspose_8u_C3IR : - type == CV_8UC4 ? (ippiTransposeI)ippiTranspose_8u_C4IR : - type == CV_16UC1 ? (ippiTransposeI)ippiTranspose_16u_C1IR : - type == CV_16UC3 ? (ippiTransposeI)ippiTranspose_16u_C3IR : - type == CV_16UC4 ? (ippiTransposeI)ippiTranspose_16u_C4IR : - type == CV_16SC1 ? (ippiTransposeI)ippiTranspose_16s_C1IR : - type == CV_16SC3 ? (ippiTransposeI)ippiTranspose_16s_C3IR : - type == CV_16SC4 ? (ippiTransposeI)ippiTranspose_16s_C4IR : - type == CV_32SC1 ? (ippiTransposeI)ippiTranspose_32s_C1IR : - type == CV_32SC3 ? (ippiTransposeI)ippiTranspose_32s_C3IR : - type == CV_32SC4 ? (ippiTransposeI)ippiTranspose_32s_C4IR : - type == CV_32FC1 ? (ippiTransposeI)ippiTranspose_32f_C1IR : - type == CV_32FC3 ? (ippiTransposeI)ippiTranspose_32f_C3IR : - type == CV_32FC4 ? (ippiTransposeI)ippiTranspose_32f_C4IR : 0; + ippiTranspose_I = + type == CV_8UC1 ? (IppiTransposeI)ippiTranspose_8u_C1IR : + type == CV_8UC3 ? (IppiTransposeI)ippiTranspose_8u_C3IR : + type == CV_8UC4 ? (IppiTransposeI)ippiTranspose_8u_C4IR : + type == CV_16UC1 ? (IppiTransposeI)ippiTranspose_16u_C1IR : + type == CV_16UC3 ? (IppiTransposeI)ippiTranspose_16u_C3IR : + type == CV_16UC4 ? (IppiTransposeI)ippiTranspose_16u_C4IR : + type == CV_16SC1 ? (IppiTransposeI)ippiTranspose_16s_C1IR : + type == CV_16SC3 ? (IppiTransposeI)ippiTranspose_16s_C3IR : + type == CV_16SC4 ? (IppiTransposeI)ippiTranspose_16s_C4IR : + type == CV_32SC1 ? (IppiTransposeI)ippiTranspose_32s_C1IR : + type == CV_32SC3 ? (IppiTransposeI)ippiTranspose_32s_C3IR : + type == CV_32SC4 ? (IppiTransposeI)ippiTranspose_32s_C4IR : + type == CV_32FC1 ? (IppiTransposeI)ippiTranspose_32f_C1IR : + type == CV_32FC3 ? (IppiTransposeI)ippiTranspose_32f_C3IR : + type == CV_32FC4 ? (IppiTransposeI)ippiTranspose_32f_C4IR : 0; CV_SUPPRESS_DEPRECATED_END } else { - ippFunc = - type == CV_8UC1 ? (ippiTranspose)ippiTranspose_8u_C1R : - type == CV_8UC3 ? (ippiTranspose)ippiTranspose_8u_C3R : - type == CV_8UC4 ? (ippiTranspose)ippiTranspose_8u_C4R : - type == CV_16UC1 ? (ippiTranspose)ippiTranspose_16u_C1R : - type == CV_16UC3 ? (ippiTranspose)ippiTranspose_16u_C3R : - type == CV_16UC4 ? (ippiTranspose)ippiTranspose_16u_C4R : - type == CV_16SC1 ? (ippiTranspose)ippiTranspose_16s_C1R : - type == CV_16SC3 ? (ippiTranspose)ippiTranspose_16s_C3R : - type == CV_16SC4 ? (ippiTranspose)ippiTranspose_16s_C4R : - type == CV_32SC1 ? (ippiTranspose)ippiTranspose_32s_C1R : - type == CV_32SC3 ? (ippiTranspose)ippiTranspose_32s_C3R : - type == CV_32SC4 ? (ippiTranspose)ippiTranspose_32s_C4R : - type == CV_32FC1 ? (ippiTranspose)ippiTranspose_32f_C1R : - type == CV_32FC3 ? (ippiTranspose)ippiTranspose_32f_C3R : - type == CV_32FC4 ? (ippiTranspose)ippiTranspose_32f_C4R : 0; + ippiTranspose = + type == CV_8UC1 ? (IppiTranspose)ippiTranspose_8u_C1R : + type == CV_8UC3 ? (IppiTranspose)ippiTranspose_8u_C3R : + type == CV_8UC4 ? (IppiTranspose)ippiTranspose_8u_C4R : + type == CV_16UC1 ? (IppiTranspose)ippiTranspose_16u_C1R : + type == CV_16UC3 ? (IppiTranspose)ippiTranspose_16u_C3R : + type == CV_16UC4 ? (IppiTranspose)ippiTranspose_16u_C4R : + type == CV_16SC1 ? (IppiTranspose)ippiTranspose_16s_C1R : + type == CV_16SC3 ? (IppiTranspose)ippiTranspose_16s_C3R : + type == CV_16SC4 ? (IppiTranspose)ippiTranspose_16s_C4R : + type == CV_32SC1 ? (IppiTranspose)ippiTranspose_32s_C1R : + type == CV_32SC3 ? (IppiTranspose)ippiTranspose_32s_C3R : + type == CV_32SC4 ? (IppiTranspose)ippiTranspose_32s_C4R : + type == CV_32FC1 ? (IppiTranspose)ippiTranspose_32f_C1R : + type == CV_32FC3 ? (IppiTranspose)ippiTranspose_32f_C3R : + type == CV_32FC4 ? (IppiTranspose)ippiTranspose_32f_C4R : 0; } IppiSize roiSize = { src.cols, src.rows }; - if (ippFunc != 0) + if (ippiTranspose != 0) { - if (ippFunc(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiTranspose, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize) >= 0) return true; } - else if (ippFuncI != 0) + else if (ippiTranspose_I != 0) { - if (ippFuncI(dst.ptr(), (int)dst.step, roiSize) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiTranspose_I, dst.ptr(), (int)dst.step, roiSize) >= 0) return true; } return false; @@ -3237,6 +3259,8 @@ static bool ipp_transpose( Mat &src, Mat &dst ) void cv::transpose( InputArray _src, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + int type = _src.type(), esz = CV_ELEM_SIZE(type); CV_Assert( _src.dims() <= 2 && esz <= 32 ); @@ -3261,7 +3285,7 @@ void cv::transpose( InputArray _src, OutputArray _dst ) return; } - CV_IPP_RUN(true, ipp_transpose(src, dst)) + CV_IPP_RUN_FAST(ipp_transpose(src, dst)) if( dst.data == src.data ) { @@ -3283,6 +3307,8 @@ void cv::transpose( InputArray _src, OutputArray _dst ) void cv::completeSymm( InputOutputArray _m, bool LtoR ) { + CV_INSTRUMENT_REGION() + Mat m = _m.getMat(); size_t step = m.step, esz = m.elemSize(); CV_Assert( m.dims <= 2 && m.rows == m.cols ); @@ -3458,43 +3484,43 @@ static inline bool ipp_reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat IppiSize roisize = { srcmat.size().width, 1 }; - typedef IppStatus (CV_STDCALL * ippiSum)(const void * pSrc, int srcStep, IppiSize roiSize, Ipp64f* pSum); - typedef IppStatus (CV_STDCALL * ippiSumHint)(const void * pSrc, int srcStep, IppiSize roiSize, Ipp64f* pSum, IppHintAlgorithm hint); - ippiSum ippFunc = 0; - ippiSumHint ippFuncHint = 0; + typedef IppStatus (CV_STDCALL * IppiSum)(const void * pSrc, int srcStep, IppiSize roiSize, Ipp64f* pSum); + typedef IppStatus (CV_STDCALL * IppiSumHint)(const void * pSrc, int srcStep, IppiSize roiSize, Ipp64f* pSum, IppHintAlgorithm hint); + IppiSum ippiSum = 0; + IppiSumHint ippiSumHint = 0; if(ddepth == CV_64F) { - ippFunc = - stype == CV_8UC1 ? (ippiSum)ippiSum_8u_C1R : - stype == CV_8UC3 ? (ippiSum)ippiSum_8u_C3R : - stype == CV_8UC4 ? (ippiSum)ippiSum_8u_C4R : - stype == CV_16UC1 ? (ippiSum)ippiSum_16u_C1R : - stype == CV_16UC3 ? (ippiSum)ippiSum_16u_C3R : - stype == CV_16UC4 ? (ippiSum)ippiSum_16u_C4R : - stype == CV_16SC1 ? (ippiSum)ippiSum_16s_C1R : - stype == CV_16SC3 ? (ippiSum)ippiSum_16s_C3R : - stype == CV_16SC4 ? (ippiSum)ippiSum_16s_C4R : 0; - ippFuncHint = - stype == CV_32FC1 ? (ippiSumHint)ippiSum_32f_C1R : - stype == CV_32FC3 ? (ippiSumHint)ippiSum_32f_C3R : - stype == CV_32FC4 ? (ippiSumHint)ippiSum_32f_C4R : 0; + ippiSum = + stype == CV_8UC1 ? (IppiSum)ippiSum_8u_C1R : + stype == CV_8UC3 ? (IppiSum)ippiSum_8u_C3R : + stype == CV_8UC4 ? (IppiSum)ippiSum_8u_C4R : + stype == CV_16UC1 ? (IppiSum)ippiSum_16u_C1R : + stype == CV_16UC3 ? (IppiSum)ippiSum_16u_C3R : + stype == CV_16UC4 ? (IppiSum)ippiSum_16u_C4R : + stype == CV_16SC1 ? (IppiSum)ippiSum_16s_C1R : + stype == CV_16SC3 ? (IppiSum)ippiSum_16s_C3R : + stype == CV_16SC4 ? (IppiSum)ippiSum_16s_C4R : 0; + ippiSumHint = + stype == CV_32FC1 ? (IppiSumHint)ippiSum_32f_C1R : + stype == CV_32FC3 ? (IppiSumHint)ippiSum_32f_C3R : + stype == CV_32FC4 ? (IppiSumHint)ippiSum_32f_C4R : 0; } - if(ippFunc) + if(ippiSum) { for(int y = 0; y < srcmat.size().height; y++) { - if(ippFunc(srcmat.ptr(y), sstep, roisize, dstmat.ptr(y)) < 0) + if(CV_INSTRUMENT_FUN_IPP(ippiSum, srcmat.ptr(y), sstep, roisize, dstmat.ptr(y)) < 0) return false; } return true; } - else if(ippFuncHint) + else if(ippiSumHint) { for(int y = 0; y < srcmat.size().height; y++) { - if(ippFuncHint(srcmat.ptr(y), sstep, roisize, dstmat.ptr(y), ippAlgHintAccurate) < 0) + if(CV_INSTRUMENT_FUN_IPP(ippiSumHint, srcmat.ptr(y), sstep, roisize, dstmat.ptr(y), ippAlgHintAccurate) < 0) return false; } return true; @@ -3505,7 +3531,7 @@ static inline bool ipp_reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& dstmat) { - CV_IPP_RUN(true, ipp_reduceSumC_8u16u16s32f_64f(srcmat, dstmat)); + CV_IPP_RUN_FAST(ipp_reduceSumC_8u16u16s32f_64f(srcmat, dstmat)); cv::ReduceFunc func = 0; @@ -3555,7 +3581,7 @@ static inline bool ipp_reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& IppiSize roisize = ippiSize(srcmat.size().width, 1);\ for(int y = 0; y < srcmat.size().height; y++)\ {\ - if(ippi##optype##_##favor##_C1R(srcmat.ptr(y), sstep, roisize, dstmat.ptr(y)) < 0)\ + if(CV_INSTRUMENT_FUN_IPP(ippi##optype##_##favor##_C1R, srcmat.ptr(y), sstep, roisize, dstmat.ptr(y)) < 0)\ return false;\ }\ return true;\ @@ -3564,7 +3590,7 @@ static inline bool ipp_reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& } \ static inline void reduce##optype##C##favor(const cv::Mat& srcmat, cv::Mat& dstmat) \ { \ - CV_IPP_RUN(true, ipp_reduce##optype##C##favor(srcmat, dstmat)); \ + CV_IPP_RUN_FAST(ipp_reduce##optype##C##favor(srcmat, dstmat)); \ cv::reduceC_ < type1, type2, cv::Op##optype < type2 > >(srcmat, dstmat); \ } #endif @@ -3704,6 +3730,8 @@ static bool ocl_reduce(InputArray _src, OutputArray _dst, void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) { + CV_INSTRUMENT_REGION() + CV_Assert( _src.dims() <= 2 ); int op0 = op; int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype); @@ -3948,7 +3976,7 @@ template static void sort_( const Mat& src, Mat& dst, int flags ) } #ifdef USE_IPP_SORT - if (!ippSortFunc || ippSortFunc(ptr, len) < 0) + if (!ippSortFunc || CV_INSTRUMENT_FUN_IPP(ippSortFunc, ptr, len) < 0) #endif { #ifdef USE_IPP_SORT @@ -3959,7 +3987,7 @@ template static void sort_( const Mat& src, Mat& dst, int flags ) if( sortDescending ) { #ifdef USE_IPP_SORT - if (!ippFlipFunc || ippFlipFunc(ptr, len) < 0) + if (!ippFlipFunc || CV_INSTRUMENT_FUN_IPP(ippFlipFunc, ptr, len) < 0) #endif { #ifdef USE_IPP_SORT @@ -4120,6 +4148,8 @@ typedef void (*SortFunc)(const Mat& src, Mat& dst, int flags); void cv::sort( InputArray _src, OutputArray _dst, int flags ) { + CV_INSTRUMENT_REGION() + static SortFunc tab[] = { sort_, sort_, sort_, sort_, @@ -4135,6 +4165,8 @@ void cv::sort( InputArray _src, OutputArray _dst, int flags ) void cv::sortIdx( InputArray _src, OutputArray _dst, int flags ) { + CV_INSTRUMENT_REGION() + static SortFunc tab[] = { sortIdx_, sortIdx_, sortIdx_, sortIdx_, @@ -5341,6 +5373,8 @@ SparseMatConstIterator& SparseMatConstIterator::operator ++() double norm( const SparseMat& src, int normType ) { + CV_INSTRUMENT_REGION() + SparseMatConstIterator it = src.begin(); size_t i, N = src.nzcount(); @@ -5390,6 +5424,8 @@ double norm( const SparseMat& src, int normType ) void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _minidx, int* _maxidx ) { + CV_INSTRUMENT_REGION() + SparseMatConstIterator it = src.begin(); size_t i, N = src.nzcount(), d = src.hdr ? src.hdr->dims : 0; int type = src.type(); @@ -5453,6 +5489,8 @@ void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _mi void normalize( const SparseMat& src, SparseMat& dst, double a, int norm_type ) { + CV_INSTRUMENT_REGION() + double scale = 1; if( norm_type == CV_L2 || norm_type == CV_L1 || norm_type == CV_C ) { diff --git a/modules/core/src/matrix_decomp.cpp b/modules/core/src/matrix_decomp.cpp index 5b0d62a967..58829b56f8 100644 --- a/modules/core/src/matrix_decomp.cpp +++ b/modules/core/src/matrix_decomp.cpp @@ -109,6 +109,8 @@ LUImpl(_Tp* A, size_t astep, int m, _Tp* b, size_t bstep, int n, _Tp eps) int LU32f(float* A, size_t astep, int m, float* b, size_t bstep, int n) { + CV_INSTRUMENT_REGION() + int output; CALL_HAL_RET(LU32f, cv_hal_LU32f, output, A, astep, m, b, bstep, n) output = LUImpl(A, astep, m, b, bstep, n, FLT_EPSILON*10); @@ -118,6 +120,8 @@ int LU32f(float* A, size_t astep, int m, float* b, size_t bstep, int n) int LU64f(double* A, size_t astep, int m, double* b, size_t bstep, int n) { + CV_INSTRUMENT_REGION() + int output; CALL_HAL_RET(LU64f, cv_hal_LU64f, output, A, astep, m, b, bstep, n) output = LUImpl(A, astep, m, b, bstep, n, DBL_EPSILON*100); @@ -205,6 +209,8 @@ CholImpl(_Tp* A, size_t astep, int m, _Tp* b, size_t bstep, int n) bool Cholesky32f(float* A, size_t astep, int m, float* b, size_t bstep, int n) { + CV_INSTRUMENT_REGION() + bool output; CALL_HAL_RET(Cholesky32f, cv_hal_Cholesky32f, output, A, astep, m, b, bstep, n) return CholImpl(A, astep, m, b, bstep, n); @@ -212,6 +218,8 @@ bool Cholesky32f(float* A, size_t astep, int m, float* b, size_t bstep, int n) bool Cholesky64f(double* A, size_t astep, int m, double* b, size_t bstep, int n) { + CV_INSTRUMENT_REGION() + bool output; CALL_HAL_RET(Cholesky64f, cv_hal_Cholesky64f, output, A, astep, m, b, bstep, n) return CholImpl(A, astep, m, b, bstep, n); diff --git a/modules/core/src/pca.cpp b/modules/core/src/pca.cpp index f8730475f6..0fa470005a 100644 --- a/modules/core/src/pca.cpp +++ b/modules/core/src/pca.cpp @@ -351,6 +351,8 @@ Mat PCA::backProject(InputArray data) const void cv::PCACompute(InputArray data, InputOutputArray mean, OutputArray eigenvectors, int maxComponents) { + CV_INSTRUMENT_REGION() + PCA pca; pca(data, mean, 0, maxComponents); pca.mean.copyTo(mean); @@ -360,6 +362,8 @@ void cv::PCACompute(InputArray data, InputOutputArray mean, void cv::PCACompute(InputArray data, InputOutputArray mean, OutputArray eigenvectors, double retainedVariance) { + CV_INSTRUMENT_REGION() + PCA pca; pca(data, mean, 0, retainedVariance); pca.mean.copyTo(mean); @@ -369,6 +373,8 @@ void cv::PCACompute(InputArray data, InputOutputArray mean, void cv::PCAProject(InputArray data, InputArray mean, InputArray eigenvectors, OutputArray result) { + CV_INSTRUMENT_REGION() + PCA pca; pca.mean = mean.getMat(); pca.eigenvectors = eigenvectors.getMat(); @@ -378,6 +384,8 @@ void cv::PCAProject(InputArray data, InputArray mean, void cv::PCABackProject(InputArray data, InputArray mean, InputArray eigenvectors, OutputArray result) { + CV_INSTRUMENT_REGION() + PCA pca; pca.mean = mean.getMat(); pca.eigenvectors = eigenvectors.getMat(); diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index 6f9f992983..e9a7e7a175 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -5823,6 +5823,8 @@ FileStorage::~FileStorage() bool FileStorage::open(const String& filename, int flags, const String& encoding) { + CV_INSTRUMENT_REGION() + release(); fs.reset(cvOpenFileStorage( filename.c_str(), 0, flags, !encoding.empty() ? encoding.c_str() : 0)); @@ -5860,6 +5862,8 @@ FileNode FileStorage::root(int streamidx) const FileStorage& operator << (FileStorage& fs, const String& str) { + CV_INSTRUMENT_REGION() + enum { NAME_EXPECTED = FileStorage::NAME_EXPECTED, VALUE_EXPECTED = FileStorage::VALUE_EXPECTED, INSIDE_MAP = FileStorage::INSIDE_MAP }; diff --git a/modules/core/src/rand.cpp b/modules/core/src/rand.cpp index 5d389c56d4..5247af8771 100644 --- a/modules/core/src/rand.cpp +++ b/modules/core/src/rand.cpp @@ -742,11 +742,15 @@ void cv::setRNGSeed(int seed) void cv::randu(InputOutputArray dst, InputArray low, InputArray high) { + CV_INSTRUMENT_REGION() + theRNG().fill(dst, RNG::UNIFORM, low, high); } void cv::randn(InputOutputArray dst, InputArray mean, InputArray stddev) { + CV_INSTRUMENT_REGION() + theRNG().fill(dst, RNG::NORMAL, mean, stddev); } @@ -793,6 +797,8 @@ typedef void (*RandShuffleFunc)( Mat& dst, RNG& rng, double iterFactor ); void cv::randShuffle( InputOutputArray _dst, double iterFactor, RNG* _rng ) { + CV_INSTRUMENT_REGION() + RandShuffleFunc tab[] = { 0, diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index b586fe2aca..abd7fef214 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -1137,6 +1137,8 @@ static bool ocl_sum( InputArray _src, Scalar & res, int sum_op, InputArray _mask #ifdef HAVE_IPP static bool ipp_sum(Mat &src, Scalar &_res) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 700 int cn = src.channels(); size_t total_size = src.total(); @@ -1147,12 +1149,12 @@ static bool ipp_sum(Mat &src, Scalar &_res) int type = src.type(); typedef IppStatus (CV_STDCALL* ippiSumFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm); typedef IppStatus (CV_STDCALL* ippiSumFuncNoHint)(const void*, int, IppiSize, double *); - ippiSumFuncHint ippFuncHint = + ippiSumFuncHint ippiSumHint = type == CV_32FC1 ? (ippiSumFuncHint)ippiSum_32f_C1R : type == CV_32FC3 ? (ippiSumFuncHint)ippiSum_32f_C3R : type == CV_32FC4 ? (ippiSumFuncHint)ippiSum_32f_C4R : 0; - ippiSumFuncNoHint ippFuncNoHint = + ippiSumFuncNoHint ippiSum = type == CV_8UC1 ? (ippiSumFuncNoHint)ippiSum_8u_C1R : type == CV_8UC3 ? (ippiSumFuncNoHint)ippiSum_8u_C3R : type == CV_8UC4 ? (ippiSumFuncNoHint)ippiSum_8u_C4R : @@ -1163,12 +1165,13 @@ static bool ipp_sum(Mat &src, Scalar &_res) type == CV_16SC3 ? (ippiSumFuncNoHint)ippiSum_16s_C3R : type == CV_16SC4 ? (ippiSumFuncNoHint)ippiSum_16s_C4R : 0; - CV_Assert(!ippFuncHint || !ippFuncNoHint); - if( ippFuncHint || ippFuncNoHint ) + CV_Assert(!ippiSumHint || !ippiSum); + if( ippiSumHint || ippiSum ) { Ipp64f res[4]; - IppStatus ret = ippFuncHint ? ippFuncHint(src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) : - ippFuncNoHint(src.ptr(), (int)src.step[0], sz, res); + IppStatus ret = ippiSumHint ? + CV_INSTRUMENT_FUN_IPP(ippiSumHint, src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) : + CV_INSTRUMENT_FUN_IPP(ippiSum, src.ptr(), (int)src.step[0], sz, res); if( ret >= 0 ) { for( int i = 0; i < cn; i++ ) @@ -1188,6 +1191,8 @@ static bool ipp_sum(Mat &src, Scalar &_res) cv::Scalar cv::sum( InputArray _src ) { + CV_INSTRUMENT_REGION() + #if defined HAVE_OPENCL || defined HAVE_IPP Scalar _res; #endif @@ -1299,6 +1304,8 @@ namespace cv { static bool ipp_countNonZero( Mat &src, int &res ) { + CV_INSTRUMENT_REGION_IPP() + Ipp32s count = 0; IppStatus status = ippStsNoErr; @@ -1313,9 +1320,9 @@ static bool ipp_countNonZero( Mat &src, int &res ) } if (depth == CV_8U) - status = ippiCountInRange_8u_C1R((const Ipp8u *)src.data, srcstep, roiSize, &count, 0, 0); + status = CV_INSTRUMENT_FUN_IPP(ippiCountInRange_8u_C1R, (const Ipp8u *)src.data, srcstep, roiSize, &count, 0, 0); else if (depth == CV_32F) - status = ippiCountInRange_32f_C1R((const Ipp32f *)src.data, srcstep, roiSize, &count, 0, 0); + status = CV_INSTRUMENT_FUN_IPP(ippiCountInRange_32f_C1R, (const Ipp32f *)src.data, srcstep, roiSize, &count, 0, 0); if (status >= 0) { @@ -1330,6 +1337,8 @@ static bool ipp_countNonZero( Mat &src, int &res ) int cv::countNonZero( InputArray _src ) { + CV_INSTRUMENT_REGION() + int type = _src.type(), cn = CV_MAT_CN(type); CV_Assert( cn == 1 ); @@ -1365,6 +1374,8 @@ namespace cv { static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret ) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 700 size_t total_size = src.total(); int rows = src.size[0], cols = rows ? (int)(total_size/rows) : 0; @@ -1375,32 +1386,32 @@ static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret ) if( !mask.empty() ) { typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiMaskMeanFuncC1 ippFuncC1 = + ippiMaskMeanFuncC1 ippiMean_C1MR = type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR : type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR : type == CV_32FC1 ? (ippiMaskMeanFuncC1)ippiMean_32f_C1MR : 0; - if( ippFuncC1 ) + if( ippiMean_C1MR ) { Ipp64f res; - if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &res) >= 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiMean_C1MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &res) >= 0 ) { ret = Scalar(res); return true; } } typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *); - ippiMaskMeanFuncC3 ippFuncC3 = + ippiMaskMeanFuncC3 ippiMean_C3MR = type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR : type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR : type == CV_32FC3 ? (ippiMaskMeanFuncC3)ippiMean_32f_C3CMR : 0; - if( ippFuncC3 ) + if( ippiMean_C3MR ) { Ipp64f res1, res2, res3; - if( ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 1, &res1) >= 0 && - ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &res2) >= 0 && - ippFuncC3(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &res3) >= 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiMean_C3MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 1, &res1) >= 0 && + CV_INSTRUMENT_FUN_IPP(ippiMean_C3MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 2, &res2) >= 0 && + CV_INSTRUMENT_FUN_IPP(ippiMean_C3MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, 3, &res3) >= 0 ) { ret = Scalar(res1, res2, res3); return true; @@ -1411,12 +1422,12 @@ static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret ) { typedef IppStatus (CV_STDCALL* ippiMeanFuncHint)(const void*, int, IppiSize, double *, IppHintAlgorithm); typedef IppStatus (CV_STDCALL* ippiMeanFuncNoHint)(const void*, int, IppiSize, double *); - ippiMeanFuncHint ippFuncHint = + ippiMeanFuncHint ippiMeanHint = type == CV_32FC1 ? (ippiMeanFuncHint)ippiMean_32f_C1R : type == CV_32FC3 ? (ippiMeanFuncHint)ippiMean_32f_C3R : type == CV_32FC4 ? (ippiMeanFuncHint)ippiMean_32f_C4R : 0; - ippiMeanFuncNoHint ippFuncNoHint = + ippiMeanFuncNoHint ippiMean = type == CV_8UC1 ? (ippiMeanFuncNoHint)ippiMean_8u_C1R : type == CV_8UC3 ? (ippiMeanFuncNoHint)ippiMean_8u_C3R : type == CV_8UC4 ? (ippiMeanFuncNoHint)ippiMean_8u_C4R : @@ -1428,12 +1439,12 @@ static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret ) type == CV_16SC4 ? (ippiMeanFuncNoHint)ippiMean_16s_C4R : 0; // Make sure only zero or one version of the function pointer is valid - CV_Assert(!ippFuncHint || !ippFuncNoHint); - if( ippFuncHint || ippFuncNoHint ) + CV_Assert(!ippiMeanHint || !ippiMean); + if( ippiMeanHint || ippiMean ) { Ipp64f res[4]; - IppStatus status = ippFuncHint ? ippFuncHint(src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) : - ippFuncNoHint(src.ptr(), (int)src.step[0], sz, res); + IppStatus status = ippiMeanHint ? CV_INSTRUMENT_FUN_IPP(ippiMeanHint, src.ptr(), (int)src.step[0], sz, res, ippAlgHintAccurate) : + CV_INSTRUMENT_FUN_IPP(ippiMean, src.ptr(), (int)src.step[0], sz, res); if( status >= 0 ) { for( int i = 0; i < src.channels(); i++ ) @@ -1453,6 +1464,8 @@ static bool ipp_mean( Mat &src, Mat &mask, Scalar &ret ) cv::Scalar cv::mean( InputArray _src, InputArray _mask ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(), mask = _mask.getMat(); CV_Assert( mask.empty() || mask.type() == CV_8U ); @@ -2216,6 +2229,8 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int* #ifdef HAVE_IPP static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx, int* maxIdx, Mat &mask) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 700 int type = src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); size_t total_size = src.total(); @@ -2230,7 +2245,7 @@ static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *); CV_SUPPRESS_DEPRECATED_START - ippiMaskMinMaxIndxFuncC1 ippFuncC1 = + ippiMaskMinMaxIndxFuncC1 ippiMinMaxIndx_C1MR = type == CV_8UC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1MR : #if IPP_VERSION_X100 < 900 type == CV_8SC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1MR : @@ -2239,11 +2254,11 @@ static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx type == CV_32FC1 ? (ippiMaskMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1MR : 0; CV_SUPPRESS_DEPRECATED_END - if( ippFuncC1 ) + if( ippiMinMaxIndx_C1MR ) { Ipp32f min, max; IppiPoint minp, maxp; - if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &min, &max, &minp, &maxp) >= 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiMinMaxIndx_C1MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &min, &max, &minp, &maxp) >= 0 ) { if( minVal ) *minVal = (double)min; @@ -2270,7 +2285,7 @@ static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx typedef IppStatus (CV_STDCALL* ippiMinMaxIndxFuncC1)(const void *, int, IppiSize, Ipp32f *, Ipp32f *, IppiPoint *, IppiPoint *); CV_SUPPRESS_DEPRECATED_START - ippiMinMaxIndxFuncC1 ippFuncC1 = + ippiMinMaxIndxFuncC1 ippiMinMaxIndx_C1R = #if IPP_VERSION_X100 != 900 // bug in 9.0.0 avx2 optimization depth == CV_8U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R : #endif @@ -2286,11 +2301,11 @@ static bool ipp_minMaxIdx( Mat &src, double* minVal, double* maxVal, int* minIdx 0; CV_SUPPRESS_DEPRECATED_END - if( ippFuncC1 ) + if( ippiMinMaxIndx_C1R ) { Ipp32f min, max; IppiPoint minp, maxp; - if( ippFuncC1(src.ptr(), (int)src.step[0], sz, &min, &max, &minp, &maxp) >= 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiMinMaxIndx_C1R, src.ptr(), (int)src.step[0], sz, &min, &max, &minp, &maxp) >= 0 ) { if( minVal ) *minVal = (double)min; @@ -2324,6 +2339,8 @@ void cv::minMaxIdx(InputArray _src, double* minVal, double* maxVal, int* minIdx, int* maxIdx, InputArray _mask) { + CV_INSTRUMENT_REGION() + int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); CV_Assert( (cn == 1 && (_mask.empty() || _mask.type() == CV_8U)) || (cn > 1 && _mask.empty() && !minIdx && !maxIdx) ); @@ -2386,6 +2403,8 @@ void cv::minMaxIdx(InputArray _src, double* minVal, void cv::minMaxLoc( InputArray _img, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc, InputArray mask ) { + CV_INSTRUMENT_REGION() + CV_Assert(_img.dims() <= 2); minMaxIdx(_img, minVal, maxVal, (int*)minLoc, (int*)maxLoc, mask); @@ -2665,6 +2684,8 @@ static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double & #ifdef HAVE_IPP static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 700 int cn = src.channels(); size_t total_size = src.total(); @@ -2680,7 +2701,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) if( !mask.empty() ) { typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC1)(const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiMaskNormFuncC1 ippFuncC1 = + ippiMaskNormFuncC1 ippiNorm_C1MR = normType == NORM_INF ? (type == CV_8UC1 ? (ippiMaskNormFuncC1)ippiNorm_Inf_8u_C1MR : #if IPP_VERSION_X100 < 900 @@ -2705,10 +2726,10 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) type == CV_16UC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_16u_C1MR : type == CV_32FC1 ? (ippiMaskNormFuncC1)ippiNorm_L2_32f_C1MR : 0) : 0; - if( ippFuncC1 ) + if( ippiNorm_C1MR ) { Ipp64f norm; - if( ippFuncC1(src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiNorm_C1MR, src.ptr(), (int)src.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 ) { result = (normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm); return true; @@ -2716,7 +2737,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) } #if IPP_DISABLE_BLOCK typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *); - ippiMaskNormFuncC3 ippFuncC3 = + ippiMaskNormFuncC3 ippiNorm_C3CMR = normType == NORM_INF ? (type == CV_8UC3 ? (ippiMaskNormFuncC3)ippiNorm_Inf_8u_C3CMR : #if IPP_VERSION_X100 < 900 @@ -2741,12 +2762,12 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) type == CV_16UC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_16u_C3CMR : type == CV_32FC3 ? (ippiMaskNormFuncC3)ippiNorm_L2_32f_C3CMR : 0) : 0; - if( ippFuncC3 ) + if( ippiNorm_C3CMR ) { Ipp64f norm1, norm2, norm3; - if( ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 1, &norm1) >= 0 && - ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 2, &norm2) >= 0 && - ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 3, &norm3) >= 0) + if( CV_INSTRUMENT_FUN_IPP(ippiNorm_C3CMR, (src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 1, &norm1)) >= 0 && + CV_INSTRUMENT_FUN_IPP(ippiNorm_C3CMR, (src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 2, &norm2)) >= 0 && + CV_INSTRUMENT_FUN_IPP(ippiNorm_C3CMR, (src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 3, &norm3)) >= 0) { Ipp64f norm = normType == NORM_INF ? std::max(std::max(norm1, norm2), norm3) : @@ -2763,7 +2784,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) { typedef IppStatus (CV_STDCALL* ippiNormFuncHint)(const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); typedef IppStatus (CV_STDCALL* ippiNormFuncNoHint)(const void *, int, IppiSize, Ipp64f *); - ippiNormFuncHint ippFuncHint = + ippiNormFuncHint ippiNormHint = normType == NORM_L1 ? (type == CV_32FC1 ? (ippiNormFuncHint)ippiNorm_L1_32f_C1R : type == CV_32FC3 ? (ippiNormFuncHint)ippiNorm_L1_32f_C3R : @@ -2774,7 +2795,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) type == CV_32FC3 ? (ippiNormFuncHint)ippiNorm_L2_32f_C3R : type == CV_32FC4 ? (ippiNormFuncHint)ippiNorm_L2_32f_C4R : 0) : 0; - ippiNormFuncNoHint ippFuncNoHint = + ippiNormFuncNoHint ippiNorm = normType == NORM_INF ? (type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C1R : type == CV_8UC3 ? (ippiNormFuncNoHint)ippiNorm_Inf_8u_C3R : @@ -2814,12 +2835,12 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) type == CV_16SC4 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C4R : 0) : 0; // Make sure only zero or one version of the function pointer is valid - CV_Assert(!ippFuncHint || !ippFuncNoHint); - if( ippFuncHint || ippFuncNoHint ) + CV_Assert(!ippiNormHint || !ippiNorm); + if( ippiNormHint || ippiNorm ) { Ipp64f norm_array[4]; - IppStatus ret = ippFuncHint ? ippFuncHint(src.ptr(), (int)src.step[0], sz, norm_array, ippAlgHintAccurate) : - ippFuncNoHint(src.ptr(), (int)src.step[0], sz, norm_array); + IppStatus ret = ippiNormHint ? CV_INSTRUMENT_FUN_IPP(ippiNormHint, src.ptr(), (int)src.step[0], sz, norm_array, ippAlgHintAccurate) : + CV_INSTRUMENT_FUN_IPP(ippiNorm, src.ptr(), (int)src.step[0], sz, norm_array); if( ret >= 0 ) { Ipp64f norm = (normType == NORM_L2 || normType == NORM_L2SQR) ? norm_array[0] * norm_array[0] : norm_array[0]; @@ -2847,6 +2868,8 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) double cv::norm( InputArray _src, int normType, InputArray _mask ) { + CV_INSTRUMENT_REGION() + normType &= NORM_TYPE_MASK; CV_Assert( normType == NORM_INF || normType == NORM_L1 || normType == NORM_L2 || normType == NORM_L2SQR || @@ -3067,6 +3090,8 @@ namespace cv { static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArray _mask, double &result) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 700 Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat(); @@ -3087,7 +3112,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra if( !mask.empty() ) { typedef IppStatus (CV_STDCALL* ippiMaskNormRelFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiMaskNormRelFuncC1 ippFuncC1 = + ippiMaskNormRelFuncC1 ippiNormDiff_C1MR = normType == NORM_INF ? (type == CV_8UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_Inf_8u_C1MR : #if IPP_VERSION_X100 < 900 @@ -3116,10 +3141,10 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra type == CV_16UC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_16u_C1MR : type == CV_32FC1 ? (ippiMaskNormRelFuncC1)ippiNormRel_L2_32f_C1MR : 0) : 0; - if( ippFuncC1 ) + if( ippiNormDiff_C1MR ) { Ipp64f norm; - if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C1MR, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 ) { result = (normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm); return true; @@ -3130,7 +3155,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra { typedef IppStatus (CV_STDCALL* ippiNormRelFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *); typedef IppStatus (CV_STDCALL* ippiNormRelFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); - ippiNormRelFuncNoHint ippFuncNoHint = + ippiNormRelFuncNoHint ippiNormDiff = normType == NORM_INF ? (type == CV_8UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_8u_C1R : type == CV_16UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16u_C1R : @@ -3147,26 +3172,26 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra type == CV_16UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16u_C1R : type == CV_16SC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16s_C1R : 0) : 0; - ippiNormRelFuncHint ippFuncHint = + ippiNormRelFuncHint ippiNormDiffHint = normType == NORM_L1 ? (type == CV_32FC1 ? (ippiNormRelFuncHint)ippiNormRel_L1_32f_C1R : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? (type == CV_32FC1 ? (ippiNormRelFuncHint)ippiNormRel_L2_32f_C1R : 0) : 0; - if (ippFuncNoHint) + if (ippiNormDiff) { Ipp64f norm; - if( ippFuncNoHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm) >= 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiNormDiff, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm) >= 0 ) { result = (double)norm; return true; } } - if (ippFuncHint) + if (ippiNormDiffHint) { Ipp64f norm; - if( ippFuncHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiNormDiffHint, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 ) { result = (double)norm; return true; @@ -3194,7 +3219,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra if( !mask.empty() ) { typedef IppStatus (CV_STDCALL* ippiMaskNormDiffFuncC1)(const void *, int, const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiMaskNormDiffFuncC1 ippFuncC1 = + ippiMaskNormDiffFuncC1 ippiNormDiff_C1MR = normType == NORM_INF ? (type == CV_8UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_Inf_8u_C1MR : #if IPP_VERSION_X100 < 900 @@ -3221,10 +3246,10 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra type == CV_16UC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_16u_C1MR : type == CV_32FC1 ? (ippiMaskNormDiffFuncC1)ippiNormDiff_L2_32f_C1MR : 0) : 0; - if( ippFuncC1 ) + if( ippiNormDiff_C1MR ) { Ipp64f norm; - if( ippFuncC1(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C1MR, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], mask.ptr(), (int)mask.step[0], sz, &norm) >= 0 ) { result = (normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm); return true; @@ -3232,7 +3257,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra } #ifndef __APPLE__ typedef IppStatus (CV_STDCALL* ippiMaskNormDiffFuncC3)(const void *, int, const void *, int, const void *, int, IppiSize, int, Ipp64f *); - ippiMaskNormDiffFuncC3 ippFuncC3 = + ippiMaskNormDiffFuncC3 ippiNormDiff_C3CMR = normType == NORM_INF ? (type == CV_8UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_Inf_8u_C3CMR : #if IPP_VERSION_X100 < 900 @@ -3257,12 +3282,12 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra type == CV_16UC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_16u_C3CMR : type == CV_32FC3 ? (ippiMaskNormDiffFuncC3)ippiNormDiff_L2_32f_C3CMR : 0) : 0; - if( ippFuncC3 ) + if( ippiNormDiff_C3CMR ) { Ipp64f norm1, norm2, norm3; - if( ippFuncC3(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 1, &norm1) >= 0 && - ippFuncC3(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 2, &norm2) >= 0 && - ippFuncC3(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 3, &norm3) >= 0) + if( CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C3CMR, src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 1, &norm1) >= 0 && + CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C3CMR, src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 2, &norm2) >= 0 && + CV_INSTRUMENT_FUN_IPP(ippiNormDiff_C3CMR, src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, 3, &norm3) >= 0) { Ipp64f norm = normType == NORM_INF ? std::max(std::max(norm1, norm2), norm3) : @@ -3279,7 +3304,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra { typedef IppStatus (CV_STDCALL* ippiNormDiffFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); typedef IppStatus (CV_STDCALL* ippiNormDiffFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiNormDiffFuncHint ippFuncHint = + ippiNormDiffFuncHint ippiNormDiffHint = normType == NORM_L1 ? (type == CV_32FC1 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C1R : type == CV_32FC3 ? (ippiNormDiffFuncHint)ippiNormDiff_L1_32f_C3R : @@ -3290,7 +3315,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra type == CV_32FC3 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C3R : type == CV_32FC4 ? (ippiNormDiffFuncHint)ippiNormDiff_L2_32f_C4R : 0) : 0; - ippiNormDiffFuncNoHint ippFuncNoHint = + ippiNormDiffFuncNoHint ippiNormDiff = normType == NORM_INF ? (type == CV_8UC1 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C1R : type == CV_8UC3 ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C3R : @@ -3332,12 +3357,12 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra type == CV_16SC4 ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C4R : 0) : 0; // Make sure only zero or one version of the function pointer is valid - CV_Assert(!ippFuncHint || !ippFuncNoHint); - if( ippFuncHint || ippFuncNoHint ) + CV_Assert(!ippiNormDiffHint || !ippiNormDiff); + if( ippiNormDiffHint || ippiNormDiff ) { Ipp64f norm_array[4]; - IppStatus ret = ippFuncHint ? ippFuncHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array, ippAlgHintAccurate) : - ippFuncNoHint(src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array); + IppStatus ret = ippiNormDiffHint ? CV_INSTRUMENT_FUN_IPP(ippiNormDiffHint, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array, ippAlgHintAccurate) : + CV_INSTRUMENT_FUN_IPP(ippiNormDiff, src1.ptr(), (int)src1.step[0], src2.ptr(), (int)src2.step[0], sz, norm_array); if( ret >= 0 ) { Ipp64f norm = (normType == NORM_L2 || normType == NORM_L2SQR) ? norm_array[0] * norm_array[0] : norm_array[0]; @@ -3366,6 +3391,8 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask ) { + CV_INSTRUMENT_REGION() + CV_Assert( _src1.sameSize(_src2) && _src1.type() == _src2.type() ); #if defined HAVE_OPENCL || defined HAVE_IPP @@ -3750,6 +3777,8 @@ void cv::batchDistance( InputArray _src1, InputArray _src2, int normType, int K, InputArray _mask, int update, bool crosscheck ) { + CV_INSTRUMENT_REGION() + Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat(); int type = src1.type(); CV_Assert( type == src2.type() && src1.cols == src2.cols && @@ -3859,6 +3888,8 @@ void cv::batchDistance( InputArray _src1, InputArray _src2, void cv::findNonZero( InputArray _src, OutputArray _idx ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); CV_Assert( src.type() == CV_8UC1 ); int n = countNonZero(src); @@ -3885,6 +3916,8 @@ void cv::findNonZero( InputArray _src, OutputArray _idx ) double cv::PSNR(InputArray _src1, InputArray _src2) { + CV_INSTRUMENT_REGION() + CV_Assert( _src1.depth() == CV_8U ); double diff = std::sqrt(norm(_src1, _src2, NORM_L2SQR)/(_src1.total()*_src1.channels())); return 20*log10(255./(diff+DBL_EPSILON)); diff --git a/modules/core/src/types.cpp b/modules/core/src/types.cpp index 89e0042657..6cd47b6fdf 100644 --- a/modules/core/src/types.cpp +++ b/modules/core/src/types.cpp @@ -63,6 +63,8 @@ size_t KeyPoint::hash() const void KeyPoint::convert(const std::vector& keypoints, std::vector& points2f, const std::vector& keypointIndexes) { + CV_INSTRUMENT_REGION() + if( keypointIndexes.empty() ) { points2f.resize( keypoints.size() ); @@ -89,6 +91,8 @@ void KeyPoint::convert(const std::vector& keypoints, std::vector& points2f, std::vector& keypoints, float size, float response, int octave, int class_id ) { + CV_INSTRUMENT_REGION() + keypoints.resize(points2f.size()); for( size_t i = 0; i < points2f.size(); i++ ) keypoints[i] = KeyPoint(points2f[i], size, -1, response, octave, class_id); diff --git a/modules/core/src/umatrix.cpp b/modules/core/src/umatrix.cpp index 958723b7b5..997ee2b6ef 100644 --- a/modules/core/src/umatrix.cpp +++ b/modules/core/src/umatrix.cpp @@ -773,6 +773,8 @@ void UMat::ndoffset(size_t* ofs) const void UMat::copyTo(OutputArray _dst) const { + CV_INSTRUMENT_REGION() + int dtype = _dst.type(); if( _dst.fixedType() && dtype != type() ) { @@ -816,6 +818,8 @@ void UMat::copyTo(OutputArray _dst) const void UMat::copyTo(OutputArray _dst, InputArray _mask) const { + CV_INSTRUMENT_REGION() + if( _mask.empty() ) { copyTo(_dst); @@ -863,6 +867,8 @@ void UMat::copyTo(OutputArray _dst, InputArray _mask) const void UMat::convertTo(OutputArray _dst, int _type, double alpha, double beta) const { + CV_INSTRUMENT_REGION() + bool noScale = std::fabs(alpha - 1) < DBL_EPSILON && std::fabs(beta) < DBL_EPSILON; int stype = type(), cn = CV_MAT_CN(stype); @@ -924,6 +930,8 @@ void UMat::convertTo(OutputArray _dst, int _type, double alpha, double beta) con UMat& UMat::setTo(InputArray _value, InputArray _mask) { + CV_INSTRUMENT_REGION() + bool haveMask = !_mask.empty(); #ifdef HAVE_OPENCL int tp = type(), cn = CV_MAT_CN(tp), d = CV_MAT_DEPTH(tp); @@ -1062,6 +1070,8 @@ static bool ocl_dot( InputArray _src1, InputArray _src2, double & res ) double UMat::dot(InputArray m) const { + CV_INSTRUMENT_REGION() + CV_Assert(m.sameSize(*this) && m.type() == type()); #ifdef HAVE_OPENCL diff --git a/modules/features2d/src/agast.cpp b/modules/features2d/src/agast.cpp index a419e371e0..618998efc2 100644 --- a/modules/features2d/src/agast.cpp +++ b/modules/features2d/src/agast.cpp @@ -7940,6 +7940,8 @@ static void OAST_9_16(InputArray _img, std::vector& keypoints, int thr void AGAST(InputArray _img, std::vector& keypoints, int threshold, bool nonmax_suppression) { + CV_INSTRUMENT_REGION() + AGAST(_img, keypoints, threshold, nonmax_suppression, AgastFeatureDetector::OAST_9_16); } @@ -7952,6 +7954,8 @@ public: void detect( InputArray _image, std::vector& keypoints, InputArray _mask ) { + CV_INSTRUMENT_REGION() + Mat mask = _mask.getMat(), grayImage; UMat ugrayImage; _InputArray gray = _image; @@ -8007,6 +8011,7 @@ Ptr AgastFeatureDetector::create( int threshold, bool nonm void AGAST(InputArray _img, std::vector& keypoints, int threshold, bool nonmax_suppression, int type) { + CV_INSTRUMENT_REGION() std::vector kpts; diff --git a/modules/features2d/src/akaze.cpp b/modules/features2d/src/akaze.cpp index f4fe27c1e5..d598155275 100644 --- a/modules/features2d/src/akaze.cpp +++ b/modules/features2d/src/akaze.cpp @@ -167,6 +167,8 @@ namespace cv OutputArray descriptors, bool useProvidedKeypoints) { + CV_INSTRUMENT_REGION() + Mat img = image.getMat(); if (img.channels() > 1) cvtColor(image, img, COLOR_BGR2GRAY); diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index 991a620c8a..31fb19d837 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -89,6 +89,8 @@ BOWKMeansTrainer::BOWKMeansTrainer( int _clusterCount, const TermCriteria& _term Mat BOWKMeansTrainer::cluster() const { + CV_INSTRUMENT_REGION() + CV_Assert( !descriptors.empty() ); Mat mergedDescriptors( descriptorsCount(), descriptors[0].cols, descriptors[0].type() ); @@ -106,6 +108,8 @@ BOWKMeansTrainer::~BOWKMeansTrainer() Mat BOWKMeansTrainer::cluster( const Mat& _descriptors ) const { + CV_INSTRUMENT_REGION() + Mat labels, vocabulary; kmeans( _descriptors, clusterCount, labels, termcrit, attempts, flags, vocabulary ); return vocabulary; @@ -139,6 +143,8 @@ const Mat& BOWImgDescriptorExtractor::getVocabulary() const void BOWImgDescriptorExtractor::compute( InputArray image, std::vector& keypoints, OutputArray imgDescriptor, std::vector >* pointIdxsOfClusters, Mat* descriptors ) { + CV_INSTRUMENT_REGION() + imgDescriptor.release(); if( keypoints.empty() ) @@ -168,6 +174,8 @@ int BOWImgDescriptorExtractor::descriptorType() const void BOWImgDescriptorExtractor::compute( InputArray keypointDescriptors, OutputArray _imgDescriptor, std::vector >* pointIdxsOfClusters ) { + CV_INSTRUMENT_REGION() + CV_Assert( !vocabulary.empty() ); int clusterCount = descriptorSize(); // = vocabulary.rows diff --git a/modules/features2d/src/blobdetector.cpp b/modules/features2d/src/blobdetector.cpp index 23b6f2bd72..ac55341be9 100644 --- a/modules/features2d/src/blobdetector.cpp +++ b/modules/features2d/src/blobdetector.cpp @@ -190,6 +190,8 @@ void SimpleBlobDetectorImpl::write( cv::FileStorage& fs ) const void SimpleBlobDetectorImpl::findBlobs(InputArray _image, InputArray _binaryImage, std::vector
¢ers) const { + CV_INSTRUMENT_REGION() + Mat image = _image.getMat(), binaryImage = _binaryImage.getMat(); (void)image; centers.clear(); @@ -304,6 +306,8 @@ void SimpleBlobDetectorImpl::findBlobs(InputArray _image, InputArray _binaryImag void SimpleBlobDetectorImpl::detect(InputArray image, std::vector& keypoints, InputArray) { + CV_INSTRUMENT_REGION() + //TODO: support mask keypoints.clear(); Mat grayscaleImage; diff --git a/modules/features2d/src/draw.cpp b/modules/features2d/src/draw.cpp index 63410e713c..357662fc81 100644 --- a/modules/features2d/src/draw.cpp +++ b/modules/features2d/src/draw.cpp @@ -91,6 +91,8 @@ static inline void _drawKeypoint( InputOutputArray img, const KeyPoint& p, const void drawKeypoints( InputArray image, const std::vector& keypoints, InputOutputArray outImage, const Scalar& _color, int flags ) { + CV_INSTRUMENT_REGION() + if( !(flags & DrawMatchesFlags::DRAW_OVER_OUTIMG) ) { if( image.type() == CV_8UC3 ) diff --git a/modules/features2d/src/evaluation.cpp b/modules/features2d/src/evaluation.cpp index 3863203df7..5ea882153f 100644 --- a/modules/features2d/src/evaluation.cpp +++ b/modules/features2d/src/evaluation.cpp @@ -179,6 +179,8 @@ void EllipticKeyPoint::calcProjection( const Mat_& H, EllipticKeyPoint& void EllipticKeyPoint::convert( const std::vector& src, std::vector& dst ) { + CV_INSTRUMENT_REGION() + if( !src.empty() ) { dst.resize(src.size()); @@ -194,6 +196,8 @@ void EllipticKeyPoint::convert( const std::vector& src, std::vector& src, std::vector& dst ) { + CV_INSTRUMENT_REGION() + if( !src.empty() ) { dst.resize(src.size()); @@ -456,6 +460,8 @@ void cv::evaluateFeatureDetector( const Mat& img1, const Mat& img2, const Mat& H float& repeatability, int& correspCount, const Ptr& _fdetector ) { + CV_INSTRUMENT_REGION() + Ptr fdetector(_fdetector); std::vector *keypoints1, *keypoints2, buf1, buf2; keypoints1 = _keypoints1 != 0 ? _keypoints1 : &buf1; @@ -492,6 +498,8 @@ void cv::computeRecallPrecisionCurve( const std::vector >& m const std::vector >& correctMatches1to2Mask, std::vector& recallPrecisionCurve ) { + CV_INSTRUMENT_REGION() + CV_Assert( matches1to2.size() == correctMatches1to2Mask.size() ); std::vector allMatches; @@ -526,6 +534,8 @@ void cv::computeRecallPrecisionCurve( const std::vector >& m float cv::getRecall( const std::vector& recallPrecisionCurve, float l_precision ) { + CV_INSTRUMENT_REGION() + int nearestPointIndex = getNearestPoint( recallPrecisionCurve, l_precision ); float recall = -1.f; @@ -538,6 +548,8 @@ float cv::getRecall( const std::vector& recallPrecisionCurve, float l_p int cv::getNearestPoint( const std::vector& recallPrecisionCurve, float l_precision ) { + CV_INSTRUMENT_REGION() + int nearestPointIndex = -1; if( l_precision >= 0 && l_precision <= 1 ) diff --git a/modules/features2d/src/fast.cpp b/modules/features2d/src/fast.cpp index 42dacb5387..8fa6b79f77 100644 --- a/modules/features2d/src/fast.cpp +++ b/modules/features2d/src/fast.cpp @@ -331,6 +331,8 @@ static bool ocl_FAST( InputArray _img, std::vector& keypoints, void FAST(InputArray _img, std::vector& keypoints, int threshold, bool nonmax_suppression, int type) { + CV_INSTRUMENT_REGION() + #ifdef HAVE_OPENCL if( ocl::useOpenCL() && _img.isUMat() && type == FastFeatureDetector::TYPE_9_16 && ocl_FAST(_img, keypoints, threshold, nonmax_suppression, 10000)) @@ -360,6 +362,8 @@ void FAST(InputArray _img, std::vector& keypoints, int threshold, bool void FAST(InputArray _img, std::vector& keypoints, int threshold, bool nonmax_suppression) { + CV_INSTRUMENT_REGION() + FAST(_img, keypoints, threshold, nonmax_suppression, FastFeatureDetector::TYPE_9_16); } @@ -373,6 +377,8 @@ public: void detect( InputArray _image, std::vector& keypoints, InputArray _mask ) { + CV_INSTRUMENT_REGION() + Mat mask = _mask.getMat(), grayImage; UMat ugrayImage; _InputArray gray = _image; diff --git a/modules/features2d/src/feature2d.cpp b/modules/features2d/src/feature2d.cpp index 93b650bcb8..a992db7ce3 100644 --- a/modules/features2d/src/feature2d.cpp +++ b/modules/features2d/src/feature2d.cpp @@ -60,6 +60,8 @@ void Feature2D::detect( InputArray image, std::vector& keypoints, InputArray mask ) { + CV_INSTRUMENT_REGION() + if( image.empty() ) { keypoints.clear(); @@ -73,6 +75,8 @@ void Feature2D::detect( InputArrayOfArrays _images, std::vector >& keypoints, InputArrayOfArrays _masks ) { + CV_INSTRUMENT_REGION() + vector images, masks; _images.getMatVector(images); @@ -102,6 +106,8 @@ void Feature2D::compute( InputArray image, std::vector& keypoints, OutputArray descriptors ) { + CV_INSTRUMENT_REGION() + if( image.empty() ) { descriptors.release(); @@ -114,6 +120,8 @@ void Feature2D::compute( InputArrayOfArrays _images, std::vector >& keypoints, OutputArrayOfArrays _descriptors ) { + CV_INSTRUMENT_REGION() + if( !_descriptors.needed() ) return; @@ -141,6 +149,8 @@ void Feature2D::detectAndCompute( InputArray, InputArray, OutputArray, bool ) { + CV_INSTRUMENT_REGION() + CV_Error(Error::StsNotImplemented, ""); } diff --git a/modules/features2d/src/gftt.cpp b/modules/features2d/src/gftt.cpp index 17e26928c0..c61c96f596 100644 --- a/modules/features2d/src/gftt.cpp +++ b/modules/features2d/src/gftt.cpp @@ -75,6 +75,8 @@ public: void detect( InputArray _image, std::vector& keypoints, InputArray _mask ) { + CV_INSTRUMENT_REGION() + std::vector corners; if (_image.isUMat()) diff --git a/modules/features2d/src/kaze.cpp b/modules/features2d/src/kaze.cpp index 64778a08c7..63b48c3b41 100644 --- a/modules/features2d/src/kaze.cpp +++ b/modules/features2d/src/kaze.cpp @@ -110,6 +110,8 @@ namespace cv OutputArray descriptors, bool useProvidedKeypoints) { + CV_INSTRUMENT_REGION() + cv::Mat img = image.getMat(); if (img.channels() > 1) cvtColor(image, img, COLOR_BGR2GRAY); diff --git a/modules/features2d/src/matchers.cpp b/modules/features2d/src/matchers.cpp index 11dfa6d388..379d3a73b9 100644 --- a/modules/features2d/src/matchers.cpp +++ b/modules/features2d/src/matchers.cpp @@ -567,6 +567,8 @@ void DescriptorMatcher::train() void DescriptorMatcher::match( InputArray queryDescriptors, InputArray trainDescriptors, std::vector& matches, InputArray mask ) const { + CV_INSTRUMENT_REGION() + Ptr tempMatcher = clone(true); tempMatcher->add(trainDescriptors); tempMatcher->match( queryDescriptors, matches, std::vector(1, mask.getMat()) ); @@ -576,6 +578,8 @@ void DescriptorMatcher::knnMatch( InputArray queryDescriptors, InputArray trainD std::vector >& matches, int knn, InputArray mask, bool compactResult ) const { + CV_INSTRUMENT_REGION() + Ptr tempMatcher = clone(true); tempMatcher->add(trainDescriptors); tempMatcher->knnMatch( queryDescriptors, matches, knn, std::vector(1, mask.getMat()), compactResult ); @@ -585,6 +589,8 @@ void DescriptorMatcher::radiusMatch( InputArray queryDescriptors, InputArray tra std::vector >& matches, float maxDistance, InputArray mask, bool compactResult ) const { + CV_INSTRUMENT_REGION() + Ptr tempMatcher = clone(true); tempMatcher->add(trainDescriptors); tempMatcher->radiusMatch( queryDescriptors, matches, maxDistance, std::vector(1, mask.getMat()), compactResult ); @@ -592,6 +598,8 @@ void DescriptorMatcher::radiusMatch( InputArray queryDescriptors, InputArray tra void DescriptorMatcher::match( InputArray queryDescriptors, std::vector& matches, InputArrayOfArrays masks ) { + CV_INSTRUMENT_REGION() + std::vector > knnMatches; knnMatch( queryDescriptors, knnMatches, 1, masks, true /*compactResult*/ ); convertMatches( knnMatches, matches ); @@ -623,6 +631,8 @@ void DescriptorMatcher::checkMasks( InputArrayOfArrays _masks, int queryDescript void DescriptorMatcher::knnMatch( InputArray queryDescriptors, std::vector >& matches, int knn, InputArrayOfArrays masks, bool compactResult ) { + CV_INSTRUMENT_REGION() + if( empty() || queryDescriptors.empty() ) return; @@ -637,6 +647,8 @@ void DescriptorMatcher::knnMatch( InputArray queryDescriptors, std::vector >& matches, float maxDistance, InputArrayOfArrays masks, bool compactResult ) { + CV_INSTRUMENT_REGION() + matches.clear(); if( empty() || queryDescriptors.empty() ) return; @@ -1080,6 +1092,8 @@ void FlannBasedMatcher::clear() void FlannBasedMatcher::train() { + CV_INSTRUMENT_REGION() + if( !flannIndex || mergedDescriptors.size() < addedDescCount ) { // FIXIT: Workaround for 'utrainDescCollection' issue (PR #2142) @@ -1332,6 +1346,8 @@ void FlannBasedMatcher::convertToDMatches( const DescriptorCollection& collectio void FlannBasedMatcher::knnMatchImpl( InputArray _queryDescriptors, std::vector >& matches, int knn, InputArrayOfArrays /*masks*/, bool /*compactResult*/ ) { + CV_INSTRUMENT_REGION() + Mat queryDescriptors = _queryDescriptors.getMat(); Mat indices( queryDescriptors.rows, knn, CV_32SC1 ); Mat dists( queryDescriptors.rows, knn, CV_32FC1); @@ -1343,6 +1359,8 @@ void FlannBasedMatcher::knnMatchImpl( InputArray _queryDescriptors, std::vector< void FlannBasedMatcher::radiusMatchImpl( InputArray _queryDescriptors, std::vector >& matches, float maxDistance, InputArrayOfArrays /*masks*/, bool /*compactResult*/ ) { + CV_INSTRUMENT_REGION() + Mat queryDescriptors = _queryDescriptors.getMat(); const int count = mergedDescriptors.size(); // TODO do count as param? Mat indices( queryDescriptors.rows, count, CV_32SC1, Scalar::all(-1) ); diff --git a/modules/features2d/src/mser.cpp b/modules/features2d/src/mser.cpp index d60af8ddae..f16a0d2a8b 100644 --- a/modules/features2d/src/mser.cpp +++ b/modules/features2d/src/mser.cpp @@ -1040,6 +1040,8 @@ extractMSER_8uC3( const Mat& src, void MSER_Impl::detectRegions( InputArray _src, vector >& msers, vector& bboxes ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); msers.clear(); @@ -1076,6 +1078,8 @@ void MSER_Impl::detectRegions( InputArray _src, vector >& msers, v void MSER_Impl::detect( InputArray _image, vector& keypoints, InputArray _mask ) { + CV_INSTRUMENT_REGION() + vector bboxes; vector > msers; Mat mask = _mask.getMat(); diff --git a/modules/features2d/src/orb.cpp b/modules/features2d/src/orb.cpp index 7775b84f40..219e86e109 100644 --- a/modules/features2d/src/orb.cpp +++ b/modules/features2d/src/orb.cpp @@ -957,6 +957,8 @@ void ORB_Impl::detectAndCompute( InputArray _image, InputArray _mask, std::vector& keypoints, OutputArray _descriptors, bool useProvidedKeypoints ) { + CV_INSTRUMENT_REGION() + CV_Assert(patchSize >= 2); bool do_keypoints = !useProvidedKeypoints; diff --git a/modules/flann/src/miniflann.cpp b/modules/flann/src/miniflann.cpp index b7661752c0..8aca73c230 100644 --- a/modules/flann/src/miniflann.cpp +++ b/modules/flann/src/miniflann.cpp @@ -365,6 +365,8 @@ Index::Index(InputArray _data, const IndexParams& params, flann_distance_t _dist void Index::build(InputArray _data, const IndexParams& params, flann_distance_t _distType) { + CV_INSTRUMENT_REGION() + release(); algo = getParam(params, "algorithm", FLANN_INDEX_LINEAR); if( algo == FLANN_INDEX_SAVED ) @@ -433,6 +435,8 @@ Index::~Index() void Index::release() { + CV_INSTRUMENT_REGION() + if( !index ) return; @@ -563,6 +567,8 @@ static void createIndicesDists(OutputArray _indices, OutputArray _dists, void Index::knnSearch(InputArray _query, OutputArray _indices, OutputArray _dists, int knn, const SearchParams& params) { + CV_INSTRUMENT_REGION() + Mat query = _query.getMat(), indices, dists; int dtype = distType == FLANN_DIST_HAMMING ? CV_32S : CV_32F; @@ -605,6 +611,8 @@ int Index::radiusSearch(InputArray _query, OutputArray _indices, OutputArray _dists, double radius, int maxResults, const SearchParams& params) { + CV_INSTRUMENT_REGION() + Mat query = _query.getMat(), indices, dists; int dtype = distType == FLANN_DIST_HAMMING ? CV_32S : CV_32F; CV_Assert( maxResults > 0 ); @@ -668,6 +676,8 @@ template void saveIndex(const Index* index0, const void* inde void Index::save(const String& filename) const { + CV_INSTRUMENT_REGION() + FILE* fout = fopen(filename.c_str(), "wb"); if (fout == NULL) CV_Error_( Error::StsError, ("Can not open file %s for writing FLANN index\n", filename.c_str()) ); diff --git a/modules/imgproc/src/accum.cpp b/modules/imgproc/src/accum.cpp index dc1807f960..8626187fd8 100644 --- a/modules/imgproc/src/accum.cpp +++ b/modules/imgproc/src/accum.cpp @@ -1869,6 +1869,8 @@ namespace cv { static bool ipp_accumulate(InputArray _src, InputOutputArray _dst, InputArray _mask) { + CV_INSTRUMENT_REGION_IPP() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype); int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype); @@ -1876,28 +1878,28 @@ static bool ipp_accumulate(InputArray _src, InputOutputArray _dst, InputArray _m if (src.dims <= 2 || (src.isContinuous() && dst.isContinuous() && (mask.empty() || mask.isContinuous()))) { - typedef IppStatus (CV_STDCALL * ippiAdd)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize); - typedef IppStatus (CV_STDCALL * ippiAddMask)(const void * pSrc, int srcStep, const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst, + typedef IppStatus (CV_STDCALL * IppiAdd)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize); + typedef IppStatus (CV_STDCALL * IppiAddMask)(const void * pSrc, int srcStep, const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst, int srcDstStep, IppiSize roiSize); - ippiAdd ippFunc = 0; - ippiAddMask ippFuncMask = 0; + IppiAdd ippiAdd_I = 0; + IppiAddMask ippiAdd_IM = 0; if (mask.empty()) { CV_SUPPRESS_DEPRECATED_START - ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAdd)ippiAdd_8u32f_C1IR : - sdepth == CV_16U && ddepth == CV_32F ? (ippiAdd)ippiAdd_16u32f_C1IR : - sdepth == CV_32F && ddepth == CV_32F ? (ippiAdd)ippiAdd_32f_C1IR : 0; + ippiAdd_I = sdepth == CV_8U && ddepth == CV_32F ? (IppiAdd)ippiAdd_8u32f_C1IR : + sdepth == CV_16U && ddepth == CV_32F ? (IppiAdd)ippiAdd_16u32f_C1IR : + sdepth == CV_32F && ddepth == CV_32F ? (IppiAdd)ippiAdd_32f_C1IR : 0; CV_SUPPRESS_DEPRECATED_END } else if (scn == 1) { - ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddMask)ippiAdd_8u32f_C1IMR : - sdepth == CV_16U && ddepth == CV_32F ? (ippiAddMask)ippiAdd_16u32f_C1IMR : - sdepth == CV_32F && ddepth == CV_32F ? (ippiAddMask)ippiAdd_32f_C1IMR : 0; + ippiAdd_IM = sdepth == CV_8U && ddepth == CV_32F ? (IppiAddMask)ippiAdd_8u32f_C1IMR : + sdepth == CV_16U && ddepth == CV_32F ? (IppiAddMask)ippiAdd_16u32f_C1IMR : + sdepth == CV_32F && ddepth == CV_32F ? (IppiAddMask)ippiAdd_32f_C1IMR : 0; } - if (ippFunc || ippFuncMask) + if (ippiAdd_I || ippiAdd_IM) { IppStatus status = ippStsErr; @@ -1913,11 +1915,11 @@ static bool ipp_accumulate(InputArray _src, InputOutputArray _dst, InputArray _m } size.width *= scn; - if (ippFunc) - status = ippFunc(src.ptr(), srcstep, dst.ptr(), dststep, ippiSize(size.width, size.height)); - else if(ippFuncMask) - status = ippFuncMask(src.ptr(), srcstep, mask.ptr(), maskstep, - dst.ptr(), dststep, ippiSize(size.width, size.height)); + if (ippiAdd_I) + status = CV_INSTRUMENT_FUN_IPP(ippiAdd_I, src.ptr(), srcstep, dst.ptr(), dststep, ippiSize(size.width, size.height)); + else if (ippiAdd_IM) + status = CV_INSTRUMENT_FUN_IPP(ippiAdd_IM, src.ptr(), srcstep, mask.ptr(), maskstep, + dst.ptr(), dststep, ippiSize(size.width, size.height)); if (status >= 0) return true; @@ -1930,6 +1932,8 @@ static bool ipp_accumulate(InputArray _src, InputOutputArray _dst, InputArray _m void cv::accumulate( InputArray _src, InputOutputArray _dst, InputArray _mask ) { + CV_INSTRUMENT_REGION() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype); int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype), dcn = CV_MAT_CN(dtype); @@ -1963,6 +1967,8 @@ namespace cv { static bool ipp_accumulate_square(InputArray _src, InputOutputArray _dst, InputArray _mask) { + CV_INSTRUMENT_REGION_IPP() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype); int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype); @@ -1973,23 +1979,23 @@ static bool ipp_accumulate_square(InputArray _src, InputOutputArray _dst, InputA typedef IppStatus (CV_STDCALL * ippiAddSquare)(const void * pSrc, int srcStep, Ipp32f * pSrcDst, int srcdstStep, IppiSize roiSize); typedef IppStatus (CV_STDCALL * ippiAddSquareMask)(const void * pSrc, int srcStep, const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst, int srcDstStep, IppiSize roiSize); - ippiAddSquare ippFunc = 0; - ippiAddSquareMask ippFuncMask = 0; + ippiAddSquare ippiAddSquare_I = 0; + ippiAddSquareMask ippiAddSquare_IM = 0; if (mask.empty()) { - ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_8u32f_C1IR : + ippiAddSquare_I = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_8u32f_C1IR : sdepth == CV_16U && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_16u32f_C1IR : sdepth == CV_32F && ddepth == CV_32F ? (ippiAddSquare)ippiAddSquare_32f_C1IR : 0; } else if (scn == 1) { - ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_8u32f_C1IMR : + ippiAddSquare_IM = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_8u32f_C1IMR : sdepth == CV_16U && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_16u32f_C1IMR : sdepth == CV_32F && ddepth == CV_32F ? (ippiAddSquareMask)ippiAddSquare_32f_C1IMR : 0; } - if (ippFunc || ippFuncMask) + if (ippiAddSquare_I || ippiAddSquare_IM) { IppStatus status = ippStsErr; @@ -2005,11 +2011,11 @@ static bool ipp_accumulate_square(InputArray _src, InputOutputArray _dst, InputA } size.width *= scn; - if (ippFunc) - status = ippFunc(src.ptr(), srcstep, dst.ptr(), dststep, ippiSize(size.width, size.height)); - else if(ippFuncMask) - status = ippFuncMask(src.ptr(), srcstep, mask.ptr(), maskstep, - dst.ptr(), dststep, ippiSize(size.width, size.height)); + if (ippiAddSquare_I) + status = CV_INSTRUMENT_FUN_IPP(ippiAddSquare_I, src.ptr(), srcstep, dst.ptr(), dststep, ippiSize(size.width, size.height)); + else if (ippiAddSquare_IM) + status = CV_INSTRUMENT_FUN_IPP(ippiAddSquare_IM, src.ptr(), srcstep, mask.ptr(), maskstep, + dst.ptr(), dststep, ippiSize(size.width, size.height)); if (status >= 0) return true; @@ -2022,6 +2028,8 @@ static bool ipp_accumulate_square(InputArray _src, InputOutputArray _dst, InputA void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _mask ) { + CV_INSTRUMENT_REGION() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype); int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype), dcn = CV_MAT_CN(dtype); @@ -2055,6 +2063,8 @@ namespace cv static bool ipp_accumulate_product(InputArray _src1, InputArray _src2, InputOutputArray _dst, InputArray _mask) { + CV_INSTRUMENT_REGION_IPP() + int stype = _src1.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype); int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype); @@ -2066,23 +2076,23 @@ static bool ipp_accumulate_product(InputArray _src1, InputArray _src2, int src2Step, Ipp32f * pSrcDst, int srcDstStep, IppiSize roiSize); typedef IppStatus (CV_STDCALL * ippiAddProductMask)(const void * pSrc1, int src1Step, const void * pSrc2, int src2Step, const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst, int srcDstStep, IppiSize roiSize); - ippiAddProduct ippFunc = 0; - ippiAddProductMask ippFuncMask = 0; + ippiAddProduct ippiAddProduct_I = 0; + ippiAddProductMask ippiAddProduct_IM = 0; if (mask.empty()) { - ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_8u32f_C1IR : + ippiAddProduct_I = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_8u32f_C1IR : sdepth == CV_16U && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_16u32f_C1IR : sdepth == CV_32F && ddepth == CV_32F ? (ippiAddProduct)ippiAddProduct_32f_C1IR : 0; } else if (scn == 1) { - ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_8u32f_C1IMR : + ippiAddProduct_IM = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_8u32f_C1IMR : sdepth == CV_16U && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_16u32f_C1IMR : sdepth == CV_32F && ddepth == CV_32F ? (ippiAddProductMask)ippiAddProduct_32f_C1IMR : 0; } - if (ippFunc || ippFuncMask) + if (ippiAddProduct_I || ippiAddProduct_IM) { IppStatus status = ippStsErr; @@ -2099,12 +2109,12 @@ static bool ipp_accumulate_product(InputArray _src1, InputArray _src2, } size.width *= scn; - if (ippFunc) - status = ippFunc(src1.ptr(), src1step, src2.ptr(), src2step, dst.ptr(), - dststep, ippiSize(size.width, size.height)); - else if(ippFuncMask) - status = ippFuncMask(src1.ptr(), src1step, src2.ptr(), src2step, mask.ptr(), maskstep, - dst.ptr(), dststep, ippiSize(size.width, size.height)); + if (ippiAddProduct_I) + status = CV_INSTRUMENT_FUN_IPP(ippiAddProduct_I, src1.ptr(), src1step, src2.ptr(), src2step, dst.ptr(), + dststep, ippiSize(size.width, size.height)); + else if (ippiAddProduct_IM) + status = CV_INSTRUMENT_FUN_IPP(ippiAddProduct_IM, src1.ptr(), src1step, src2.ptr(), src2step, mask.ptr(), maskstep, + dst.ptr(), dststep, ippiSize(size.width, size.height)); if (status >= 0) return true; @@ -2120,6 +2130,8 @@ static bool ipp_accumulate_product(InputArray _src1, InputArray _src2, void cv::accumulateProduct( InputArray _src1, InputArray _src2, InputOutputArray _dst, InputArray _mask ) { + CV_INSTRUMENT_REGION() + int stype = _src1.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype); int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype), dcn = CV_MAT_CN(dtype); @@ -2154,6 +2166,8 @@ namespace cv static bool ipp_accumulate_weighted( InputArray _src, InputOutputArray _dst, double alpha, InputArray _mask ) { + CV_INSTRUMENT_REGION_IPP() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype); int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype); @@ -2166,23 +2180,23 @@ static bool ipp_accumulate_weighted( InputArray _src, InputOutputArray _dst, typedef IppStatus (CV_STDCALL * ippiAddWeightedMask)(const void * pSrc, int srcStep, const Ipp8u * pMask, int maskStep, Ipp32f * pSrcDst, int srcDstStep, IppiSize roiSize, Ipp32f alpha); - ippiAddWeighted ippFunc = 0; - ippiAddWeightedMask ippFuncMask = 0; + ippiAddWeighted ippiAddWeighted_I = 0; + ippiAddWeightedMask ippiAddWeighted_IM = 0; if (mask.empty()) { - ippFunc = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_8u32f_C1IR : + ippiAddWeighted_I = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_8u32f_C1IR : sdepth == CV_16U && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_16u32f_C1IR : sdepth == CV_32F && ddepth == CV_32F ? (ippiAddWeighted)ippiAddWeighted_32f_C1IR : 0; } else if (scn == 1) { - ippFuncMask = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_8u32f_C1IMR : + ippiAddWeighted_IM = sdepth == CV_8U && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_8u32f_C1IMR : sdepth == CV_16U && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_16u32f_C1IMR : sdepth == CV_32F && ddepth == CV_32F ? (ippiAddWeightedMask)ippiAddWeighted_32f_C1IMR : 0; } - if (ippFunc || ippFuncMask) + if (ippiAddWeighted_I || ippiAddWeighted_IM) { IppStatus status = ippStsErr; @@ -2198,11 +2212,11 @@ static bool ipp_accumulate_weighted( InputArray _src, InputOutputArray _dst, } size.width *= scn; - if (ippFunc) - status = ippFunc(src.ptr(), srcstep, dst.ptr(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha); - else if(ippFuncMask) - status = ippFuncMask(src.ptr(), srcstep, mask.ptr(), maskstep, - dst.ptr(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha); + if (ippiAddWeighted_I) + status = CV_INSTRUMENT_FUN_IPP(ippiAddWeighted_I, src.ptr(), srcstep, dst.ptr(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha); + else if (ippiAddWeighted_IM) + status = CV_INSTRUMENT_FUN_IPP(ippiAddWeighted_IM, src.ptr(), srcstep, mask.ptr(), maskstep, + dst.ptr(), dststep, ippiSize(size.width, size.height), (Ipp32f)alpha); if (status >= 0) return true; @@ -2216,6 +2230,8 @@ static bool ipp_accumulate_weighted( InputArray _src, InputOutputArray _dst, void cv::accumulateWeighted( InputArray _src, InputOutputArray _dst, double alpha, InputArray _mask ) { + CV_INSTRUMENT_REGION() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), scn = CV_MAT_CN(stype); int dtype = _dst.type(), ddepth = CV_MAT_DEPTH(dtype), dcn = CV_MAT_CN(dtype); diff --git a/modules/imgproc/src/approx.cpp b/modules/imgproc/src/approx.cpp index 54b5dd07ab..ec0db30179 100644 --- a/modules/imgproc/src/approx.cpp +++ b/modules/imgproc/src/approx.cpp @@ -674,6 +674,8 @@ approxPolyDP_( const Point_* src_contour, int count0, Point_* dst_contour, void cv::approxPolyDP( InputArray _curve, OutputArray _approxCurve, double epsilon, bool closed ) { + CV_INSTRUMENT_REGION() + Mat curve = _curve.getMat(); int npoints = curve.checkVector(2), depth = curve.depth(); CV_Assert( npoints >= 0 && (depth == CV_32S || depth == CV_32F)); diff --git a/modules/imgproc/src/blend.cpp b/modules/imgproc/src/blend.cpp index 2393f26db7..17e31aa4ab 100644 --- a/modules/imgproc/src/blend.cpp +++ b/modules/imgproc/src/blend.cpp @@ -121,6 +121,8 @@ static bool ocl_blendLinear( InputArray _src1, InputArray _src2, InputArray _wei void cv::blendLinear( InputArray _src1, InputArray _src2, InputArray _weights1, InputArray _weights2, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + int type = _src1.type(), depth = CV_MAT_DEPTH(type); Size size = _src1.size(); diff --git a/modules/imgproc/src/canny.cpp b/modules/imgproc/src/canny.cpp index 8d1f20552c..6ef5dee9e8 100644 --- a/modules/imgproc/src/canny.cpp +++ b/modules/imgproc/src/canny.cpp @@ -66,6 +66,8 @@ static void CannyImpl(Mat& dx_, Mat& dy_, Mat& _dst, double low_thresh, double h template static bool ippCanny(const Mat& _src, const Mat& dx_, const Mat& dy_, Mat& _dst, float low, float high) { + CV_INSTRUMENT_REGION_IPP() + #if USE_IPP_CANNY int size = 0, size1 = 0; IppiSize roi = { _src.cols, _src.rows }; @@ -98,13 +100,13 @@ static bool ippCanny(const Mat& _src, const Mat& dx_, const Mat& dy_, Mat& _dst, if (!useCustomDeriv) { Mat _dx(_src.rows, _src.cols, CV_16S); - if( ippiFilterSobelNegVertBorder_8u16s_C1R(_src.ptr(), (int)_src.step, + if( CV_INSTRUMENT_FUN_IPP(ippiFilterSobelNegVertBorder_8u16s_C1R, _src.ptr(), (int)_src.step, _dx.ptr(), (int)_dx.step, roi, ippMskSize3x3, ippBorderRepl, 0, buffer) < 0 ) return false; Mat _dy(_src.rows, _src.cols, CV_16S); - if( ippiFilterSobelHorizBorder_8u16s_C1R(_src.ptr(), (int)_src.step, + if( CV_INSTRUMENT_FUN_IPP(ippiFilterSobelHorizBorder_8u16s_C1R, _src.ptr(), (int)_src.step, _dy.ptr(), (int)_dy.step, roi, ippMskSize3x3, ippBorderRepl, 0, buffer) < 0 ) return false; @@ -118,7 +120,7 @@ static bool ippCanny(const Mat& _src, const Mat& dx_, const Mat& dy_, Mat& _dst, dy = dy_; } - if( ippiCanny_16s8u_C1R(dx.ptr(), (int)dx.step, + if( CV_INSTRUMENT_FUN_IPP(ippiCanny_16s8u_C1R, dx.ptr(), (int)dx.step, dy.ptr(), (int)dy.step, _dst.ptr(), (int)_dst.step, roi, low, high, buffer) < 0 ) return false; @@ -718,6 +720,8 @@ void Canny( InputArray _src, OutputArray _dst, double low_thresh, double high_thresh, int aperture_size, bool L2gradient ) { + CV_INSTRUMENT_REGION() + const int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); const Size size = _src.size(); diff --git a/modules/imgproc/src/clahe.cpp b/modules/imgproc/src/clahe.cpp index 8481834e1b..342b393577 100644 --- a/modules/imgproc/src/clahe.cpp +++ b/modules/imgproc/src/clahe.cpp @@ -351,6 +351,8 @@ namespace void CLAHE_Impl::apply(cv::InputArray _src, cv::OutputArray _dst) { + CV_INSTRUMENT_REGION() + CV_Assert( _src.type() == CV_8UC1 || _src.type() == CV_16UC1 ); #ifdef HAVE_OPENCL diff --git a/modules/imgproc/src/color.cpp b/modules/imgproc/src/color.cpp index 67d5b9a4a5..00ccb29e1e 100644 --- a/modules/imgproc/src/color.cpp +++ b/modules/imgproc/src/color.cpp @@ -226,6 +226,8 @@ public: virtual void operator()(const Range& range) const { + CV_INSTRUMENT_REGION_IPP(); + const void *yS = src_data + src_step * range.start; void *yD = dst_data + dst_step * range.start; if( !cvt(yS, static_cast(src_step), yD, static_cast(dst_step), width, range.end - range.start) ) @@ -278,19 +280,19 @@ bool CvtColorIPPLoopCopy(const uchar * src_data, size_t src_step, int src_type, static IppStatus CV_STDCALL ippiSwapChannels_8u_C3C4Rf(const Ipp8u* pSrc, int srcStep, Ipp8u* pDst, int dstStep, IppiSize roiSize, const int *dstOrder) { - return ippiSwapChannels_8u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP8u); + return CV_INSTRUMENT_FUN_IPP(ippiSwapChannels_8u_C3C4R, pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP8u); } static IppStatus CV_STDCALL ippiSwapChannels_16u_C3C4Rf(const Ipp16u* pSrc, int srcStep, Ipp16u* pDst, int dstStep, IppiSize roiSize, const int *dstOrder) { - return ippiSwapChannels_16u_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP16u); + return CV_INSTRUMENT_FUN_IPP(ippiSwapChannels_16u_C3C4R, pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP16u); } static IppStatus CV_STDCALL ippiSwapChannels_32f_C3C4Rf(const Ipp32f* pSrc, int srcStep, Ipp32f* pDst, int dstStep, IppiSize roiSize, const int *dstOrder) { - return ippiSwapChannels_32f_C3C4R(pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP32f); + return CV_INSTRUMENT_FUN_IPP(ippiSwapChannels_32f_C3C4R, pSrc, srcStep, pDst, dstStep, roiSize, dstOrder, MAX_IPP32f); } static ippiReorderFunc ippiSwapChannelsC3C4RTab[] = @@ -409,18 +411,18 @@ static ippiGeneralFunc ippiLUVToRGBTab[] = struct IPPGeneralFunctor { - IPPGeneralFunctor(ippiGeneralFunc _func) : func(_func){} + IPPGeneralFunctor(ippiGeneralFunc _func) : ippiColorConvertGeneral(_func){} bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { - return func ? func(src, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0 : false; + return ippiColorConvertGeneral ? CV_INSTRUMENT_FUN_IPP(ippiColorConvertGeneral, src, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0 : false; } private: - ippiGeneralFunc func; + ippiGeneralFunc ippiColorConvertGeneral; }; struct IPPReorderFunctor { - IPPReorderFunctor(ippiReorderFunc _func, int _order0, int _order1, int _order2) : func(_func) + IPPReorderFunctor(ippiReorderFunc _func, int _order0, int _order1, int _order2) : ippiColorConvertReorder(_func) { order[0] = _order0; order[1] = _order1; @@ -429,17 +431,17 @@ struct IPPReorderFunctor } bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { - return func ? func(src, srcStep, dst, dstStep, ippiSize(cols, rows), order) >= 0 : false; + return ippiColorConvertReorder ? CV_INSTRUMENT_FUN_IPP(ippiColorConvertReorder, src, srcStep, dst, dstStep, ippiSize(cols, rows), order) >= 0 : false; } private: - ippiReorderFunc func; + ippiReorderFunc ippiColorConvertReorder; int order[4]; }; struct IPPColor2GrayFunctor { IPPColor2GrayFunctor(ippiColor2GrayFunc _func) : - func(_func) + ippiColorToGray(_func) { coeffs[0] = 0.114f; coeffs[1] = 0.587f; @@ -447,61 +449,61 @@ struct IPPColor2GrayFunctor } bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { - return func ? func(src, srcStep, dst, dstStep, ippiSize(cols, rows), coeffs) >= 0 : false; + return ippiColorToGray ? CV_INSTRUMENT_FUN_IPP(ippiColorToGray, src, srcStep, dst, dstStep, ippiSize(cols, rows), coeffs) >= 0 : false; } private: - ippiColor2GrayFunc func; + ippiColor2GrayFunc ippiColorToGray; Ipp32f coeffs[3]; }; struct IPPGray2BGRFunctor { IPPGray2BGRFunctor(ippiGeneralFunc _func) : - func(_func) + ippiGrayToBGR(_func) { } bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { - if (func == 0) + if (ippiGrayToBGR == 0) return false; const void* srcarray[3] = { src, src, src }; - return func(srcarray, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0; + return CV_INSTRUMENT_FUN_IPP(ippiGrayToBGR, srcarray, srcStep, dst, dstStep, ippiSize(cols, rows)) >= 0; } private: - ippiGeneralFunc func; + ippiGeneralFunc ippiGrayToBGR; }; struct IPPGray2BGRAFunctor { IPPGray2BGRAFunctor(ippiGeneralFunc _func1, ippiReorderFunc _func2, int _depth) : - func1(_func1), func2(_func2), depth(_depth) + ippiColorConvertGeneral(_func1), ippiColorConvertReorder(_func2), depth(_depth) { } bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { - if (func1 == 0 || func2 == 0) + if (ippiColorConvertGeneral == 0 || ippiColorConvertReorder == 0) return false; const void* srcarray[3] = { src, src, src }; Mat temp(rows, cols, CV_MAKETYPE(depth, 3)); - if(func1(srcarray, srcStep, temp.ptr(), (int)temp.step[0], ippiSize(cols, rows)) < 0) + if(CV_INSTRUMENT_FUN_IPP(ippiColorConvertGeneral, srcarray, srcStep, temp.ptr(), (int)temp.step[0], ippiSize(cols, rows)) < 0) return false; int order[4] = {0, 1, 2, 3}; - return func2(temp.ptr(), (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0; + return CV_INSTRUMENT_FUN_IPP(ippiColorConvertReorder, temp.ptr(), (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0; } private: - ippiGeneralFunc func1; - ippiReorderFunc func2; + ippiGeneralFunc ippiColorConvertGeneral; + ippiReorderFunc ippiColorConvertReorder; int depth; }; struct IPPReorderGeneralFunctor { IPPReorderGeneralFunctor(ippiReorderFunc _func1, ippiGeneralFunc _func2, int _order0, int _order1, int _order2, int _depth) : - func1(_func1), func2(_func2), depth(_depth) + ippiColorConvertReorder(_func1), ippiColorConvertGeneral(_func2), depth(_depth) { order[0] = _order0; order[1] = _order1; @@ -510,18 +512,18 @@ struct IPPReorderGeneralFunctor } bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { - if (func1 == 0 || func2 == 0) + if (ippiColorConvertReorder == 0 || ippiColorConvertGeneral == 0) return false; Mat temp; temp.create(rows, cols, CV_MAKETYPE(depth, 3)); - if(func1(src, srcStep, temp.ptr(), (int)temp.step[0], ippiSize(cols, rows), order) < 0) + if(CV_INSTRUMENT_FUN_IPP(ippiColorConvertReorder, src, srcStep, temp.ptr(), (int)temp.step[0], ippiSize(cols, rows), order) < 0) return false; - return func2(temp.ptr(), (int)temp.step[0], dst, dstStep, ippiSize(cols, rows)) >= 0; + return CV_INSTRUMENT_FUN_IPP(ippiColorConvertGeneral, temp.ptr(), (int)temp.step[0], dst, dstStep, ippiSize(cols, rows)) >= 0; } private: - ippiReorderFunc func1; - ippiGeneralFunc func2; + ippiReorderFunc ippiColorConvertReorder; + ippiGeneralFunc ippiColorConvertGeneral; int order[4]; int depth; }; @@ -529,7 +531,7 @@ private: struct IPPGeneralReorderFunctor { IPPGeneralReorderFunctor(ippiGeneralFunc _func1, ippiReorderFunc _func2, int _order0, int _order1, int _order2, int _depth) : - func1(_func1), func2(_func2), depth(_depth) + ippiColorConvertGeneral(_func1), ippiColorConvertReorder(_func2), depth(_depth) { order[0] = _order0; order[1] = _order1; @@ -538,18 +540,18 @@ struct IPPGeneralReorderFunctor } bool operator()(const void *src, int srcStep, void *dst, int dstStep, int cols, int rows) const { - if (func1 == 0 || func2 == 0) + if (ippiColorConvertGeneral == 0 || ippiColorConvertReorder == 0) return false; Mat temp; temp.create(rows, cols, CV_MAKETYPE(depth, 3)); - if(func1(src, srcStep, temp.ptr(), (int)temp.step[0], ippiSize(cols, rows)) < 0) + if(CV_INSTRUMENT_FUN_IPP(ippiColorConvertGeneral, src, srcStep, temp.ptr(), (int)temp.step[0], ippiSize(cols, rows)) < 0) return false; - return func2(temp.ptr(), (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0; + return CV_INSTRUMENT_FUN_IPP(ippiColorConvertReorder, temp.ptr(), (int)temp.step[0], dst, dstStep, ippiSize(cols, rows), order) >= 0; } private: - ippiGeneralFunc func1; - ippiReorderFunc func2; + ippiGeneralFunc ippiColorConvertGeneral; + ippiReorderFunc ippiColorConvertReorder; int order[4]; int depth; }; @@ -7537,6 +7539,8 @@ void cvtBGRtoBGR(const uchar * src_data, size_t src_step, int width, int height, int depth, int scn, int dcn, bool swapBlue) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGRtoBGR, cv_hal_cvtBGRtoBGR, src_data, src_step, dst_data, dst_step, width, height, depth, scn, dcn, swapBlue); #if defined(HAVE_IPP) && IPP_VERSION_X100 >= 700 @@ -7598,6 +7602,8 @@ void cvtBGRtoBGR5x5(const uchar * src_data, size_t src_step, int width, int height, int scn, bool swapBlue, int greenBits) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGRtoBGR5x5, cv_hal_cvtBGRtoBGR5x5, src_data, src_step, dst_data, dst_step, width, height, scn, swapBlue, greenBits); #if defined(HAVE_IPP) && IPP_DISABLE_BLOCK // breaks OCL accuracy tests @@ -7644,6 +7650,8 @@ void cvtBGR5x5toBGR(const uchar * src_data, size_t src_step, int width, int height, int dcn, bool swapBlue, int greenBits) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGR5x5toBGR, cv_hal_cvtBGR5x5toBGR, src_data, src_step, dst_data, dst_step, width, height, dcn, swapBlue, greenBits); #if defined(HAVE_IPP) && IPP_VERSION_X100 < 900 @@ -7690,6 +7698,8 @@ void cvtBGRtoGray(const uchar * src_data, size_t src_step, int width, int height, int depth, int scn, bool swapBlue) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGRtoGray, cv_hal_cvtBGRtoGray, src_data, src_step, dst_data, dst_step, width, height, depth, scn, swapBlue); #if defined(HAVE_IPP) && IPP_VERSION_X100 >= 700 @@ -7737,6 +7747,8 @@ void cvtGraytoBGR(const uchar * src_data, size_t src_step, int width, int height, int depth, int dcn) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtGraytoBGR, cv_hal_cvtGraytoBGR, src_data, src_step, dst_data, dst_step, width, height, depth, dcn); #if defined(HAVE_IPP) && IPP_VERSION_X100 >= 700 @@ -7771,6 +7783,8 @@ void cvtBGR5x5toGray(const uchar * src_data, size_t src_step, int width, int height, int greenBits) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGR5x5toGray, cv_hal_cvtBGR5x5toGray, src_data, src_step, dst_data, dst_step, width, height, greenBits); CvtColorLoop(src_data, src_step, dst_data, dst_step, width, height, RGB5x52Gray(greenBits)); } @@ -7781,6 +7795,8 @@ void cvtGraytoBGR5x5(const uchar * src_data, size_t src_step, int width, int height, int greenBits) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtGraytoBGR5x5, cv_hal_cvtGraytoBGR5x5, src_data, src_step, dst_data, dst_step, width, height, greenBits); CvtColorLoop(src_data, src_step, dst_data, dst_step, width, height, Gray2RGB5x5(greenBits)); } @@ -7791,6 +7807,8 @@ void cvtBGRtoYUV(const uchar * src_data, size_t src_step, int width, int height, int depth, int scn, bool swapBlue, bool isCbCr) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGRtoYUV, cv_hal_cvtBGRtoYUV, src_data, src_step, dst_data, dst_step, width, height, depth, scn, swapBlue, isCbCr); #if defined(HAVE_IPP) && IPP_DISABLE_BLOCK @@ -7844,6 +7862,8 @@ void cvtYUVtoBGR(const uchar * src_data, size_t src_step, int width, int height, int depth, int dcn, bool swapBlue, bool isCbCr) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtYUVtoBGR, cv_hal_cvtYUVtoBGR, src_data, src_step, dst_data, dst_step, width, height, depth, dcn, swapBlue, isCbCr); @@ -7898,6 +7918,8 @@ void cvtBGRtoXYZ(const uchar * src_data, size_t src_step, int width, int height, int depth, int scn, bool swapBlue) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGRtoXYZ, cv_hal_cvtBGRtoXYZ, src_data, src_step, dst_data, dst_step, width, height, depth, scn, swapBlue); #if defined(HAVE_IPP) && IPP_VERSION_X100 >= 700 @@ -7944,6 +7966,8 @@ void cvtXYZtoBGR(const uchar * src_data, size_t src_step, int width, int height, int depth, int dcn, bool swapBlue) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtXYZtoBGR, cv_hal_cvtXYZtoBGR, src_data, src_step, dst_data, dst_step, width, height, depth, dcn, swapBlue); #if defined(HAVE_IPP) && IPP_VERSION_X100 >= 700 @@ -7991,6 +8015,8 @@ void cvtBGRtoHSV(const uchar * src_data, size_t src_step, int width, int height, int depth, int scn, bool swapBlue, bool isFullRange, bool isHSV) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGRtoHSV, cv_hal_cvtBGRtoHSV, src_data, src_step, dst_data, dst_step, width, height, depth, scn, swapBlue, isFullRange, isHSV); #if defined(HAVE_IPP) && IPP_VERSION_X100 >= 700 @@ -8076,6 +8102,8 @@ void cvtHSVtoBGR(const uchar * src_data, size_t src_step, int width, int height, int depth, int dcn, bool swapBlue, bool isFullRange, bool isHSV) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtHSVtoBGR, cv_hal_cvtHSVtoBGR, src_data, src_step, dst_data, dst_step, width, height, depth, dcn, swapBlue, isFullRange, isHSV); #if defined(HAVE_IPP) && IPP_VERSION_X100 >= 700 @@ -8165,6 +8193,8 @@ void cvtBGRtoLab(const uchar * src_data, size_t src_step, int width, int height, int depth, int scn, bool swapBlue, bool isLab, bool srgb) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGRtoLab, cv_hal_cvtBGRtoLab, src_data, src_step, dst_data, dst_step, width, height, depth, scn, swapBlue, isLab, srgb); #if defined(HAVE_IPP) && IPP_DISABLE_BLOCK @@ -8260,6 +8290,8 @@ void cvtLabtoBGR(const uchar * src_data, size_t src_step, int width, int height, int depth, int dcn, bool swapBlue, bool isLab, bool srgb) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtLabtoBGR, cv_hal_cvtLabtoBGR, src_data, src_step, dst_data, dst_step, width, height, depth, dcn, swapBlue, isLab, srgb); #if defined(HAVE_IPP) && IPP_DISABLE_BLOCK @@ -8353,6 +8385,8 @@ void cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtTwoPlaneYUVtoBGR, cv_hal_cvtTwoPlaneYUVtoBGR, src_data, src_step, dst_data, dst_step, dst_width, dst_height, dcn, swapBlue, uIdx); int blueIdx = swapBlue ? 2 : 0; const uchar* uv = src_data + src_step * static_cast(dst_height); @@ -8375,6 +8409,8 @@ void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtThreePlaneYUVtoBGR, cv_hal_cvtThreePlaneYUVtoBGR, src_data, src_step, dst_data, dst_step, dst_width, dst_height, dcn, swapBlue, uIdx); const uchar* u = src_data + src_step * static_cast(dst_height); const uchar* v = src_data + src_step * static_cast(dst_height + dst_height/4) + (dst_width/2) * ((dst_height % 4)/2); @@ -8400,6 +8436,8 @@ void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step, int width, int height, int scn, bool swapBlue, int uIdx) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtBGRtoThreePlaneYUV, cv_hal_cvtBGRtoThreePlaneYUV, src_data, src_step, dst_data, dst_step, width, height, scn, swapBlue, uIdx); int blueIdx = swapBlue ? 2 : 0; switch(blueIdx + uIdx*10) @@ -8417,6 +8455,8 @@ void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step, int width, int height, int dcn, bool swapBlue, int uIdx, int ycn) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtOnePlaneYUVtoBGR, cv_hal_cvtOnePlaneYUVtoBGR, src_data, src_step, dst_data, dst_step, width, height, dcn, swapBlue, uIdx, ycn); int blueIdx = swapBlue ? 2 : 0; switch(dcn*1000 + blueIdx*100 + uIdx*10 + ycn) @@ -8441,6 +8481,8 @@ void cvtRGBAtoMultipliedRGBA(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtRGBAtoMultipliedRGBA, cv_hal_cvtRGBAtoMultipliedRGBA, src_data, src_step, dst_data, dst_step, width, height); #ifdef HAVE_IPP @@ -8459,6 +8501,8 @@ void cvtMultipliedRGBAtoRGBA(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height) { + CV_INSTRUMENT_REGION() + CALL_HAL(cvtMultipliedRGBAtoRGBA, cv_hal_cvtMultipliedRGBAtoRGBA, src_data, src_step, dst_data, dst_step, width, height); CvtColorLoop(src_data, src_step, dst_data, dst_step, width, height, mRGBA2RGBA()); } @@ -8549,6 +8593,8 @@ inline bool isFullRange(int code) void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { + CV_INSTRUMENT_REGION() + int stype = _src.type(); int scn = CV_MAT_CN(stype), depth = CV_MAT_DEPTH(stype), uidx, gbits, ycn; @@ -8747,8 +8793,8 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) _dst.create(dstSz, CV_MAKETYPE(depth, dcn)); dst = _dst.getMat(); #ifdef HAVE_IPP - if (ippStsNoErr == ippiCopy_8u_C1R(src.data, (int)src.step, dst.data, (int)dst.step, - ippiSize(dstSz.width, dstSz.height))) + if (CV_INSTRUMENT_FUN_IPP(ippiCopy_8u_C1R, src.data, (int)src.step, dst.data, (int)dst.step, + ippiSize(dstSz.width, dstSz.height)) >= 0) break; #endif src(Range(0, dstSz.height), Range::all()).copyTo(dst); diff --git a/modules/imgproc/src/colormap.cpp b/modules/imgproc/src/colormap.cpp index ec6e005cee..3fc9755403 100644 --- a/modules/imgproc/src/colormap.cpp +++ b/modules/imgproc/src/colormap.cpp @@ -492,6 +492,8 @@ namespace colormap void ColorMap::operator()(InputArray _src, OutputArray _dst) const { + CV_INSTRUMENT_REGION() + if(_lut.total() != 256) CV_Error(Error::StsAssert, "cv::LUT only supports tables of size 256."); Mat src = _src.getMat(); diff --git a/modules/imgproc/src/contours.cpp b/modules/imgproc/src/contours.cpp index 4cb3f55c41..5f08be5fe5 100644 --- a/modules/imgproc/src/contours.cpp +++ b/modules/imgproc/src/contours.cpp @@ -1704,6 +1704,8 @@ cvFindContours( void* img, CvMemStorage* storage, void cv::findContours( InputOutputArray _image, OutputArrayOfArrays _contours, OutputArray _hierarchy, int mode, int method, Point offset ) { + CV_INSTRUMENT_REGION() + // Sanity check: output must be of type vector> CV_Assert((_contours.kind() == _InputArray::STD_VECTOR_VECTOR || _contours.kind() == _InputArray::STD_VECTOR_MAT || _contours.kind() == _InputArray::STD_VECTOR_UMAT)); @@ -1757,6 +1759,8 @@ void cv::findContours( InputOutputArray _image, OutputArrayOfArrays _contours, void cv::findContours( InputOutputArray _image, OutputArrayOfArrays _contours, int mode, int method, Point offset) { + CV_INSTRUMENT_REGION() + findContours(_image, _contours, noArray(), mode, method, offset); } diff --git a/modules/imgproc/src/convhull.cpp b/modules/imgproc/src/convhull.cpp index b870ee4217..f7e7c2291d 100644 --- a/modules/imgproc/src/convhull.cpp +++ b/modules/imgproc/src/convhull.cpp @@ -128,6 +128,8 @@ struct CHullCmpPoints void convexHull( InputArray _points, OutputArray _hull, bool clockwise, bool returnPoints ) { + CV_INSTRUMENT_REGION() + Mat points = _points.getMat(); int i, total = points.checkVector(2), depth = points.depth(), nout = 0; int miny_ind = 0, maxy_ind = 0; @@ -264,6 +266,8 @@ void convexHull( InputArray _points, OutputArray _hull, bool clockwise, bool ret void convexityDefects( InputArray _points, InputArray _hull, OutputArray _defects ) { + CV_INSTRUMENT_REGION() + Mat points = _points.getMat(); int i, j = 0, npoints = points.checkVector(2, CV_32S); CV_Assert( npoints >= 0 ); diff --git a/modules/imgproc/src/corner.cpp b/modules/imgproc/src/corner.cpp index 946625eb0b..7f3bad5012 100644 --- a/modules/imgproc/src/corner.cpp +++ b/modules/imgproc/src/corner.cpp @@ -528,6 +528,8 @@ namespace cv { static bool ipp_cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, int ksize, int borderType ) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 800 Mat src = _src.getMat(); _dst.create( src.size(), CV_32FC1 ); @@ -552,23 +554,23 @@ static bool ipp_cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockS (kerSize == 3 || kerSize == 5) && (blockSize == 3 || blockSize == 5)) { ippiMinEigenValGetBufferSize getBufferSizeFunc = 0; - ippiMinEigenVal minEigenValFunc = 0; + ippiMinEigenVal ippiMinEigenVal_C1R = 0; float norm_coef = 0.f; if (src.type() == CV_8UC1) { getBufferSizeFunc = (ippiMinEigenValGetBufferSize) ippiMinEigenValGetBufferSize_8u32f_C1R; - minEigenValFunc = (ippiMinEigenVal) ippiMinEigenVal_8u32f_C1R; + ippiMinEigenVal_C1R = (ippiMinEigenVal) ippiMinEigenVal_8u32f_C1R; norm_coef = 1.f / 255.f; } else if (src.type() == CV_32FC1) { getBufferSizeFunc = (ippiMinEigenValGetBufferSize) ippiMinEigenValGetBufferSize_32f_C1R; - minEigenValFunc = (ippiMinEigenVal) ippiMinEigenVal_32f_C1R; + ippiMinEigenVal_C1R = (ippiMinEigenVal) ippiMinEigenVal_32f_C1R; norm_coef = 255.f; } norm_coef = kerType == ippKernelSobel ? norm_coef : norm_coef / 2.45f; - if (getBufferSizeFunc && minEigenValFunc) + if (getBufferSizeFunc && ippiMinEigenVal_C1R) { int bufferSize; IppiSize srcRoi = { src.cols, src.rows }; @@ -576,9 +578,9 @@ static bool ipp_cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockS if (ok >= 0) { AutoBuffer buffer(bufferSize); - ok = minEigenValFunc(src.ptr(), (int) src.step, dst.ptr(), (int) dst.step, srcRoi, kerType, kerSize, blockSize, buffer); + ok = CV_INSTRUMENT_FUN_IPP(ippiMinEigenVal_C1R, src.ptr(), (int) src.step, dst.ptr(), (int) dst.step, srcRoi, kerType, kerSize, blockSize, buffer); CV_SUPPRESS_DEPRECATED_START - if (ok >= 0) ok = ippiMulC_32f_C1IR(norm_coef, dst.ptr(), (int) dst.step, srcRoi); + if (ok >= 0) ok = CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1IR, norm_coef, dst.ptr(), (int) dst.step, srcRoi); CV_SUPPRESS_DEPRECATED_END if (ok >= 0) { @@ -599,6 +601,8 @@ static bool ipp_cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockS void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, int ksize, int borderType ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(), ocl_cornerMinEigenValVecs(_src, _dst, blockSize, ksize, 0.0, borderType, MINEIGENVAL)) @@ -609,7 +613,7 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in #endif CV_IPP_RUN(((borderTypeNI == BORDER_REPLICATE && (!_src.isSubmatrix() || isolated)) && (kerSize == 3 || kerSize == 5) && (blockSize == 3 || blockSize == 5)) && IPP_VERSION_X100 >= 800, - ipp_cornerMinEigenVal( _src, _dst, blockSize, ksize, borderType )); + ipp_cornerMinEigenVal( _src, _dst, blockSize, ksize, borderType )); Mat src = _src.getMat(); @@ -625,6 +629,8 @@ namespace cv { static bool ipp_cornerHarris( InputArray _src, OutputArray _dst, int blockSize, int ksize, double k, int borderType ) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 810 && IPP_DISABLE_BLOCK Mat src = _src.getMat(); _dst.create( src.size(), CV_32FC1 ); @@ -658,11 +664,11 @@ static bool ipp_cornerHarris( InputArray _src, OutputArray _dst, int blockSize, IppStatus status = (IppStatus)-1; if (depth == CV_8U) - status = ippiHarrisCorner_8u32f_C1R((const Ipp8u *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roisize, - filterType, masksize, blockSize, (Ipp32f)k, (Ipp32f)scale, borderTypeIpp, 0, buffer); + status = CV_INSTRUMENT_FUN_IPP(ippiHarrisCorner_8u32f_C1R,((const Ipp8u *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roisize, + filterType, masksize, blockSize, (Ipp32f)k, (Ipp32f)scale, borderTypeIpp, 0, buffer)); else if (depth == CV_32F) - status = ippiHarrisCorner_32f_C1R((const Ipp32f *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roisize, - filterType, masksize, blockSize, (Ipp32f)k, (Ipp32f)scale, borderTypeIpp, 0, buffer); + status = CV_INSTRUMENT_FUN_IPP(ippiHarrisCorner_32f_C1R,((const Ipp32f *)src.data, (int)src.step, (Ipp32f *)dst.data, (int)dst.step, roisize, + filterType, masksize, blockSize, (Ipp32f)k, (Ipp32f)scale, borderTypeIpp, 0, buffer)); ippsFree(buffer); if (status >= 0) @@ -683,6 +689,8 @@ static bool ipp_cornerHarris( InputArray _src, OutputArray _dst, int blockSize, void cv::cornerHarris( InputArray _src, OutputArray _dst, int blockSize, int ksize, double k, int borderType ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(), ocl_cornerMinEigenValVecs(_src, _dst, blockSize, ksize, k, borderType, HARRIS)) @@ -706,6 +714,8 @@ void cv::cornerHarris( InputArray _src, OutputArray _dst, int blockSize, int ksi void cv::cornerEigenValsAndVecs( InputArray _src, OutputArray _dst, int blockSize, int ksize, int borderType ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); Size dsz = _dst.size(); int dtype = _dst.type(); @@ -719,6 +729,8 @@ void cv::cornerEigenValsAndVecs( InputArray _src, OutputArray _dst, int blockSiz void cv::preCornerDetect( InputArray _src, OutputArray _dst, int ksize, int borderType ) { + CV_INSTRUMENT_REGION() + int type = _src.type(); CV_Assert( type == CV_8UC1 || type == CV_32FC1 ); diff --git a/modules/imgproc/src/cornersubpix.cpp b/modules/imgproc/src/cornersubpix.cpp index 1909bbcbb1..1bd30d24c9 100644 --- a/modules/imgproc/src/cornersubpix.cpp +++ b/modules/imgproc/src/cornersubpix.cpp @@ -44,6 +44,8 @@ void cv::cornerSubPix( InputArray _image, InputOutputArray _corners, Size win, Size zeroZone, TermCriteria criteria ) { + CV_INSTRUMENT_REGION() + const int MAX_ITERS = 100; int win_w = win.width * 2 + 1, win_h = win.height * 2 + 1; int i, j, k; diff --git a/modules/imgproc/src/demosaicing.cpp b/modules/imgproc/src/demosaicing.cpp index cec450dc71..296ace8a25 100644 --- a/modules/imgproc/src/demosaicing.cpp +++ b/modules/imgproc/src/demosaicing.cpp @@ -1615,6 +1615,8 @@ static void Bayer2RGB_EdgeAware_T(const Mat& src, Mat& dst, int code) void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(), dst; Size sz = src.size(); int scn = src.channels(), depth = src.depth(); diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index 06592d8b2d..aa9183aceb 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -184,6 +184,8 @@ namespace cv { static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, double scale, double delta, int borderType) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 810 if ((0 > dx) || (0 > dy) || (1 != dx + dy)) return false; @@ -230,7 +232,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx pBuffer = ippsMalloc_8u(bufferSize); if (NULL == pBuffer) return false; - sts = ippiFilterScharrHorizMaskBorder_8u16s_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); + sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrHorizMaskBorder_8u16s_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); } else { @@ -239,7 +241,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx pBuffer = ippsMalloc_8u(bufferSize); if (NULL == pBuffer) return false; - sts = ippiFilterScharrVertMaskBorder_8u16s_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); + sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrVertMaskBorder_8u16s_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); } ippsFree(pBuffer); } @@ -253,7 +255,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx pBuffer = ippsMalloc_8u(bufferSize); if (NULL == pBuffer) return false; - sts = ippiFilterScharrHorizMaskBorder_16s_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); + sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrHorizMaskBorder_16s_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); } else { @@ -262,7 +264,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx pBuffer = ippsMalloc_8u(bufferSize); if (NULL == pBuffer) return false; - sts = ippiFilterScharrVertMaskBorder_16s_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); + sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrVertMaskBorder_16s_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); } ippsFree(pBuffer); } @@ -276,7 +278,7 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx pBuffer = ippsMalloc_8u(bufferSize); if (NULL == pBuffer) return false; - sts = ippiFilterScharrHorizMaskBorder_32f_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); + sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrHorizMaskBorder_32f_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); } else { @@ -285,14 +287,14 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx pBuffer = ippsMalloc_8u(bufferSize); if (NULL == pBuffer) return false; - sts = ippiFilterScharrVertMaskBorder_32f_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); + sts = CV_INSTRUMENT_FUN_IPP(ippiFilterScharrVertMaskBorder_32f_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roiSize, ippMskSize3x3, ippiBorderType, 0, pBuffer); } ippsFree(pBuffer); if (sts < 0) return false;; if (FLT_EPSILON < fabs(scale - 1.0)) - sts = ippiMulC_32f_C1R(dst.ptr(), (int)dst.step, (Ipp32f)scale, dst.ptr(), (int)dst.step, roiSize); + sts = CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1R, dst.ptr(), (int)dst.step, (Ipp32f)scale, dst.ptr(), (int)dst.step, roiSize); } return (0 <= sts); #else @@ -303,6 +305,8 @@ static bool IPPDerivScharr(InputArray _src, OutputArray _dst, int ddepth, int dx static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType) { + CV_INSTRUMENT_REGION_IPP() + if ((borderType != BORDER_REPLICATE) || ((3 != ksize) && (5 != ksize))) return false; if (fabs(delta) > FLT_EPSILON) @@ -333,7 +337,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, buffer.allocate(bufSize); #endif - if (0 > ippiFilterSobelNegVertBorder_8u16s_C1R(src.ptr(), (int)src.step, + if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelNegVertBorder_8u16s_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, kernel, ippBorderRepl, 0, (Ipp8u*)(char*)buffer)) return false; @@ -352,7 +356,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, buffer.allocate(bufSize); #endif - if (0 > ippiFilterSobelHorizBorder_8u16s_C1R(src.ptr(), (int)src.step, + if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelHorizBorder_8u16s_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, kernel, ippBorderRepl, 0, (Ipp8u*)(char*)buffer)) return false; @@ -371,7 +375,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, buffer.allocate(bufSize); #endif - if (0 > ippiFilterSobelVertSecondBorder_8u16s_C1R(src.ptr(), (int)src.step, + if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelVertSecondBorder_8u16s_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, kernel, ippBorderRepl, 0, (Ipp8u*)(char*)buffer)) return false; @@ -390,7 +394,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, buffer.allocate(bufSize); #endif - if (0 > ippiFilterSobelHorizSecondBorder_8u16s_C1R(src.ptr(), (int)src.step, + if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelHorizSecondBorder_8u16s_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, kernel, ippBorderRepl, 0, (Ipp8u*)(char*)buffer)) return false; @@ -456,12 +460,12 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, buffer.allocate(bufSize); #endif - if (0 > ippiFilterSobelVertSecondBorder_32f_C1R(src.ptr(), (int)src.step, + if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelVertSecondBorder_32f_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, kernel, ippBorderRepl, 0, (Ipp8u*)(char*)buffer)) return false; if(scale != 1) - ippiMulC_32f_C1R(dst.ptr(), (int)dst.step, (Ipp32f)scale, dst.ptr(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); + CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1R, dst.ptr(), (int)dst.step, (Ipp32f)scale, dst.ptr(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); return true; } @@ -477,13 +481,13 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, buffer.allocate(bufSize); #endif - if (0 > ippiFilterSobelHorizSecondBorder_32f_C1R(src.ptr(), (int)src.step, + if (0 > CV_INSTRUMENT_FUN_IPP(ippiFilterSobelHorizSecondBorder_32f_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, kernel, ippBorderRepl, 0, (Ipp8u*)(char*)buffer)) return false; if(scale != 1) - ippiMulC_32f_C1R(dst.ptr(), (int)dst.step, (Ipp32f)scale, dst.ptr(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); + CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1R, dst.ptr(), (int)dst.step, (Ipp32f)scale, dst.ptr(), (int)dst.step, ippiSize(dst.cols*dst.channels(), dst.rows)); return true; } } @@ -492,6 +496,8 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx, static bool ipp_sobel(InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType) { + CV_INSTRUMENT_REGION_IPP() + if (ksize < 0) { if (IPPDerivScharr(_src, _dst, ddepth, dx, dy, scale, delta, borderType)) @@ -510,6 +516,8 @@ static bool ipp_sobel(InputArray _src, OutputArray _dst, int ddepth, int dx, int void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType ) { + CV_INSTRUMENT_REGION() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype); if (ddepth < 0) ddepth = sdepth; @@ -549,6 +557,8 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, void cv::Scharr( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, double scale, double delta, int borderType ) { + CV_INSTRUMENT_REGION() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype); if (ddepth < 0) ddepth = sdepth; @@ -733,6 +743,8 @@ namespace cv static bool ipp_Laplacian(InputArray _src, OutputArray _dst, int ddepth, int ksize, double scale, double delta, int borderType) { + CV_INSTRUMENT_REGION_IPP() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype); if (ddepth < 0) ddepth = sdepth; @@ -758,7 +770,7 @@ static bool ipp_Laplacian(InputArray _src, OutputArray _dst, int ddepth, int ksi if (borderTypeIpp >= 0 && ippiFilterLaplacianGetBufferSize_##ippfavor##_C1R(roisize, masksize, &bufsize) >= 0) \ { \ Ipp8u * buffer = ippsMalloc_8u(bufsize); \ - status = ippiFilterLaplacianBorder_##ippfavor##_C1R(src.ptr(), (int)src.step, dst.ptr(), \ + status = CV_INSTRUMENT_FUN_IPP(ippiFilterLaplacianBorder_##ippfavor##_C1R, src.ptr(), (int)src.step, dst.ptr(), \ (int)dst.step, roisize, masksize, borderTypeIpp, 0, buffer); \ ippsFree(buffer); \ } \ @@ -770,18 +782,18 @@ static bool ipp_Laplacian(InputArray _src, OutputArray _dst, int ddepth, int ksi IPP_FILTER_LAPLACIAN(Ipp8u, Ipp16s, 8u16s); if (needScale && status >= 0) - status = ippiMulC_16s_C1IRSfs((Ipp16s)iscale, dst.ptr(), (int)dst.step, roisize, 0); + status = CV_INSTRUMENT_FUN_IPP(ippiMulC_16s_C1IRSfs, (Ipp16s)iscale, dst.ptr(), (int)dst.step, roisize, 0); if (needDelta && status >= 0) - status = ippiAddC_16s_C1IRSfs((Ipp16s)idelta, dst.ptr(), (int)dst.step, roisize, 0); + status = CV_INSTRUMENT_FUN_IPP(ippiAddC_16s_C1IRSfs, (Ipp16s)idelta, dst.ptr(), (int)dst.step, roisize, 0); } else if (sdepth == CV_32F && ddepth == CV_32F) { IPP_FILTER_LAPLACIAN(Ipp32f, Ipp32f, 32f); if (needScale && status >= 0) - status = ippiMulC_32f_C1IR((Ipp32f)scale, dst.ptr(), (int)dst.step, roisize); + status = CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1IR, (Ipp32f)scale, dst.ptr(), (int)dst.step, roisize); if (needDelta && status >= 0) - status = ippiAddC_32f_C1IR((Ipp32f)delta, dst.ptr(), (int)dst.step, roisize); + status = CV_INSTRUMENT_FUN_IPP(ippiAddC_32f_C1IR, (Ipp32f)delta, dst.ptr(), (int)dst.step, roisize); } CV_SUPPRESS_DEPRECATED_END @@ -799,6 +811,8 @@ static bool ipp_Laplacian(InputArray _src, OutputArray _dst, int ddepth, int ksi void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize, double scale, double delta, int borderType ) { + CV_INSTRUMENT_REGION() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype); if (ddepth < 0) ddepth = sdepth; diff --git a/modules/imgproc/src/distransform.cpp b/modules/imgproc/src/distransform.cpp index cde6ec4eb6..070a649e63 100644 --- a/modules/imgproc/src/distransform.cpp +++ b/modules/imgproc/src/distransform.cpp @@ -693,7 +693,7 @@ static void distanceTransform_L1_8U(InputArray _src, OutputArray _dst) { IppiSize roi = { src.cols, src.rows }; Ipp32s pMetrics[2] = { 1, 2 }; //L1, 3x3 mask - if (ippiDistanceTransform_3x3_8u_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, pMetrics)>=0) + if (CV_INSTRUMENT_FUN_IPP(ippiDistanceTransform_3x3_8u_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, pMetrics) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -710,6 +710,8 @@ static void distanceTransform_L1_8U(InputArray _src, OutputArray _dst) void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labels, int distType, int maskSize, int labelType ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(), labels; bool need_labels = _labels.needed(); @@ -754,7 +756,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe if (status>=0) { pBuffer = (Ipp8u *)ippMalloc( bufSize ); - status = ippiTrueDistanceTransform_8u32f_C1R(src.ptr(),(int)src.step, dst.ptr(), (int)dst.step, roi, pBuffer); + status = CV_INSTRUMENT_FUN_IPP(ippiTrueDistanceTransform_8u32f_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, pBuffer); ippFree( pBuffer ); if (status>=0) { @@ -789,7 +791,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe CV_IPP_CHECK() { IppiSize roi = { src.cols, src.rows }; - if (ippiDistanceTransform_3x3_8u32f_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, _mask)>=0) + if (CV_INSTRUMENT_FUN_IPP(ippiDistanceTransform_3x3_8u32f_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, _mask) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -806,7 +808,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe CV_IPP_CHECK() { IppiSize roi = { src.cols, src.rows }; - if (ippiDistanceTransform_5x5_8u32f_C1R(src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, _mask)>=0) + if (CV_INSTRUMENT_FUN_IPP(ippiDistanceTransform_5x5_8u32f_C1R, src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, _mask) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -848,6 +850,8 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe void cv::distanceTransform( InputArray _src, OutputArray _dst, int distanceType, int maskSize, int dstType) { + CV_INSTRUMENT_REGION() + if (distanceType == CV_DIST_L1 && dstType==CV_8U) distanceTransform_L1_8U(_src, _dst); else diff --git a/modules/imgproc/src/drawing.cpp b/modules/imgproc/src/drawing.cpp index a73a30f9dc..bd3aa903e7 100644 --- a/modules/imgproc/src/drawing.cpp +++ b/modules/imgproc/src/drawing.cpp @@ -79,6 +79,8 @@ FillConvexPoly( Mat& img, const Point* v, int npts, bool clipLine( Size img_size, Point& pt1, Point& pt2 ) { + CV_INSTRUMENT_REGION() + int64 x1, y1, x2, y2; int c1, c2; int64 right = img_size.width-1, bottom = img_size.height-1; @@ -138,6 +140,8 @@ bool clipLine( Size img_size, Point& pt1, Point& pt2 ) bool clipLine( Rect img_rect, Point& pt1, Point& pt2 ) { + CV_INSTRUMENT_REGION() + Point tl = img_rect.tl(); pt1 -= tl; pt2 -= tl; bool inside = clipLine(img_rect.size(), pt1, pt2); @@ -922,6 +926,8 @@ void ellipse2Poly( Point center, Size axes, int angle, int arc_start, int arc_end, int delta, std::vector& pts ) { + CV_INSTRUMENT_REGION() + float alpha, beta; double size_a = axes.width, size_b = axes.height; double cx = center.x, cy = center.y; @@ -1726,6 +1732,8 @@ void drawMarker(Mat& img, Point position, const Scalar& color, int markerType, i void line( InputOutputArray _img, Point pt1, Point pt2, const Scalar& color, int thickness, int line_type, int shift ) { + CV_INSTRUMENT_REGION() + Mat img = _img.getMat(); if( line_type == CV_AA && img.depth() != CV_8U ) @@ -1742,6 +1750,8 @@ void line( InputOutputArray _img, Point pt1, Point pt2, const Scalar& color, void arrowedLine(InputOutputArray img, Point pt1, Point pt2, const Scalar& color, int thickness, int line_type, int shift, double tipLength) { + CV_INSTRUMENT_REGION() + const double tipSize = norm(pt1-pt2)*tipLength; // Factor to normalize the size of the tip depending on the length of the arrow line(img, pt1, pt2, color, thickness, line_type, shift); @@ -1761,6 +1771,8 @@ void rectangle( InputOutputArray _img, Point pt1, Point pt2, const Scalar& color, int thickness, int lineType, int shift ) { + CV_INSTRUMENT_REGION() + Mat img = _img.getMat(); if( lineType == CV_AA && img.depth() != CV_8U ) @@ -1792,6 +1804,8 @@ void rectangle( Mat& img, Rect rec, const Scalar& color, int thickness, int lineType, int shift ) { + CV_INSTRUMENT_REGION() + CV_Assert( 0 <= shift && shift <= XY_SHIFT ); if( rec.area() > 0 ) rectangle( img, rec.tl(), rec.br() - Point(1<= 0); fillConvexPoly(img, points.ptr(), points.rows*points.cols*points.channels()/2, color, lineType, shift); @@ -2261,6 +2291,8 @@ void cv::fillConvexPoly(InputOutputArray _img, InputArray _points, void cv::fillPoly(InputOutputArray _img, InputArrayOfArrays pts, const Scalar& color, int lineType, int shift, Point offset) { + CV_INSTRUMENT_REGION() + Mat img = _img.getMat(); int i, ncontours = (int)pts.total(); if( ncontours == 0 ) @@ -2285,6 +2317,8 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts, bool isClosed, const Scalar& color, int thickness, int lineType, int shift ) { + CV_INSTRUMENT_REGION() + Mat img = _img.getMat(); bool manyContours = pts.kind() == _InputArray::STD_VECTOR_VECTOR || pts.kind() == _InputArray::STD_VECTOR_MAT; @@ -2347,6 +2381,8 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours, int lineType, InputArray _hierarchy, int maxLevel, Point offset ) { + CV_INSTRUMENT_REGION() + Mat image = _image.getMat(), hierarchy = _hierarchy.getMat(); CvMat _cimage = image; diff --git a/modules/imgproc/src/emd.cpp b/modules/imgproc/src/emd.cpp index 4dddbc6f14..96eda61331 100644 --- a/modules/imgproc/src/emd.cpp +++ b/modules/imgproc/src/emd.cpp @@ -1144,6 +1144,8 @@ float cv::EMD( InputArray _signature1, InputArray _signature2, int distType, InputArray _cost, float* lowerBound, OutputArray _flow ) { + CV_INSTRUMENT_REGION() + Mat signature1 = _signature1.getMat(), signature2 = _signature2.getMat(); Mat cost = _cost.getMat(), flow; diff --git a/modules/imgproc/src/featureselect.cpp b/modules/imgproc/src/featureselect.cpp index 2f5f1631de..3f54bef61e 100644 --- a/modules/imgproc/src/featureselect.cpp +++ b/modules/imgproc/src/featureselect.cpp @@ -269,6 +269,8 @@ void cv::goodFeaturesToTrack( InputArray _image, OutputArray _corners, InputArray _mask, int blockSize, bool useHarrisDetector, double harrisK ) { + CV_INSTRUMENT_REGION() + CV_Assert( qualityLevel > 0 && minDistance >= 0 && maxCorners >= 0 ); CV_Assert( _mask.empty() || (_mask.type() == CV_8UC1 && _mask.sameSize(_image)) ); diff --git a/modules/imgproc/src/filter.cpp b/modules/imgproc/src/filter.cpp index e2c79a6bfd..3bd5cd0f1e 100644 --- a/modules/imgproc/src/filter.cpp +++ b/modules/imgproc/src/filter.cpp @@ -379,6 +379,8 @@ int FilterEngine::proceed( const uchar* src, int srcstep, int count, void FilterEngine::apply(const Mat& src, Mat& dst, const Size & wsz, const Point & ofs) { + CV_INSTRUMENT_REGION() + CV_Assert( src.type() == srcType && dst.type() == dstType ); int y = start(src, wsz, ofs); @@ -1411,6 +1413,8 @@ private: mutable int bufsz; int ippiOperator(const uchar* _src, uchar* _dst, int width, int cn) const { + CV_INSTRUMENT_REGION_IPP() + int _ksize = kernel.rows + kernel.cols - 1; if ((1 != cn && 3 != cn) || width < _ksize*8) return 0; @@ -1432,10 +1436,10 @@ private: float borderValue[] = {0.f, 0.f, 0.f}; // here is the trick. IPP needs border type and extrapolates the row. We did it already. // So we pass anchor=0 and ignore the right tail of results since they are incorrect there. - if( (cn == 1 && ippiFilterRowBorderPipeline_32f_C1R(src, step, &dst, roisz, _kx, _ksize, 0, - ippBorderRepl, borderValue[0], bufptr) < 0) || - (cn == 3 && ippiFilterRowBorderPipeline_32f_C3R(src, step, &dst, roisz, _kx, _ksize, 0, - ippBorderRepl, borderValue, bufptr) < 0)) + if( (cn == 1 && CV_INSTRUMENT_FUN_IPP(ippiFilterRowBorderPipeline_32f_C1R,(src, step, &dst, roisz, _kx, _ksize, 0, + ippBorderRepl, borderValue[0], bufptr)) < 0) || + (cn == 3 && CV_INSTRUMENT_FUN_IPP(ippiFilterRowBorderPipeline_32f_C3R,(src, step, &dst, roisz, _kx, _ksize, 0, + ippBorderRepl, borderValue, bufptr)) < 0)) { setIppErrorStatus(); return 0; @@ -4540,39 +4544,39 @@ struct ReplacementFilter : public hal::Filter2D }; #ifdef HAVE_IPP -typedef IppStatus(CV_STDCALL* ippiFilterBorder)( +typedef IppStatus(CV_STDCALL* IppiFilterBorder)( const void* pSrc, int srcStep, void* pDst, int dstStep, IppiSize dstRoiSize, IppiBorderType border, const void* borderValue, const IppiFilterBorderSpec* pSpec, Ipp8u* pBuffer); -static ippiFilterBorder getIppFunc(int stype) +static IppiFilterBorder getIppFunc(int stype) { switch (stype) { case CV_8UC1: - return reinterpret_cast(ippiFilterBorder_8u_C1R); + return reinterpret_cast(ippiFilterBorder_8u_C1R); case CV_8UC3: - return reinterpret_cast(ippiFilterBorder_8u_C3R); + return reinterpret_cast(ippiFilterBorder_8u_C3R); case CV_8UC4: - return reinterpret_cast(ippiFilterBorder_8u_C4R); + return reinterpret_cast(ippiFilterBorder_8u_C4R); case CV_16UC1: - return reinterpret_cast(ippiFilterBorder_16u_C1R); + return reinterpret_cast(ippiFilterBorder_16u_C1R); case CV_16UC3: - return reinterpret_cast(ippiFilterBorder_16u_C3R); + return reinterpret_cast(ippiFilterBorder_16u_C3R); case CV_16UC4: - return reinterpret_cast(ippiFilterBorder_16u_C4R); + return reinterpret_cast(ippiFilterBorder_16u_C4R); case CV_16SC1: - return reinterpret_cast(ippiFilterBorder_16s_C1R); + return reinterpret_cast(ippiFilterBorder_16s_C1R); case CV_16SC3: - return reinterpret_cast(ippiFilterBorder_16s_C3R); + return reinterpret_cast(ippiFilterBorder_16s_C3R); case CV_16SC4: - return reinterpret_cast(ippiFilterBorder_16s_C4R); + return reinterpret_cast(ippiFilterBorder_16s_C4R); case CV_32FC1: - return reinterpret_cast(ippiFilterBorder_32f_C1R); + return reinterpret_cast(ippiFilterBorder_32f_C1R); case CV_32FC3: - return reinterpret_cast(ippiFilterBorder_32f_C3R); + return reinterpret_cast(ippiFilterBorder_32f_C3R); case CV_32FC4: - return reinterpret_cast(ippiFilterBorder_32f_C4R); + return reinterpret_cast(ippiFilterBorder_32f_C4R); default: return 0; } @@ -4689,12 +4693,14 @@ struct IppFilter : public hal::Filter2D void apply(uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int, int, int, int) { + CV_INSTRUMENT_REGION_IPP() + if (dst_data == src_data) CV_Error(Error::StsBadArg, "Inplace IPP Filter2D is not supported"); - ippiFilterBorder ippFunc = getIppFunc(src_type); + IppiFilterBorder ippiFilterBorder = getIppFunc(src_type); IppiSize dstRoiSize = { width, height }; kernel_type borderValue[4] = { 0, 0, 0, 0 }; - IppStatus status = ippFunc(src_data, (int)src_step, dst_data, (int)dst_step, dstRoiSize, ippBorderType, borderValue, spec, buffer); + IppStatus status = CV_INSTRUMENT_FUN_IPP(ippiFilterBorder, src_data, (int)src_step, dst_data, (int)dst_step, dstRoiSize, ippBorderType, borderValue, spec, buffer); if (status >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); } @@ -4988,6 +4994,8 @@ void cv::filter2D( InputArray _src, OutputArray _dst, int ddepth, InputArray _kernel, Point anchor0, double delta, int borderType ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_dst.isUMat() && _src.dims() <= 2, ocl_filter2D(_src, _dst, ddepth, _kernel, anchor0, delta, borderType)) @@ -5015,6 +5023,8 @@ void cv::sepFilter2D( InputArray _src, OutputArray _dst, int ddepth, InputArray _kernelX, InputArray _kernelY, Point anchor, double delta, int borderType ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_dst.isUMat() && _src.dims() <= 2 && (size_t)_src.rows() > _kernelY.total() && (size_t)_src.cols() > _kernelX.total(), ocl_sepFilter2D(_src, _dst, ddepth, _kernelX, _kernelY, anchor, delta, borderType)) diff --git a/modules/imgproc/src/floodfill.cpp b/modules/imgproc/src/floodfill.cpp index 6d8491a2a6..a818539a86 100644 --- a/modules/imgproc/src/floodfill.cpp +++ b/modules/imgproc/src/floodfill.cpp @@ -459,6 +459,8 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask, Point seedPoint, Scalar newVal, Rect* rect, Scalar loDiff, Scalar upDiff, int flags ) { + CV_INSTRUMENT_REGION() + ConnectedComp comp; std::vector buffer; @@ -629,6 +631,8 @@ int cv::floodFill( InputOutputArray _image, Point seedPoint, Scalar newVal, Rect* rect, Scalar loDiff, Scalar upDiff, int flags ) { + CV_INSTRUMENT_REGION() + return floodFill(_image, Mat(), seedPoint, newVal, rect, loDiff, upDiff, flags); } diff --git a/modules/imgproc/src/generalized_hough.cpp b/modules/imgproc/src/generalized_hough.cpp index a261d644b8..2d0b5bf530 100644 --- a/modules/imgproc/src/generalized_hough.cpp +++ b/modules/imgproc/src/generalized_hough.cpp @@ -415,6 +415,8 @@ namespace void GeneralizedHoughBallardImpl::calcHist() { + CV_INSTRUMENT_REGION() + CV_Assert( imageEdges_.type() == CV_8UC1 ); CV_Assert( imageDx_.type() == CV_32FC1 && imageDx_.size() == imageSize_); CV_Assert( imageDy_.type() == imageDx_.type() && imageDy_.size() == imageSize_); diff --git a/modules/imgproc/src/geometry.cpp b/modules/imgproc/src/geometry.cpp index 2d95853c8a..0377ba3b6b 100644 --- a/modules/imgproc/src/geometry.cpp +++ b/modules/imgproc/src/geometry.cpp @@ -94,6 +94,8 @@ cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] ) double cv::pointPolygonTest( InputArray _contour, Point2f pt, bool measureDist ) { + CV_INSTRUMENT_REGION() + double result = 0; Mat contour = _contour.getMat(); int i, total = contour.checkVector(2), counter = 0; @@ -504,6 +506,8 @@ static int intersectConvexConvex_( const Point2f* P, int n, const Point2f* Q, in float cv::intersectConvexConvex( InputArray _p1, InputArray _p2, OutputArray _p12, bool handleNested ) { + CV_INSTRUMENT_REGION() + Mat p1 = _p1.getMat(), p2 = _p2.getMat(); CV_Assert( p1.depth() == CV_32S || p1.depth() == CV_32F ); CV_Assert( p2.depth() == CV_32S || p2.depth() == CV_32F ); diff --git a/modules/imgproc/src/grabcut.cpp b/modules/imgproc/src/grabcut.cpp index ca3a89faf0..ca9b05c787 100644 --- a/modules/imgproc/src/grabcut.cpp +++ b/modules/imgproc/src/grabcut.cpp @@ -529,6 +529,8 @@ void cv::grabCut( InputArray _img, InputOutputArray _mask, Rect rect, InputOutputArray _bgdModel, InputOutputArray _fgdModel, int iterCount, int mode ) { + CV_INSTRUMENT_REGION() + Mat img = _img.getMat(); Mat& mask = _mask.getMatRef(); Mat& bgdModel = _bgdModel.getMatRef(); diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index 640f07e95f..9b3b1b19a8 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -1188,6 +1188,8 @@ public: virtual void operator() (const Range & range) const { + CV_INSTRUMENT_REGION_IPP() + Ipp32s levelNum = histSize + 1; Mat phist(hist->size(), hist->type(), Scalar::all(0)); #if IPP_VERSION_X100 >= 900 @@ -1226,7 +1228,7 @@ public: return; } - IppStatus status = ippiHistogram_8u_C1R(src->ptr(range.start), (int)src->step, ippiSize(src->cols, range.end - range.start), + IppStatus status = CV_INSTRUMENT_FUN_IPP(ippiHistogram_8u_C1R, src->ptr(range.start), (int)src->step, ippiSize(src->cols, range.end - range.start), phist.ptr(), pSpec, pBuffer); if(pSpec) ippFree(pSpec); @@ -1269,6 +1271,8 @@ static bool ipp_calchist(const Mat* images, int nimages, const int* channels, InputArray _mask, OutputArray _hist, int dims, const int* histSize, const float** ranges, bool uniform, bool accumulate ) { + CV_INSTRUMENT_REGION_IPP() + Mat mask = _mask.getMat(); CV_Assert(dims > 0 && histSize); @@ -1311,6 +1315,7 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels, InputArray _mask, OutputArray _hist, int dims, const int* histSize, const float** ranges, bool uniform, bool accumulate ) { + CV_INSTRUMENT_REGION() CV_IPP_RUN(nimages == 1 && images[0].type() == CV_8UC1 && dims == 1 && channels && channels[0] == 0 && _mask.getMat().empty() && images[0].dims <= 2 && @@ -1602,6 +1607,8 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels, InputArray _mask, SparseMat& hist, int dims, const int* histSize, const float** ranges, bool uniform, bool accumulate ) { + CV_INSTRUMENT_REGION() + Mat mask = _mask.getMat(); calcHist( images, nimages, channels, mask, hist, dims, histSize, ranges, uniform, accumulate, false ); @@ -1614,6 +1621,8 @@ void cv::calcHist( InputArrayOfArrays images, const std::vector& channels, const std::vector& ranges, bool accumulate ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(images.total() == 1 && channels.size() == 1 && images.channels(0) == 1 && channels[0] == 0 && images.isUMatVector() && mask.empty() && !accumulate && histSize.size() == 1 && histSize[0] == BINS && ranges.size() == 2 && @@ -1941,6 +1950,8 @@ void cv::calcBackProject( const Mat* images, int nimages, const int* channels, InputArray _hist, OutputArray _backProject, const float** ranges, double scale, bool uniform ) { + CV_INSTRUMENT_REGION() + Mat hist = _hist.getMat(); std::vector ptrs; std::vector deltas; @@ -2104,6 +2115,8 @@ void cv::calcBackProject( const Mat* images, int nimages, const int* channels, const SparseMat& hist, OutputArray _backProject, const float** ranges, double scale, bool uniform ) { + CV_INSTRUMENT_REGION() + std::vector ptrs; std::vector deltas; std::vector uniranges; @@ -2283,6 +2296,8 @@ void cv::calcBackProject( InputArrayOfArrays images, const std::vector& cha const std::vector& ranges, double scale ) { + CV_INSTRUMENT_REGION() + #ifdef HAVE_OPENCL Size histSize = hist.size(); bool _1D = histSize.height == 1 || histSize.width == 1; @@ -2335,6 +2350,8 @@ void cv::calcBackProject( InputArrayOfArrays images, const std::vector& cha double cv::compareHist( InputArray _H1, InputArray _H2, int method ) { + CV_INSTRUMENT_REGION() + Mat H1 = _H1.getMat(), H2 = _H2.getMat(); const Mat* arrays[] = {&H1, &H2, 0}; Mat planes[2]; @@ -2541,6 +2558,8 @@ double cv::compareHist( InputArray _H1, InputArray _H2, int method ) double cv::compareHist( const SparseMat& H1, const SparseMat& H2, int method ) { + CV_INSTRUMENT_REGION() + double result = 0; int i, dims = H1.dims(); @@ -3685,6 +3704,8 @@ static bool ocl_equalizeHist(InputArray _src, OutputArray _dst) void cv::equalizeHist( InputArray _src, OutputArray _dst ) { + CV_INSTRUMENT_REGION() + CV_Assert( _src.type() == CV_8UC1 ); if (_src.empty()) diff --git a/modules/imgproc/src/hough.cpp b/modules/imgproc/src/hough.cpp index d2d215489c..13c11dbee3 100644 --- a/modules/imgproc/src/hough.cpp +++ b/modules/imgproc/src/hough.cpp @@ -109,7 +109,7 @@ HoughLinesStandard( const Mat& img, float rho, float theta, lines.resize(ipp_linesMax); IppStatus ok = ippiHoughLineGetSize_8u_C1R(srcSize, delta, ipp_linesMax, &bufferSize); Ipp8u* buffer = ippsMalloc_8u(bufferSize); - if (ok >= 0) ok = ippiHoughLine_Region_8u32f_C1R(image, step, srcSize, (IppPointPolar*) &lines[0], dstRoi, ipp_linesMax, &linesCount, delta, threshold, buffer); + if (ok >= 0) {ok = CV_INSTRUMENT_FUN_IPP(ippiHoughLine_Region_8u32f_C1R,(image, step, srcSize, (IppPointPolar*) &lines[0], dstRoi, ipp_linesMax, &linesCount, delta, threshold, buffer))}; ippsFree(buffer); if (ok >= 0) { @@ -443,7 +443,7 @@ HoughLinesProbabilistic( Mat& image, Ipp8u* buffer = ippsMalloc_8u(bufferSize); pSpec = (IppiHoughProbSpec*) malloc(specSize); if (ok >= 0) ok = ippiHoughProbLineInit_8u32f_C1R(srcSize, delta, ippAlgHintNone, pSpec); - if (ok >= 0) ok = ippiHoughProbLine_8u32f_C1R(image.data, image.step, srcSize, threshold, lineLength, lineGap, (IppiPoint*) &lines[0], ipp_linesMax, &linesCount, buffer, pSpec); + if (ok >= 0) {ok = CV_INSTRUMENT_FUN_IPP(ippiHoughProbLine_8u32f_C1R,(image.data, image.step, srcSize, threshold, lineLength, lineGap, (IppiPoint*) &lines[0], ipp_linesMax, &linesCount, buffer, pSpec))}; free(pSpec); ippsFree(buffer); @@ -850,6 +850,8 @@ void cv::HoughLines( InputArray _image, OutputArray _lines, double rho, double theta, int threshold, double srn, double stn, double min_theta, double max_theta ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(srn == 0 && stn == 0 && _image.isUMat() && _lines.isUMat(), ocl_HoughLines(_image, _lines, rho, theta, threshold, min_theta, max_theta)); @@ -869,6 +871,8 @@ void cv::HoughLinesP(InputArray _image, OutputArray _lines, double rho, double theta, int threshold, double minLineLength, double maxGap ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_image.isUMat() && _lines.isUMat(), ocl_HoughLinesP(_image, _lines, rho, theta, threshold, minLineLength, maxGap)); @@ -1322,6 +1326,8 @@ void cv::HoughCircles( InputArray _image, OutputArray _circles, double param1, double param2, int minRadius, int maxRadius ) { + CV_INSTRUMENT_REGION() + Ptr storage(cvCreateMemStorage(STORAGE_SIZE)); Mat image = _image.getMat(); CvMat c_image = image; diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index d103a4ab28..08424363f4 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -69,6 +69,8 @@ namespace cv template bool IPPSetSimple(cv::Scalar value, void *dataPointer, int step, IppiSize &size, ippiSetFunc func) { + CV_INSTRUMENT_REGION_IPP() + Type values[channels]; for( int i = 0; i < channels; i++ ) values[i] = saturate_cast(value[i]); @@ -77,16 +79,18 @@ namespace cv static bool IPPSet(const cv::Scalar &value, void *dataPointer, int step, IppiSize &size, int channels, int depth) { + CV_INSTRUMENT_REGION_IPP() + if( channels == 1 ) { switch( depth ) { case CV_8U: - return ippiSet_8u_C1R(saturate_cast(value[0]), (Ipp8u *)dataPointer, step, size) >= 0; + return CV_INSTRUMENT_FUN_IPP(ippiSet_8u_C1R,(saturate_cast(value[0]), (Ipp8u *)dataPointer, step, size)) >= 0; case CV_16U: - return ippiSet_16u_C1R(saturate_cast(value[0]), (Ipp16u *)dataPointer, step, size) >= 0; + return CV_INSTRUMENT_FUN_IPP(ippiSet_16u_C1R,(saturate_cast(value[0]), (Ipp16u *)dataPointer, step, size)) >= 0; case CV_32F: - return ippiSet_32f_C1R(saturate_cast(value[0]), (Ipp32f *)dataPointer, step, size) >= 0; + return CV_INSTRUMENT_FUN_IPP(ippiSet_32f_C1R,(saturate_cast(value[0]), (Ipp32f *)dataPointer, step, size)) >= 0; } } else @@ -2712,7 +2716,7 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec #define CHECK_IPP_STATUS(STATUS) if (STATUS < 0) { *ok = false; return; } #define SET_IPP_RESIZE_LINEAR_FUNC_PTR(TYPE, CN) \ - func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; \ + ippiResize = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; \ CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ specBuf.allocate(specSize);\ pSpec = (uchar*)specBuf;\ @@ -2720,7 +2724,7 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec #define SET_IPP_RESIZE_LINEAR_FUNC_64_PTR(TYPE, CN) \ if (mode == (int)ippCubic) { *ok = false; return; } \ - func = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; \ + ippiResize = (ippiResizeFunc)ippiResizeLinear_##TYPE##_##CN##R; \ CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ specBuf.allocate(specSize);\ pSpec = (uchar*)specBuf;\ @@ -2729,7 +2733,7 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec getSrcOffsetFunc = (ippiResizeGetSrcOffset) ippiResizeGetSrcOffset_##TYPE; #define SET_IPP_RESIZE_CUBIC_FUNC_PTR(TYPE, CN) \ - func = (ippiResizeFunc)ippiResizeCubic_##TYPE##_##CN##R; \ + ippiResize = (ippiResizeFunc)ippiResizeCubic_##TYPE##_##CN##R; \ CHECK_IPP_STATUS(ippiResizeGetSize_##TYPE(srcSize, dstSize, (IppiInterpolationType)mode, 0, &specSize, &initSize));\ specBuf.allocate(specSize);\ pSpec = (uchar*)specBuf;\ @@ -2752,7 +2756,7 @@ public: IPPresizeInvoker(const Mat & _src, Mat & _dst, double _inv_scale_x, double _inv_scale_y, int _mode, bool *_ok) : ParallelLoopBody(), src(_src), dst(_dst), inv_scale_x(_inv_scale_x), inv_scale_y(_inv_scale_y), pSpec(NULL), mode(_mode), - func(NULL), getBufferSizeFunc(NULL), getSrcOffsetFunc(NULL), ok(_ok) + ippiResize(NULL), getBufferSizeFunc(NULL), getSrcOffsetFunc(NULL), ok(_ok) { *ok = true; IppiSize srcSize, dstSize; @@ -2791,6 +2795,8 @@ public: virtual void operator() (const Range& range) const { + CV_INSTRUMENT_REGION_IPP() + if (*ok == false) return; @@ -2812,7 +2818,7 @@ public: AutoBuffer buf(bufsize + 64); uchar* bufptr = alignPtr((uchar*)buf, 32); - if( func( pSrc, (int)src.step[0], pDst, (int)dst.step[0], dstOffset, dstSize, ippBorderRepl, 0, pSpec, bufptr ) < 0 ) + if( CV_INSTRUMENT_FUN_IPP(ippiResize, pSrc, (int)src.step[0], pDst, (int)dst.step[0], dstOffset, dstSize, ippBorderRepl, 0, pSpec, bufptr) < 0 ) *ok = false; else { @@ -2827,7 +2833,7 @@ private: void *pSpec; AutoBuffer specBuf; int mode; - ippiResizeFunc func; + ippiResizeFunc ippiResize; ippiResizeGetBufferSize getBufferSizeFunc; ippiResizeGetSrcOffset getSrcOffsetFunc; bool *ok; @@ -3095,6 +3101,8 @@ static bool ocl_resize( InputArray _src, OutputArray _dst, Size dsize, static bool ipp_resize_mt(Mat & src, Mat & dst, double inv_scale_x, double inv_scale_y, int interpolation) { + CV_INSTRUMENT_REGION_IPP() + int mode = -1; if (interpolation == INTER_LINEAR && src.rows >= 2 && src.cols >= 2) mode = ippLinear; @@ -3123,6 +3131,8 @@ void resize(int src_type, uchar * dst_data, size_t dst_step, int dst_width, int dst_height, double inv_scale_x, double inv_scale_y, int interpolation) { + CV_INSTRUMENT_REGION() + CV_Assert((dst_width * dst_height > 0) || (inv_scale_x > 0 && inv_scale_y > 0)); if (inv_scale_x < DBL_EPSILON || inv_scale_y < DBL_EPSILON) { @@ -3475,6 +3485,8 @@ void resize(int src_type, void cv::resize( InputArray _src, OutputArray _dst, Size dsize, double inv_scale_x, double inv_scale_y, int interpolation ) { + CV_INSTRUMENT_REGION() + Size ssize = _src.size(); CV_Assert( ssize.width > 0 && ssize.height > 0 ); @@ -4760,6 +4772,8 @@ public: virtual void operator() (const Range & range) const { + CV_INSTRUMENT_REGION_IPP() + IppiRect srcRoiRect = { 0, 0, src.cols, src.rows }; Mat dstRoi = dst.rowRange(range); IppiSize dstRoiSize = ippiSize(dstRoi.size()); @@ -4772,9 +4786,9 @@ public: return; } - if (ippFunc(src.ptr(), ippiSize(src.size()), (int)src.step, srcRoiRect, + if (CV_INSTRUMENT_FUN_PTR_CALL_IPP(ippFunc,(src.ptr(), ippiSize(src.size()), (int)src.step, srcRoiRect, map1.ptr(), (int)map1.step, map2.ptr(), (int)map2.step, - dstRoi.ptr(), (int)dstRoi.step, dstRoiSize, ippInterpolation) < 0) + dstRoi.ptr(), (int)dstRoi.step, dstRoiSize, ippInterpolation)) < 0) *ok = false; else { @@ -4798,6 +4812,8 @@ void cv::remap( InputArray _src, OutputArray _dst, InputArray _map1, InputArray _map2, int interpolation, int borderType, const Scalar& borderValue ) { + CV_INSTRUMENT_REGION() + static RemapNNFunc nn_tab[] = { remapNearest, remapNearest, remapNearest, remapNearest, @@ -4940,6 +4956,8 @@ void cv::convertMaps( InputArray _map1, InputArray _map2, OutputArray _dstmap1, OutputArray _dstmap2, int dstm1type, bool nninterpolate ) { + CV_INSTRUMENT_REGION() + Mat map1 = _map1.getMat(), map2 = _map2.getMat(), dstmap1, dstmap2; Size size = map1.size(); const Mat *m1 = &map1, *m2 = &map2; @@ -5589,6 +5607,8 @@ public: virtual void operator() (const Range& range) const { + CV_INSTRUMENT_REGION_IPP() + IppiSize srcsize = { src.cols, src.rows }; IppiRect srcroi = { 0, 0, src.cols, src.rows }; IppiRect dstroi = { 0, range.start, dst.cols, range.end - range.start }; @@ -5605,8 +5625,8 @@ public: } // Aug 2013: problem in IPP 7.1, 8.0 : sometimes function return ippStsCoeffErr - IppStatus status = func( src.ptr(), srcsize, (int)src.step[0], srcroi, dst.ptr(), - (int)dst.step[0], dstroi, coeffs, mode ); + IppStatus status = CV_INSTRUMENT_FUN_PTR_CALL_IPP(func,( src.ptr(), srcsize, (int)src.step[0], srcroi, dst.ptr(), + (int)dst.step[0], dstroi, coeffs, mode )); if( status < 0) *ok = false; else @@ -5768,6 +5788,8 @@ void cv::warpAffine( InputArray _src, OutputArray _dst, InputArray _M0, Size dsize, int flags, int borderType, const Scalar& borderValue ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(), ocl_warpTransform(_src, _dst, _M0, dsize, flags, borderType, borderValue, OCL_OP_AFFINE)) @@ -6230,6 +6252,8 @@ public: virtual void operator() (const Range& range) const { + CV_INSTRUMENT_REGION_IPP() + IppiSize srcsize = {src.cols, src.rows}; IppiRect srcroi = {0, 0, src.cols, src.rows}; IppiRect dstroi = {0, range.start, dst.cols, range.end - range.start}; @@ -6246,7 +6270,7 @@ public: } } - IppStatus status = func(src.ptr(), srcsize, (int)src.step[0], srcroi, dst.ptr(), (int)dst.step[0], dstroi, coeffs, mode); + IppStatus status = CV_INSTRUMENT_FUN_PTR_CALL_IPP(func,(src.ptr(), srcsize, (int)src.step[0], srcroi, dst.ptr(), (int)dst.step[0], dstroi, coeffs, mode)); if (status != ippStsNoErr) *ok = false; else @@ -6290,6 +6314,8 @@ void warpPerspectve(int src_type, void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0, Size dsize, int flags, int borderType, const Scalar& borderValue ) { + CV_INSTRUMENT_REGION() + CV_Assert( _src.total() > 0 ); CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(), @@ -6381,6 +6407,8 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0, cv::Mat cv::getRotationMatrix2D( Point2f center, double angle, double scale ) { + CV_INSTRUMENT_REGION() + angle *= CV_PI/180; double alpha = cos(angle)*scale; double beta = sin(angle)*scale; @@ -6424,6 +6452,8 @@ cv::Mat cv::getRotationMatrix2D( Point2f center, double angle, double scale ) */ cv::Mat cv::getPerspectiveTransform( const Point2f src[], const Point2f dst[] ) { + CV_INSTRUMENT_REGION() + Mat M(3, 3, CV_64F), X(8, 1, CV_64F, M.ptr()); double a[8][8], b[8]; Mat A(8, 8, CV_64F, a), B(8, 1, CV_64F, b); @@ -6778,6 +6808,8 @@ cvLogPolar( const CvArr* srcarr, CvArr* dstarr, void cv::logPolar( InputArray _src, OutputArray _dst, Point2f center, double M, int flags ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_src.isUMat() && _dst.isUMat(), ocl_logPolar(_src, _dst, center, M, flags)); Mat src_with_border; // don't scope this variable (it holds image data) @@ -6987,6 +7019,8 @@ void cvLinearPolar( const CvArr* srcarr, CvArr* dstarr, void cv::linearPolar( InputArray _src, OutputArray _dst, Point2f center, double maxRadius, int flags ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_src.isUMat() && _dst.isUMat(), ocl_linearPolar(_src, _dst, center, maxRadius, flags)); Mat src_with_border; // don't scope this variable (it holds image data) diff --git a/modules/imgproc/src/intersection.cpp b/modules/imgproc/src/intersection.cpp index dfebd260e7..5da743a0f9 100644 --- a/modules/imgproc/src/intersection.cpp +++ b/modules/imgproc/src/intersection.cpp @@ -49,6 +49,8 @@ namespace cv int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion ) { + CV_INSTRUMENT_REGION() + const float samePointEps = 0.00001f; // used to test if two points are the same Point2f vec1[4], vec2[4]; diff --git a/modules/imgproc/src/linefit.cpp b/modules/imgproc/src/linefit.cpp index dc71d888ae..c073e26cb0 100644 --- a/modules/imgproc/src/linefit.cpp +++ b/modules/imgproc/src/linefit.cpp @@ -594,6 +594,8 @@ static void fitLine3D( Point3f * points, int count, int dist, void cv::fitLine( InputArray _points, OutputArray _line, int distType, double param, double reps, double aeps ) { + CV_INSTRUMENT_REGION() + Mat points = _points.getMat(); float linebuf[6]={0.f}; diff --git a/modules/imgproc/src/lsd.cpp b/modules/imgproc/src/lsd.cpp index cda073a61e..8791f0aad8 100644 --- a/modules/imgproc/src/lsd.cpp +++ b/modules/imgproc/src/lsd.cpp @@ -412,6 +412,8 @@ LineSegmentDetectorImpl::LineSegmentDetectorImpl(int _refine, double _scale, dou void LineSegmentDetectorImpl::detect(InputArray _image, OutputArray _lines, OutputArray _width, OutputArray _prec, OutputArray _nfa) { + CV_INSTRUMENT_REGION() + Mat_ img = _image.getMat(); CV_Assert(!img.empty() && img.channels() == 1); @@ -1154,6 +1156,8 @@ inline bool LineSegmentDetectorImpl::isAligned(const int& address, const double& void LineSegmentDetectorImpl::drawSegments(InputOutputArray _image, InputArray lines) { + CV_INSTRUMENT_REGION() + CV_Assert(!_image.empty() && (_image.channels() == 1 || _image.channels() == 3)); Mat gray; @@ -1191,6 +1195,8 @@ void LineSegmentDetectorImpl::drawSegments(InputOutputArray _image, InputArray l int LineSegmentDetectorImpl::compareSegments(const Size& size, InputArray lines1, InputArray lines2, InputOutputArray _image) { + CV_INSTRUMENT_REGION() + Size sz = size; if (_image.needed() && _image.size() != size) sz = _image.size(); CV_Assert(sz.area()); diff --git a/modules/imgproc/src/matchcontours.cpp b/modules/imgproc/src/matchcontours.cpp index 1ac6c16627..1a371677bf 100644 --- a/modules/imgproc/src/matchcontours.cpp +++ b/modules/imgproc/src/matchcontours.cpp @@ -43,6 +43,8 @@ double cv::matchShapes(InputArray contour1, InputArray contour2, int method, double) { + CV_INSTRUMENT_REGION() + double ma[7], mb[7]; int i, sma, smb; double eps = 1.e-5; diff --git a/modules/imgproc/src/moments.cpp b/modules/imgproc/src/moments.cpp index fd91f59cf1..d445ed270d 100644 --- a/modules/imgproc/src/moments.cpp +++ b/modules/imgproc/src/moments.cpp @@ -566,6 +566,8 @@ static bool ocl_moments( InputArray _src, Moments& m, bool binary) cv::Moments cv::moments( InputArray _src, bool binary ) { + CV_INSTRUMENT_REGION() + const int TILE_SIZE = 32; MomentsInTileFunc func = 0; uchar nzbuf[TILE_SIZE*TILE_SIZE]; @@ -609,7 +611,7 @@ cv::Moments cv::moments( InputArray _src, bool binary ) if (ippFunc) { - if (ippFunc(mat.data, (int)mat.step, roi, moment) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippFunc,(mat.data, (int)mat.step, roi, moment)) >= 0) { IppiPoint point = { 0, 0 }; ippiGetSpatialMoment_64f(moment, 0, 0, 0, point, &m.m00); @@ -740,6 +742,8 @@ cv::Moments cv::moments( InputArray _src, bool binary ) void cv::HuMoments( const Moments& m, double hu[7] ) { + CV_INSTRUMENT_REGION() + double t0 = m.nu30 + m.nu12; double t1 = m.nu21 + m.nu03; @@ -767,6 +771,8 @@ void cv::HuMoments( const Moments& m, double hu[7] ) void cv::HuMoments( const Moments& m, OutputArray _hu ) { + CV_INSTRUMENT_REGION() + _hu.create(7, 1, CV_64F); Mat hu = _hu.getMat(); CV_Assert( hu.isContinuous() ); diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 3b799803c3..a0103b3143 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -1145,10 +1145,10 @@ struct IppMorphTrait\ IppStatus morphInit(IppiSize roiSize, const Ipp8u* pMask, IppiSize maskSize, IppiMorphState* pMorphSpec, Ipp8u* pBuffer) {return ippiMorphologyBorderInit_##flavor(roiSize, pMask, maskSize, pMorphSpec, pBuffer);}\ IppStatus filterGetMinSize(IppiSize dstRoiSize, IppiSize maskSize, IppDataType dataType, int numChannels, int* pBufferSize) {return ippiFilterMinBorderGetBufferSize(dstRoiSize, maskSize, dataType, numChannels, pBufferSize);}\ IppStatus filterGetMaxSize(IppiSize dstRoiSize, IppiSize maskSize, IppDataType dataType, int numChannels, int* pBufferSize) {return ippiFilterMaxBorderGetBufferSize(dstRoiSize, maskSize, dataType, numChannels, pBufferSize);}\ - IppStatus filterMinBorder(const ipp_data_type* pSrc, int srcStep, ipp_data_type* pDst, int dstStep, IppiSize dstRoiSize, IppiSize maskSize, IppiPoint, Ipp8u* pBuffer) { ipp_data_type zerodef; return ippiFilterMinBorder_##flavor(pSrc, srcStep, pDst, dstStep, dstRoiSize, maskSize, ippBorderRepl, zero, pBuffer); }\ - IppStatus filterMaxBorder(const ipp_data_type* pSrc, int srcStep, ipp_data_type* pDst, int dstStep, IppiSize dstRoiSize, IppiSize maskSize, IppiPoint, Ipp8u* pBuffer) { ipp_data_type zerodef; return ippiFilterMaxBorder_##flavor(pSrc, srcStep, pDst, dstStep, dstRoiSize, maskSize, ippBorderRepl, zero, pBuffer); }\ - IppStatus morphDilate(const ipp_data_type* pSrc, int srcStep, ipp_data_type* pDst, int dstStep, IppiSize roiSize, const IppiMorphState* pMorphSpec, Ipp8u* pBuffer) { ipp_data_type zerodef; return ippiDilateBorder_##flavor(pSrc, srcStep, pDst, dstStep, roiSize, ippBorderRepl, zero, pMorphSpec, pBuffer); }\ - IppStatus morphErode(const ipp_data_type* pSrc, int srcStep, ipp_data_type* pDst, int dstStep, IppiSize roiSize, const IppiMorphState* pMorphSpec, Ipp8u* pBuffer) { ipp_data_type zerodef; return ippiErodeBorder_##flavor(pSrc, srcStep, pDst, dstStep, roiSize, ippBorderRepl, zero, pMorphSpec, pBuffer); }\ + IppStatus filterMinBorder(const ipp_data_type* pSrc, int srcStep, ipp_data_type* pDst, int dstStep, IppiSize dstRoiSize, IppiSize maskSize, IppiPoint, Ipp8u* pBuffer) { ipp_data_type zerodef; return CV_INSTRUMENT_FUN_IPP(ippiFilterMinBorder_##flavor, pSrc, srcStep, pDst, dstStep, dstRoiSize, maskSize, ippBorderRepl, zero, pBuffer); }\ + IppStatus filterMaxBorder(const ipp_data_type* pSrc, int srcStep, ipp_data_type* pDst, int dstStep, IppiSize dstRoiSize, IppiSize maskSize, IppiPoint, Ipp8u* pBuffer) { ipp_data_type zerodef; return CV_INSTRUMENT_FUN_IPP(ippiFilterMaxBorder_##flavor, pSrc, srcStep, pDst, dstStep, dstRoiSize, maskSize, ippBorderRepl, zero, pBuffer); }\ + IppStatus morphDilate(const ipp_data_type* pSrc, int srcStep, ipp_data_type* pDst, int dstStep, IppiSize roiSize, const IppiMorphState* pMorphSpec, Ipp8u* pBuffer) { ipp_data_type zerodef; return CV_INSTRUMENT_FUN_IPP(ippiDilateBorder_##flavor, pSrc, srcStep, pDst, dstStep, roiSize, ippBorderRepl, zero, pMorphSpec, pBuffer); }\ + IppStatus morphErode(const ipp_data_type* pSrc, int srcStep, ipp_data_type* pDst, int dstStep, IppiSize roiSize, const IppiMorphState* pMorphSpec, Ipp8u* pBuffer) { ipp_data_type zerodef; return CV_INSTRUMENT_FUN_IPP(ippiErodeBorder_##flavor, pSrc, srcStep, pDst, dstStep, roiSize, ippBorderRepl, zero, pMorphSpec, pBuffer); }\ }; #else @@ -1333,6 +1333,8 @@ struct IppMorphImpl : public IppMorphBaseImpl int roi_width, int roi_height, int roi_x, int roi_y, int roi_width2, int roi_height2, int roi_x2, int roi_y2) { + CV_INSTRUMENT_REGION_IPP() + CV_UNUSED(roi_width); CV_UNUSED(roi_height); CV_UNUSED(roi_x); CV_UNUSED(roi_y); CV_UNUSED(roi_width2); CV_UNUSED(roi_height2); CV_UNUSED(roi_x2); CV_UNUSED(roi_y2); if (src_data == dst_data) @@ -1873,6 +1875,8 @@ void cv::erode( InputArray src, OutputArray dst, InputArray kernel, Point anchor, int iterations, int borderType, const Scalar& borderValue ) { + CV_INSTRUMENT_REGION() + morphOp( MORPH_ERODE, src, dst, kernel, anchor, iterations, borderType, borderValue ); } @@ -1881,6 +1885,8 @@ void cv::dilate( InputArray src, OutputArray dst, InputArray kernel, Point anchor, int iterations, int borderType, const Scalar& borderValue ) { + CV_INSTRUMENT_REGION() + morphOp( MORPH_DILATE, src, dst, kernel, anchor, iterations, borderType, borderValue ); } @@ -1952,6 +1958,8 @@ void cv::morphologyEx( InputArray _src, OutputArray _dst, int op, InputArray _kernel, Point anchor, int iterations, int borderType, const Scalar& borderValue ) { + CV_INSTRUMENT_REGION() + Mat kernel = _kernel.getMat(); if (kernel.empty()) { diff --git a/modules/imgproc/src/phasecorr.cpp b/modules/imgproc/src/phasecorr.cpp index e6416ead59..1770f7aab8 100644 --- a/modules/imgproc/src/phasecorr.cpp +++ b/modules/imgproc/src/phasecorr.cpp @@ -490,6 +490,8 @@ static Point2d weightedCentroid(InputArray _src, cv::Point peakLocation, cv::Siz cv::Point2d cv::phaseCorrelate(InputArray _src1, InputArray _src2, InputArray _window, double* response) { + CV_INSTRUMENT_REGION() + Mat src1 = _src1.getMat(); Mat src2 = _src2.getMat(); Mat window = _window.getMat(); @@ -571,6 +573,8 @@ cv::Point2d cv::phaseCorrelate(InputArray _src1, InputArray _src2, InputArray _w void cv::createHanningWindow(OutputArray _dst, cv::Size winSize, int type) { + CV_INSTRUMENT_REGION() + CV_Assert( type == CV_32FC1 || type == CV_64FC1 ); _dst.create(winSize, type); diff --git a/modules/imgproc/src/pyramids.cpp b/modules/imgproc/src/pyramids.cpp index f7ff60d532..7d1cb67b05 100644 --- a/modules/imgproc/src/pyramids.cpp +++ b/modules/imgproc/src/pyramids.cpp @@ -1187,6 +1187,8 @@ namespace cv { static bool ipp_pyrdown( InputArray _src, OutputArray _dst, const Size& _dsz, int borderType ) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 810 && IPP_DISABLE_BLOCK Size dsz = _dsz.area() == 0 ? Size((_src.cols() + 1)/2, (_src.rows() + 1)/2) : _dsz; bool isolated = (borderType & BORDER_ISOLATED) != 0; @@ -1245,6 +1247,8 @@ static bool ipp_pyrdown( InputArray _src, OutputArray _dst, const Size& _dsz, in void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borderType ) { + CV_INSTRUMENT_REGION() + CV_Assert(borderType != BORDER_CONSTANT); CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(), @@ -1292,6 +1296,8 @@ namespace cv { static bool ipp_pyrup( InputArray _src, OutputArray _dst, const Size& _dsz, int borderType ) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 810 && IPP_DISABLE_BLOCK Size sz = _src.dims() <= 2 ? _src.size() : Size(); Size dsz = _dsz.area() == 0 ? Size(_src.cols()*2, _src.rows()*2) : _dsz; @@ -1348,6 +1354,8 @@ static bool ipp_pyrup( InputArray _src, OutputArray _dst, const Size& _dsz, int void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderType ) { + CV_INSTRUMENT_REGION() + CV_Assert(borderType == BORDER_DEFAULT); CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(), @@ -1396,6 +1404,8 @@ namespace cv { static bool ipp_buildpyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel, int borderType ) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 810 && IPP_DISABLE_BLOCK Mat src = _src.getMat(); _dst.create( maxlevel + 1, 1, 0 ); @@ -1506,6 +1516,8 @@ static bool ipp_buildpyramid( InputArray _src, OutputArrayOfArrays _dst, int max void cv::buildPyramid( InputArray _src, OutputArrayOfArrays _dst, int maxlevel, int borderType ) { + CV_INSTRUMENT_REGION() + CV_Assert(borderType != BORDER_CONSTANT); if (_src.dims() <= 2 && _dst.isUMatVector()) diff --git a/modules/imgproc/src/rotcalipers.cpp b/modules/imgproc/src/rotcalipers.cpp index c80636bdc6..d19addd0d7 100644 --- a/modules/imgproc/src/rotcalipers.cpp +++ b/modules/imgproc/src/rotcalipers.cpp @@ -346,6 +346,8 @@ static void rotatingCalipers( const Point2f* points, int n, int mode, float* out cv::RotatedRect cv::minAreaRect( InputArray _points ) { + CV_INSTRUMENT_REGION() + Mat hull; Point2f out[3]; RotatedRect box; @@ -404,6 +406,8 @@ cvMinAreaRect2( const CvArr* array, CvMemStorage* /*storage*/ ) void cv::boxPoints(cv::RotatedRect box, OutputArray _pts) { + CV_INSTRUMENT_REGION() + _pts.create(4, 2, CV_32F); Mat pts = _pts.getMat(); box.points(pts.ptr()); diff --git a/modules/imgproc/src/samplers.cpp b/modules/imgproc/src/samplers.cpp index c89bd32e0b..df9a2ef1de 100644 --- a/modules/imgproc/src/samplers.cpp +++ b/modules/imgproc/src/samplers.cpp @@ -365,6 +365,8 @@ getQuadrangleSubPix_8u32f_CnR( const uchar* src, size_t src_step, Size src_size, void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center, OutputArray _patch, int patchType ) { + CV_INSTRUMENT_REGION() + Mat image = _image.getMat(); int depth = image.depth(), cn = image.channels(); int ddepth = patchType < 0 ? depth : CV_MAT_DEPTH(patchType); @@ -387,15 +389,15 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center, IppiPoint_32f icenter = {center.x, center.y}; IppiSize src_size={image.cols, image.rows}, win_size={patch.cols, patch.rows}; int srctype = image.type(); - ippiGetRectSubPixFunc ippfunc = + ippiGetRectSubPixFunc ippiCopySubpixIntersect = srctype == CV_8UC1 && ddepth == CV_8U ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u_C1R : srctype == CV_8UC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u32f_C1R : srctype == CV_32FC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_32f_C1R : 0; - if( ippfunc) + if( ippiCopySubpixIntersect) { - if (ippfunc(image.ptr(), (int)image.step, src_size, patch.ptr(), - (int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 ) + if (CV_INSTRUMENT_FUN_IPP(ippiCopySubpixIntersect, image.ptr(), (int)image.step, src_size, patch.ptr(), + (int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; diff --git a/modules/imgproc/src/segmentation.cpp b/modules/imgproc/src/segmentation.cpp index 124aecdb2e..b803770f12 100644 --- a/modules/imgproc/src/segmentation.cpp +++ b/modules/imgproc/src/segmentation.cpp @@ -87,6 +87,8 @@ allocWSNodes( std::vector& storage ) void cv::watershed( InputArray _src, InputOutputArray _markers ) { + CV_INSTRUMENT_REGION() + // Labels for pixels const int IN_QUEUE = -2; // Pixel visited const int WSHED = -1; // Pixel belongs to watershed @@ -332,6 +334,8 @@ void cv::pyrMeanShiftFiltering( InputArray _src, OutputArray _dst, double sp0, double sr, int max_level, TermCriteria termcrit ) { + CV_INSTRUMENT_REGION() + Mat src0 = _src.getMat(); if( src0.empty() ) diff --git a/modules/imgproc/src/shapedescr.cpp b/modules/imgproc/src/shapedescr.cpp index 294f4fa492..56186bb404 100644 --- a/modules/imgproc/src/shapedescr.cpp +++ b/modules/imgproc/src/shapedescr.cpp @@ -206,6 +206,8 @@ static void findMinEnclosingCircle(const PT *pts, int count, Point2f ¢er, fl // see Welzl, Emo. Smallest enclosing disks (balls and ellipsoids). Springer Berlin Heidelberg, 1991. void cv::minEnclosingCircle( InputArray _points, Point2f& _center, float& _radius ) { + CV_INSTRUMENT_REGION() + Mat points = _points.getMat(); int count = points.checkVector(2); int depth = points.depth(); @@ -275,6 +277,8 @@ void cv::minEnclosingCircle( InputArray _points, Point2f& _center, float& _radiu // calculates length of a curve (e.g. contour perimeter) double cv::arcLength( InputArray _curve, bool is_closed ) { + CV_INSTRUMENT_REGION() + Mat curve = _curve.getMat(); int count = curve.checkVector(2); int depth = curve.depth(); @@ -308,6 +312,8 @@ double cv::arcLength( InputArray _curve, bool is_closed ) // area of a whole sequence double cv::contourArea( InputArray _contour, bool oriented ) { + CV_INSTRUMENT_REGION() + Mat contour = _contour.getMat(); int npoints = contour.checkVector(2); int depth = contour.depth(); @@ -339,6 +345,8 @@ double cv::contourArea( InputArray _contour, bool oriented ) cv::RotatedRect cv::fitEllipse( InputArray _points ) { + CV_INSTRUMENT_REGION() + Mat points = _points.getMat(); int i, n = points.checkVector(2); int depth = points.depth(); @@ -668,6 +676,8 @@ static Rect maskBoundingRect( const Mat& img ) cv::Rect cv::boundingRect(InputArray array) { + CV_INSTRUMENT_REGION() + Mat m = array.getMat(); return m.depth() <= CV_8U ? maskBoundingRect(m) : pointSetBoundingRect(m); } diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index 034a2c0923..8639f0d243 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -1367,6 +1367,8 @@ static bool ipp_boxfilter( InputArray _src, OutputArray _dst, int ddepth, Size ksize, Point anchor, bool normalize, int borderType ) { + CV_INSTRUMENT_REGION_IPP() + int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype); if( ddepth < 0 ) ddepth = sdepth; @@ -1405,7 +1407,7 @@ static bool ipp_boxfilter( InputArray _src, OutputArray _dst, int ddepth, Ipp8u * buffer = ippsMalloc_8u(bufSize); \ ippType borderValue[4] = { 0, 0, 0, 0 }; \ ippBorderType = ippBorderType == BORDER_CONSTANT ? ippBorderConst : ippBorderRepl; \ - IppStatus status = ippiFilterBoxBorder_##flavor(src.ptr(), (int)src.step, dst.ptr(), \ + IppStatus status = CV_INSTRUMENT_FUN_IPP(ippiFilterBoxBorder_##flavor, src.ptr(), (int)src.step, dst.ptr(), \ (int)dst.step, roiSize, maskSize, \ (IppiBorderType)ippBorderType, borderValue, buffer); \ ippsFree(buffer); \ @@ -1459,6 +1461,8 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth, Size ksize, Point anchor, bool normalize, int borderType ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_dst.isUMat(), ocl_boxFilter(_src, _dst, ddepth, ksize, anchor, borderType, normalize)) Mat src = _src.getMat(); @@ -1507,6 +1511,8 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth, void cv::blur( InputArray src, OutputArray dst, Size ksize, Point anchor, int borderType ) { + CV_INSTRUMENT_REGION() + boxFilter( src, dst, -1, ksize, anchor, true, borderType ); } @@ -1589,6 +1595,8 @@ void cv::sqrBoxFilter( InputArray _src, OutputArray _dst, int ddepth, Size ksize, Point anchor, bool normalize, int borderType ) { + CV_INSTRUMENT_REGION() + int srcType = _src.type(), sdepth = CV_MAT_DEPTH(srcType), cn = CV_MAT_CN(srcType); Size size = _src.size(); @@ -1733,6 +1741,8 @@ static bool ipp_GaussianBlur( InputArray _src, OutputArray _dst, Size ksize, double sigma1, double sigma2, int borderType ) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 810 if ((borderType & BORDER_ISOLATED) == 0 && _src.isSubmatrix()) return false; @@ -1771,14 +1781,14 @@ static bool ipp_GaussianBlur( InputArray _src, OutputArray _dst, Size ksize, #define IPP_FILTER_GAUSS_C1(ippfavor) \ { \ Ipp##ippfavor borderValues = 0; \ - status = ippiFilterGaussianBorder_##ippfavor##_C1R(src.ptr(), (int)src.step, \ + status = CV_INSTRUMENT_FUN_IPP(ippiFilterGaussianBorder_##ippfavor##_C1R, src.ptr(), (int)src.step, \ dst.ptr(), (int)dst.step, roiSize, borderValues, spec, buffer); \ } #define IPP_FILTER_GAUSS_CN(ippfavor, ippcn) \ { \ Ipp##ippfavor borderValues[] = { 0, 0, 0 }; \ - status = ippiFilterGaussianBorder_##ippfavor##_C##ippcn##R(src.ptr(), (int)src.step, \ + status = CV_INSTRUMENT_FUN_IPP(ippiFilterGaussianBorder_##ippfavor##_C##ippcn##R, src.ptr(), (int)src.step, \ dst.ptr(), (int)dst.step, roiSize, borderValues, spec, buffer); \ } @@ -1825,6 +1835,8 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize, double sigma1, double sigma2, int borderType ) { + CV_INSTRUMENT_REGION() + int type = _src.type(); Size size = _src.size(); _dst.create( size, type ); @@ -2768,6 +2780,8 @@ namespace cv { static bool ipp_medianFilter( InputArray _src0, OutputArray _dst, int ksize ) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 810 Mat src0 = _src0.getMat(); _dst.create( src0.size(), src0.type() ); @@ -2780,7 +2794,7 @@ static bool ipp_medianFilter( InputArray _src0, OutputArray _dst, int ksize ) ippDataType, CV_MAT_CN(type), &bufSize) >= 0) \ { \ Ipp8u * buffer = ippsMalloc_8u(bufSize); \ - IppStatus status = ippiFilterMedianBorder_##flavor(src.ptr(), (int)src.step, \ + IppStatus status = CV_INSTRUMENT_FUN_IPP(ippiFilterMedianBorder_##flavor, src.ptr(), (int)src.step, \ dst.ptr(), (int)dst.step, dstRoiSize, maskSize, \ ippBorderRepl, (ippType)0, buffer); \ ippsFree(buffer); \ @@ -2824,6 +2838,8 @@ static bool ipp_medianFilter( InputArray _src0, OutputArray _dst, int ksize ) void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) { + CV_INSTRUMENT_REGION() + CV_Assert( (ksize % 2 == 1) && (_src0.dims() <= 2 )); if( ksize <= 1 ) @@ -3070,6 +3086,8 @@ public: virtual void operator() (const Range& range) const { + CV_INSTRUMENT_REGION_IPP() + int d = radius * 2 + 1; IppiSize kernel = {d, d}; IppiSize roi={dst.cols, range.end - range.start}; @@ -3665,6 +3683,8 @@ void cv::bilateralFilter( InputArray _src, OutputArray _dst, int d, double sigmaColor, double sigmaSpace, int borderType ) { + CV_INSTRUMENT_REGION() + _dst.create( _src.size(), _src.type() ); CV_OCL_RUN(_src.dims() <= 2 && _dst.isUMat(), diff --git a/modules/imgproc/src/spatialgradient.cpp b/modules/imgproc/src/spatialgradient.cpp index 411c29947f..ecf52f9ce1 100644 --- a/modules/imgproc/src/spatialgradient.cpp +++ b/modules/imgproc/src/spatialgradient.cpp @@ -78,6 +78,7 @@ static inline void spatialGradientKernel( T& vx, T& vy, void spatialGradient( InputArray _src, OutputArray _dx, OutputArray _dy, int ksize, int borderType ) { + CV_INSTRUMENT_REGION() // Prepare InputArray src Mat src = _src.getMat(); diff --git a/modules/imgproc/src/subdivision2d.cpp b/modules/imgproc/src/subdivision2d.cpp index d849d2aa10..5917dbd51f 100644 --- a/modules/imgproc/src/subdivision2d.cpp +++ b/modules/imgproc/src/subdivision2d.cpp @@ -275,6 +275,8 @@ void Subdiv2D::deletePoint(int vidx) int Subdiv2D::locate(Point2f pt, int& _edge, int& _vertex) { + CV_INSTRUMENT_REGION() + int vertex = 0; int i, maxEdges = (int)(qedges.size() * 4); @@ -409,6 +411,8 @@ isPtInCircle3( Point2f pt, Point2f a, Point2f b, Point2f c) int Subdiv2D::insert(Point2f pt) { + CV_INSTRUMENT_REGION() + int curr_point = 0, curr_edge = 0, deleted_edge = 0; int location = locate( pt, curr_edge, curr_point ); @@ -479,12 +483,16 @@ int Subdiv2D::insert(Point2f pt) void Subdiv2D::insert(const std::vector& ptvec) { + CV_INSTRUMENT_REGION() + for( size_t i = 0; i < ptvec.size(); i++ ) insert(ptvec[i]); } void Subdiv2D::initDelaunay( Rect rect ) { + CV_INSTRUMENT_REGION() + float big_coord = 3.f * MAX( rect.width, rect.height ); float rx = (float)rect.x; float ry = (float)rect.y; @@ -644,6 +652,8 @@ isRightOf2( const Point2f& pt, const Point2f& org, const Point2f& diff ) int Subdiv2D::findNearest(Point2f pt, Point2f* nearestPt) { + CV_INSTRUMENT_REGION() + if( !validGeometry ) calcVoronoi(); diff --git a/modules/imgproc/src/sumpixels.cpp b/modules/imgproc/src/sumpixels.cpp index 348ac18ecf..d998a7ab05 100755 --- a/modules/imgproc/src/sumpixels.cpp +++ b/modules/imgproc/src/sumpixels.cpp @@ -425,6 +425,8 @@ namespace cv { static bool ipp_integral(InputArray _src, OutputArray _sum, OutputArray _sqsum, OutputArray _tilted, int sdepth, int sqdepth) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 != 900 // Disabled on ICV due invalid results int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); if( sdepth <= 0 ) @@ -452,22 +454,22 @@ static bool ipp_integral(InputArray _src, OutputArray _sum, OutputArray _sqsum, { if( _sqsum.needed() ) { - status = ippiSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); + status = CV_INSTRUMENT_FUN_IPP(ippiSqrIntegral_8u32f64f_C1R, (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0); } else { - status = ippiIntegral_8u32f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, srcRoiSize, 0 ); + status = CV_INSTRUMENT_FUN_IPP(ippiIntegral_8u32f_C1R, (const Ipp8u*)src.data, (int)src.step, (Ipp32f*)sum.data, (int)sum.step, srcRoiSize, 0); } } else if( sdepth == CV_32S ) { if( _sqsum.needed() ) { - status = ippiSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0 ); + status = CV_INSTRUMENT_FUN_IPP(ippiSqrIntegral_8u32s64f_C1R, (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, (Ipp64f*)sqsum.data, (int)sqsum.step, srcRoiSize, 0, 0); } else { - status = ippiIntegral_8u32s_C1R( (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, srcRoiSize, 0 ); + status = CV_INSTRUMENT_FUN_IPP(ippiIntegral_8u32s_C1R, (const Ipp8u*)src.data, (int)src.step, (Ipp32s*)sum.data, (int)sum.step, srcRoiSize, 0); } } if (0 <= status) @@ -486,6 +488,8 @@ static bool ipp_integral(InputArray _src, OutputArray _sum, OutputArray _sqsum, void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, OutputArray _tilted, int sdepth, int sqdepth ) { + CV_INSTRUMENT_REGION() + int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); if( sdepth <= 0 ) sdepth = depth == CV_8U ? CV_32S : CV_64F; @@ -559,11 +563,15 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output void cv::integral( InputArray src, OutputArray sum, int sdepth ) { + CV_INSTRUMENT_REGION() + integral( src, sum, noArray(), noArray(), sdepth ); } void cv::integral( InputArray src, OutputArray sum, OutputArray sqsum, int sdepth, int sqdepth ) { + CV_INSTRUMENT_REGION() + integral( src, sum, sqsum, noArray(), sdepth, sqdepth ); } diff --git a/modules/imgproc/src/templmatch.cpp b/modules/imgproc/src/templmatch.cpp index 019c41f33b..5bae692dc7 100644 --- a/modules/imgproc/src/templmatch.cpp +++ b/modules/imgproc/src/templmatch.cpp @@ -566,6 +566,8 @@ typedef IppStatus (CV_STDCALL * ippimatchTemplate)(const void*, int, IppiSize, c static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst) { + CV_INSTRUMENT_REGION_IPP() + IppStatus status; IppiSize srcRoiSize = {src.cols,src.rows}; @@ -576,11 +578,11 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst) int depth = src.depth(); - ippimatchTemplate ippFunc = + ippimatchTemplate ippiCrossCorrNorm = depth==CV_8U ? (ippimatchTemplate)ippiCrossCorrNorm_8u32f_C1R: depth==CV_32F? (ippimatchTemplate)ippiCrossCorrNorm_32f_C1R: 0; - if (ippFunc==0) + if (ippiCrossCorrNorm==0) return false; IppEnum funCfg = (IppEnum)(ippAlgAuto | ippiNormNone | ippiROIValid); @@ -591,7 +593,7 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst) pBuffer = ippsMalloc_8u( bufSize ); - status = ippFunc(src.ptr(), (int)src.step, srcRoiSize, tpl.ptr(), (int)tpl.step, tplRoiSize, dst.ptr(), (int)dst.step, funCfg, pBuffer); + status = CV_INSTRUMENT_FUN_IPP(ippiCrossCorrNorm, src.ptr(), (int)src.step, srcRoiSize, tpl.ptr(), (int)tpl.step, tplRoiSize, dst.ptr(), (int)dst.step, funCfg, pBuffer); ippsFree( pBuffer ); return status >= 0; @@ -599,6 +601,8 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst) static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst) { + CV_INSTRUMENT_REGION_IPP() + IppStatus status; IppiSize srcRoiSize = {src.cols,src.rows}; @@ -609,11 +613,11 @@ static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst) int depth = src.depth(); - ippimatchTemplate ippFunc = + ippimatchTemplate ippiSqrDistanceNorm = depth==CV_8U ? (ippimatchTemplate)ippiSqrDistanceNorm_8u32f_C1R: depth==CV_32F? (ippimatchTemplate)ippiSqrDistanceNorm_32f_C1R: 0; - if (ippFunc==0) + if (ippiSqrDistanceNorm==0) return false; IppEnum funCfg = (IppEnum)(ippAlgAuto | ippiNormNone | ippiROIValid); @@ -624,7 +628,7 @@ static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst) pBuffer = ippsMalloc_8u( bufSize ); - status = ippFunc(src.ptr(), (int)src.step, srcRoiSize, tpl.ptr(), (int)tpl.step, tplRoiSize, dst.ptr(), (int)dst.step, funCfg, pBuffer); + status = CV_INSTRUMENT_FUN_IPP(ippiSqrDistanceNorm, src.ptr(), (int)src.step, srcRoiSize, tpl.ptr(), (int)tpl.step, tplRoiSize, dst.ptr(), (int)dst.step, funCfg, pBuffer); ippsFree( pBuffer ); return status >= 0; @@ -1041,6 +1045,8 @@ namespace cv { static bool ipp_matchTemplate( Mat& img, Mat& templ, Mat& result, int method, int cn ) { + CV_INSTRUMENT_REGION_IPP() + bool useIppMT = (templ.rows < img.rows/2 && templ.cols < img.cols/2); if(cn == 1 && useIppMT) @@ -1069,6 +1075,8 @@ static bool ipp_matchTemplate( Mat& img, Mat& templ, Mat& result, int method, in void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result, int method, InputArray _mask ) { + CV_INSTRUMENT_REGION() + if (!_mask.empty()) { cv::matchTemplateMask(_img, _templ, _result, method, _mask); diff --git a/modules/imgproc/src/thresh.cpp b/modules/imgproc/src/thresh.cpp index 1513bdafa1..e88d06a6c7 100644 --- a/modules/imgproc/src/thresh.cpp +++ b/modules/imgproc/src/thresh.cpp @@ -91,12 +91,12 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type ) switch( type ) { case THRESH_TRUNC: - if (_src.data == _dst.data && ippiThreshold_GT_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh) >= 0) + if (_src.data == _dst.data && CV_INSTRUMENT_FUN_IPP(ippiThreshold_GT_8u_C1IR, _dst.ptr(), (int)dst_step, sz, thresh) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; } - if (ippiThreshold_GT_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiThreshold_GT_8u_C1R, _src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -104,12 +104,12 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type ) setIppErrorStatus(); break; case THRESH_TOZERO: - if (_src.data == _dst.data && ippiThreshold_LTVal_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0) + if (_src.data == _dst.data && CV_INSTRUMENT_FUN_IPP(ippiThreshold_LTVal_8u_C1IR, _dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; } - if (ippiThreshold_LTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh+1, 0) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiThreshold_LTVal_8u_C1R, _src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh + 1, 0) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -117,12 +117,12 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type ) setIppErrorStatus(); break; case THRESH_TOZERO_INV: - if (_src.data == _dst.data && ippiThreshold_GTVal_8u_C1IR(_dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0) + if (_src.data == _dst.data && CV_INSTRUMENT_FUN_IPP(ippiThreshold_GTVal_8u_C1IR, _dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; } - if (ippiThreshold_GTVal_8u_C1R(_src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiThreshold_GTVal_8u_C1R, _src.ptr(), (int)src_step, _dst.ptr(), (int)dst_step, sz, thresh, 0) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -428,12 +428,12 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) switch( type ) { case THRESH_TRUNC: - if (_src.data == _dst.data && ippiThreshold_GT_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0) + if (_src.data == _dst.data && CV_INSTRUMENT_FUN_IPP(ippiThreshold_GT_16s_C1IR, dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; } - if (ippiThreshold_GT_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiThreshold_GT_16s_C1R, src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -441,12 +441,12 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) setIppErrorStatus(); break; case THRESH_TOZERO: - if (_src.data == _dst.data && ippiThreshold_LTVal_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh + 1, 0) >= 0) + if (_src.data == _dst.data && CV_INSTRUMENT_FUN_IPP(ippiThreshold_LTVal_16s_C1IR, dst, (int)dst_step*sizeof(dst[0]), sz, thresh + 1, 0) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; } - if (ippiThreshold_LTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+1, 0) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiThreshold_LTVal_16s_C1R, src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh + 1, 0) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -454,12 +454,12 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) setIppErrorStatus(); break; case THRESH_TOZERO_INV: - if (_src.data == _dst.data && ippiThreshold_GTVal_16s_C1IR(dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0) + if (_src.data == _dst.data && CV_INSTRUMENT_FUN_IPP(ippiThreshold_GTVal_16s_C1IR, dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; } - if (ippiThreshold_GTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0) + if (CV_INSTRUMENT_FUN_IPP(ippiThreshold_GTVal_16s_C1R, src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0) >= 0) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -689,7 +689,7 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type ) switch( type ) { case THRESH_TRUNC: - if (0 <= ippiThreshold_GT_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh)) + if (0 <= CV_INSTRUMENT_FUN_IPP(ippiThreshold_GT_32f_C1R, src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh)) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -697,7 +697,7 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type ) setIppErrorStatus(); break; case THRESH_TOZERO: - if (0 <= ippiThreshold_LTVal_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+FLT_EPSILON, 0)) + if (0 <= CV_INSTRUMENT_FUN_IPP(ippiThreshold_LTVal_32f_C1R, src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh + FLT_EPSILON, 0)) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -705,7 +705,7 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type ) setIppErrorStatus(); break; case THRESH_TOZERO_INV: - if (0 <= ippiThreshold_GTVal_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0)) + if (0 <= CV_INSTRUMENT_FUN_IPP(ippiThreshold_GTVal_32f_C1R, src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0)) { CV_IMPL_ADD(CV_IMPL_IPP); return; @@ -1176,11 +1176,13 @@ thresh_64f(const Mat& _src, Mat& _dst, double thresh, double maxval, int type) #ifdef HAVE_IPP static bool ipp_getThreshVal_Otsu_8u( const unsigned char* _src, int step, Size size, unsigned char &thresh) { + CV_INSTRUMENT_REGION_IPP() + #if IPP_VERSION_X100 >= 810 int ippStatus = -1; IppiSize srcSize = { size.width, size.height }; CV_SUPPRESS_DEPRECATED_START - ippStatus = ippiComputeThreshold_Otsu_8u_C1R(_src, step, srcSize, &thresh); + ippStatus = CV_INSTRUMENT_FUN_IPP(ippiComputeThreshold_Otsu_8u_C1R, _src, step, srcSize, &thresh); CV_SUPPRESS_DEPRECATED_END if(ippStatus >= 0) @@ -1464,6 +1466,8 @@ static bool ocl_threshold( InputArray _src, OutputArray _dst, double & thresh, d double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double maxval, int type ) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN_(_src.dims() <= 2 && _dst.isUMat(), ocl_threshold(_src, _dst, thresh, maxval, type), thresh) @@ -1557,6 +1561,8 @@ double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double m void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue, int method, int type, int blockSize, double delta ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); CV_Assert( src.type() == CV_8UC1 ); CV_Assert( blockSize % 2 == 1 && blockSize > 1 ); diff --git a/modules/imgproc/src/undistort.cpp b/modules/imgproc/src/undistort.cpp index 5e6cf05de4..198b0cbf9b 100644 --- a/modules/imgproc/src/undistort.cpp +++ b/modules/imgproc/src/undistort.cpp @@ -182,6 +182,8 @@ void cv::initUndistortRectifyMap( InputArray _cameraMatrix, InputArray _distCoef void cv::undistort( InputArray _src, OutputArray _dst, InputArray _cameraMatrix, InputArray _distCoeffs, InputArray _newCameraMatrix ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(), cameraMatrix = _cameraMatrix.getMat(); Mat distCoeffs = _distCoeffs.getMat(), newCameraMatrix = _newCameraMatrix.getMat(); diff --git a/modules/objdetect/src/cascadedetect.cpp b/modules/objdetect/src/cascadedetect.cpp index e206992574..9eef693d70 100644 --- a/modules/objdetect/src/cascadedetect.cpp +++ b/modules/objdetect/src/cascadedetect.cpp @@ -59,6 +59,8 @@ template void copyVectorToUMat(const std::vector<_Tp>& v, UMat& um void groupRectangles(std::vector& rectList, int groupThreshold, double eps, std::vector* weights, std::vector* levelWeights) { + CV_INSTRUMENT_REGION() + if( groupThreshold <= 0 || rectList.empty() ) { if( weights ) @@ -359,23 +361,31 @@ static void groupRectangles_meanshift(std::vector& rectList, double detect void groupRectangles(std::vector& rectList, int groupThreshold, double eps) { + CV_INSTRUMENT_REGION() + groupRectangles(rectList, groupThreshold, eps, 0, 0); } void groupRectangles(std::vector& rectList, std::vector& weights, int groupThreshold, double eps) { + CV_INSTRUMENT_REGION() + groupRectangles(rectList, groupThreshold, eps, &weights, 0); } //used for cascade detection algorithm for ROC-curve calculating void groupRectangles(std::vector& rectList, std::vector& rejectLevels, std::vector& levelWeights, int groupThreshold, double eps) { + CV_INSTRUMENT_REGION() + groupRectangles(rectList, groupThreshold, eps, &rejectLevels, &levelWeights); } //can be used for HOG detection algorithm only void groupRectangles_meanshift(std::vector& rectList, std::vector& foundWeights, std::vector& foundScales, double detectThreshold, Size winDetSize) { + CV_INSTRUMENT_REGION() + groupRectangles_meanshift(rectList, detectThreshold, &foundWeights, foundScales, winDetSize); } @@ -1217,6 +1227,8 @@ void CascadeClassifierImpl::detectMultiScaleNoGrouping( InputArray _image, std:: double scaleFactor, Size minObjectSize, Size maxObjectSize, bool outputRejectLevels ) { + CV_INSTRUMENT_REGION() + Size imgsz = _image.size(); Mat grayImage; @@ -1320,6 +1332,8 @@ void CascadeClassifierImpl::detectMultiScale( InputArray _image, std::vector 1 && _image.depth() == CV_8U ); if( empty() ) @@ -1352,6 +1366,8 @@ void CascadeClassifierImpl::detectMultiScale( InputArray _image, std::vector fakeLevels; std::vector fakeWeights; detectMultiScale( _image, objects, fakeLevels, fakeWeights, scaleFactor, @@ -1363,6 +1379,8 @@ void CascadeClassifierImpl::detectMultiScale( InputArray _image, std::vector 1 && image.depth() == CV_8U ); @@ -1636,6 +1654,8 @@ void CascadeClassifier::detectMultiScale( InputArray image, Size minSize, Size maxSize ) { + CV_INSTRUMENT_REGION() + CV_Assert(!empty()); cc->detectMultiScale(image, objects, scaleFactor, minNeighbors, flags, minSize, maxSize); clipObjects(image.size(), objects, 0, 0); @@ -1648,6 +1668,8 @@ void CascadeClassifier::detectMultiScale( InputArray image, int minNeighbors, int flags, Size minSize, Size maxSize ) { + CV_INSTRUMENT_REGION() + CV_Assert(!empty()); cc->detectMultiScale(image, objects, numDetections, scaleFactor, minNeighbors, flags, minSize, maxSize); @@ -1663,6 +1685,8 @@ void CascadeClassifier::detectMultiScale( InputArray image, Size minSize, Size maxSize, bool outputRejectLevels ) { + CV_INSTRUMENT_REGION() + CV_Assert(!empty()); cc->detectMultiScale(image, objects, rejectLevels, levelWeights, scaleFactor, minNeighbors, flags, diff --git a/modules/objdetect/src/detection_based_tracker.cpp b/modules/objdetect/src/detection_based_tracker.cpp index 040784bc23..8c236c7594 100644 --- a/modules/objdetect/src/detection_based_tracker.cpp +++ b/modules/objdetect/src/detection_based_tracker.cpp @@ -618,6 +618,8 @@ cv::DetectionBasedTracker::~DetectionBasedTracker() void DetectionBasedTracker::process(const Mat& imageGray) { + CV_INSTRUMENT_REGION() + CV_Assert(imageGray.type()==CV_8UC1); if ( separateDetectionWork && !separateDetectionWork->isWorking() ) { diff --git a/modules/objdetect/src/haar.cpp b/modules/objdetect/src/haar.cpp index 66ea517c3e..51843fa488 100644 --- a/modules/objdetect/src/haar.cpp +++ b/modules/objdetect/src/haar.cpp @@ -1275,6 +1275,8 @@ CV_IMPL int cvRunHaarClassifierCascade( const CvHaarClassifierCascade* _cascade, CvPoint pt, int start_stage ) { + CV_INSTRUMENT_REGION() + double stage_sum; return cvRunHaarClassifierCascadeSum(_cascade, pt, stage_sum, start_stage); } @@ -1308,6 +1310,8 @@ public: void operator()( const Range& range ) const { + CV_INSTRUMENT_REGION() + Size winSize0 = cascade->orig_window_size; Size winSize(cvRound(winSize0.width*factor), cvRound(winSize0.height*factor)); int y1 = range.start*stripSize, y2 = std::min(range.end*stripSize, sum1.rows - 1 - winSize0.height); @@ -1322,10 +1326,10 @@ public: 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(y1), (int)sum1.step, + CV_INSTRUMENT_FUN_IPP(ippiRectStdDev_32f_C1R, sum1.ptr(y1), (int)sum1.step, sqsum1.ptr(y1), (int)sqsum1.step, norm1->ptr(y1), (int)norm1->step, - ippiSize(ssz.width, ssz.height), iequRect ); + ippiSize(ssz.width, ssz.height), iequRect); int positive = (ssz.width/ystep)*((ssz.height + ystep-1)/ystep); @@ -1344,7 +1348,7 @@ public: for( int j = 0; j < cascade->count; j++ ) { - if( ippiApplyHaarClassifier_32f_C1R( + if (CV_INSTRUMENT_FUN_IPP(ippiApplyHaarClassifier_32f_C1R, sum1.ptr(y1), (int)sum1.step, norm1->ptr(y1), (int)norm1->step, mask1->ptr(y1), (int)mask1->step, @@ -1441,6 +1445,8 @@ public: void operator()( const Range& range ) const { + CV_INSTRUMENT_REGION() + int iy, startY = range.start, endY = range.end; const int *p0 = p[0], *p1 = p[1], *p2 = p[2], *p3 = p[3]; const int *pq0 = pq[0], *pq1 = pq[1], *pq2 = pq[2], *pq3 = pq[3]; @@ -1500,6 +1506,8 @@ cvHaarDetectObjectsForROC( const CvArr* _img, double scaleFactor, int minNeighbors, int flags, CvSize minSize, CvSize maxSize, bool outputRejectLevels ) { + CV_INSTRUMENT_REGION() + const double GROUP_EPS = 0.2; CvMat stub, *img = (CvMat*)_img; cv::Ptr temp, sum, tilted, sqsum, normImg, sumcanny, imgSmall; diff --git a/modules/objdetect/src/hog.cpp b/modules/objdetect/src/hog.cpp index 1055525a82..84baed6ef8 100644 --- a/modules/objdetect/src/hog.cpp +++ b/modules/objdetect/src/hog.cpp @@ -236,6 +236,8 @@ inline float32x4_t vsetq_f32(float f0, float f1, float f2, float f3) void HOGDescriptor::computeGradient(const Mat& img, Mat& grad, Mat& qangle, Size paddingTL, Size paddingBR) const { + CV_INSTRUMENT_REGION() + CV_Assert( img.type() == CV_8U || img.type() == CV_8UC3 ); Size gradsize(img.cols + paddingTL.width + paddingBR.width, @@ -1582,6 +1584,8 @@ static bool ocl_compute(InputArray _img, Size win_stride, std::vector& _d void HOGDescriptor::compute(InputArray _img, std::vector& descriptors, Size winStride, Size padding, const std::vector& locations) const { + CV_INSTRUMENT_REGION() + if( winStride == Size() ) winStride = cellSize; Size cacheStride(gcd(winStride.width, blockStride.width), @@ -1647,6 +1651,8 @@ void HOGDescriptor::detect(const Mat& img, std::vector& hits, std::vector& weights, double hitThreshold, Size winStride, Size padding, const std::vector& locations) const { + CV_INSTRUMENT_REGION() + hits.clear(); weights.clear(); if( svmDetector.empty() ) @@ -1758,6 +1764,8 @@ void HOGDescriptor::detect(const Mat& img, void HOGDescriptor::detect(const Mat& img, std::vector& hits, double hitThreshold, Size winStride, Size padding, const std::vector& locations) const { + CV_INSTRUMENT_REGION() + std::vector weightsV; detect(img, hits, weightsV, hitThreshold, winStride, padding, locations); } @@ -2040,6 +2048,8 @@ void HOGDescriptor::detectMultiScale( double hitThreshold, Size winStride, Size padding, double scale0, double finalThreshold, bool useMeanshiftGrouping) const { + CV_INSTRUMENT_REGION() + double scale = 1.; int levels = 0; @@ -2093,6 +2103,8 @@ void HOGDescriptor::detectMultiScale(InputArray img, std::vector& foundLoc double hitThreshold, Size winStride, Size padding, double scale0, double finalThreshold, bool useMeanshiftGrouping) const { + CV_INSTRUMENT_REGION() + std::vector foundWeights; detectMultiScale(img, foundLocations, foundWeights, hitThreshold, winStride, padding, scale0, finalThreshold, useMeanshiftGrouping); @@ -3489,6 +3501,8 @@ public: void operator()( const Range& range ) const { + CV_INSTRUMENT_REGION() + int i, i1 = range.start, i2 = range.end; Size maxSz(cvCeil(img.cols/(*locations)[0].scale), cvCeil(img.rows/(*locations)[0].scale)); @@ -3531,6 +3545,8 @@ void HOGDescriptor::detectROI(const cv::Mat& img, const std::vector & CV_OUT std::vector& foundLocations, CV_OUT std::vector& confidences, double hitThreshold, cv::Size winStride, cv::Size padding) const { + CV_INSTRUMENT_REGION() + foundLocations.clear(); confidences.clear(); @@ -3641,6 +3657,8 @@ void HOGDescriptor::detectMultiScaleROI(const cv::Mat& img, CV_OUT std::vector& foundLocations, std::vector& locations, double hitThreshold, int groupThreshold) const { + CV_INSTRUMENT_REGION() + std::vector allCandidates; Mutex mtx; @@ -3747,6 +3765,8 @@ void HOGDescriptor::readALTModel(String modelfile) void HOGDescriptor::groupRectangles(std::vector& rectList, std::vector& weights, int groupThreshold, double eps) const { + CV_INSTRUMENT_REGION() + if( groupThreshold <= 0 || rectList.empty() ) { return; diff --git a/modules/photo/src/align.cpp b/modules/photo/src/align.cpp index 4fda881c29..02087117e1 100644 --- a/modules/photo/src/align.cpp +++ b/modules/photo/src/align.cpp @@ -61,11 +61,15 @@ public: void process(InputArrayOfArrays src, std::vector& dst, InputArray, InputArray) { + CV_INSTRUMENT_REGION() + process(src, dst); } void process(InputArrayOfArrays _src, std::vector& dst) { + CV_INSTRUMENT_REGION() + std::vector src; _src.getMatVector(src); @@ -114,6 +118,8 @@ public: Point calculateShift(InputArray _img0, InputArray _img1) { + CV_INSTRUMENT_REGION() + Mat img0 = _img0.getMat(); Mat img1 = _img1.getMat(); CV_Assert(img0.channels() == 1 && img0.type() == img1.type()); @@ -160,6 +166,8 @@ public: void shiftMat(InputArray _src, OutputArray _dst, const Point shift) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); _dst.create(src.size(), src.type()); Mat dst = _dst.getMat(); @@ -203,6 +211,8 @@ public: void computeBitmaps(InputArray _img, OutputArray _tb, OutputArray _eb) { + CV_INSTRUMENT_REGION() + Mat img = _img.getMat(); _tb.create(img.size(), CV_8U); _eb.create(img.size(), CV_8U); diff --git a/modules/photo/src/calibrate.cpp b/modules/photo/src/calibrate.cpp index f945ef1b5b..dd30005f6f 100644 --- a/modules/photo/src/calibrate.cpp +++ b/modules/photo/src/calibrate.cpp @@ -63,6 +63,8 @@ public: void process(InputArrayOfArrays src, OutputArray dst, InputArray _times) { + CV_INSTRUMENT_REGION() + std::vector images; src.getMatVector(images); Mat times = _times.getMat(); @@ -184,6 +186,8 @@ public: void process(InputArrayOfArrays src, OutputArray dst, InputArray _times) { + CV_INSTRUMENT_REGION() + std::vector images; src.getMatVector(images); Mat times = _times.getMat(); diff --git a/modules/photo/src/contrast_preserve.cpp b/modules/photo/src/contrast_preserve.cpp index 55ea32189e..8c6caedbdf 100644 --- a/modules/photo/src/contrast_preserve.cpp +++ b/modules/photo/src/contrast_preserve.cpp @@ -52,6 +52,8 @@ using namespace cv; void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _color_boost) { + CV_INSTRUMENT_REGION() + Mat I = _src.getMat(); _dst.create(I.size(), CV_8UC1); Mat dst = _dst.getMat(); diff --git a/modules/photo/src/denoising.cpp b/modules/photo/src/denoising.cpp index 93d4b4ebbe..ebf345c827 100644 --- a/modules/photo/src/denoising.cpp +++ b/modules/photo/src/denoising.cpp @@ -104,6 +104,8 @@ static void fastNlMeansDenoising_( const Mat& src, Mat& dst, const std::vector(1, h), templateWindowSize, searchWindowSize); } @@ -111,6 +113,8 @@ void cv::fastNlMeansDenoising( InputArray _src, OutputArray _dst, float h, void cv::fastNlMeansDenoising( InputArray _src, OutputArray _dst, const std::vector& h, int templateWindowSize, int searchWindowSize, int normType) { + CV_INSTRUMENT_REGION() + int hn = (int)h.size(), type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); CV_Assert(hn == 1 || hn == cn); @@ -169,6 +173,8 @@ void cv::fastNlMeansDenoisingColored( InputArray _src, OutputArray _dst, float h, float hForColorComponents, int templateWindowSize, int searchWindowSize) { + CV_INSTRUMENT_REGION() + int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type); Size src_size = _src.size(); if (type != CV_8UC3 && type != CV_8UC4) @@ -308,6 +314,8 @@ void cv::fastNlMeansDenoisingMulti( InputArrayOfArrays _srcImgs, OutputArray _ds int imgToDenoiseIndex, int temporalWindowSize, float h, int templateWindowSize, int searchWindowSize) { + CV_INSTRUMENT_REGION() + fastNlMeansDenoisingMulti(_srcImgs, _dst, imgToDenoiseIndex, temporalWindowSize, std::vector(1, h), templateWindowSize, searchWindowSize); } @@ -317,6 +325,8 @@ void cv::fastNlMeansDenoisingMulti( InputArrayOfArrays _srcImgs, OutputArray _ds const std::vector& h, int templateWindowSize, int searchWindowSize, int normType) { + CV_INSTRUMENT_REGION() + std::vector srcImgs; _srcImgs.getMatVector(srcImgs); @@ -378,6 +388,8 @@ void cv::fastNlMeansDenoisingColoredMulti( InputArrayOfArrays _srcImgs, OutputAr float h, float hForColorComponents, int templateWindowSize, int searchWindowSize) { + CV_INSTRUMENT_REGION() + std::vector srcImgs; _srcImgs.getMatVector(srcImgs); diff --git a/modules/photo/src/inpaint.cpp b/modules/photo/src/inpaint.cpp index f91db5f545..0b96f1c057 100644 --- a/modules/photo/src/inpaint.cpp +++ b/modules/photo/src/inpaint.cpp @@ -810,6 +810,8 @@ cvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_i void cv::inpaint( InputArray _src, InputArray _mask, OutputArray _dst, double inpaintRange, int flags ) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(), mask = _mask.getMat(); _dst.create( src.size(), src.type() ); CvMat c_src = src, c_mask = mask, c_dst = _dst.getMat(); diff --git a/modules/photo/src/merge.cpp b/modules/photo/src/merge.cpp index 9772212d7b..3e59180904 100644 --- a/modules/photo/src/merge.cpp +++ b/modules/photo/src/merge.cpp @@ -58,6 +58,8 @@ public: void process(InputArrayOfArrays src, OutputArray dst, InputArray _times, InputArray input_response) { + CV_INSTRUMENT_REGION() + std::vector images; src.getMatVector(images); Mat times = _times.getMat(); @@ -122,6 +124,8 @@ public: void process(InputArrayOfArrays src, OutputArray dst, InputArray times) { + CV_INSTRUMENT_REGION() + process(src, dst, times, Mat()); } @@ -148,11 +152,15 @@ public: void process(InputArrayOfArrays src, OutputArrayOfArrays dst, InputArray, InputArray) { + CV_INSTRUMENT_REGION() + process(src, dst); } void process(InputArrayOfArrays src, OutputArray dst) { + CV_INSTRUMENT_REGION() + std::vector images; src.getMatVector(images); checkImageDimensions(images); @@ -302,6 +310,8 @@ public: void process(InputArrayOfArrays src, OutputArray dst, InputArray _times, InputArray input_response) { + CV_INSTRUMENT_REGION() + std::vector images; src.getMatVector(images); Mat times = _times.getMat(); @@ -339,6 +349,8 @@ public: void process(InputArrayOfArrays src, OutputArray dst, InputArray times) { + CV_INSTRUMENT_REGION() + process(src, dst, times, Mat()); } diff --git a/modules/photo/src/npr.cpp b/modules/photo/src/npr.cpp index 761f3c73cb..e800ce9a9a 100644 --- a/modules/photo/src/npr.cpp +++ b/modules/photo/src/npr.cpp @@ -51,6 +51,8 @@ using namespace cv; void cv::edgePreservingFilter(InputArray _src, OutputArray _dst, int flags, float sigma_s, float sigma_r) { + CV_INSTRUMENT_REGION() + Mat I = _src.getMat(); _dst.create(I.size(), CV_8UC3); Mat dst = _dst.getMat(); @@ -73,6 +75,8 @@ void cv::edgePreservingFilter(InputArray _src, OutputArray _dst, int flags, floa void cv::detailEnhance(InputArray _src, OutputArray _dst, float sigma_s, float sigma_r) { + CV_INSTRUMENT_REGION() + Mat I = _src.getMat(); _dst.create(I.size(), CV_8UC3); Mat dst = _dst.getMat(); @@ -118,6 +122,8 @@ void cv::detailEnhance(InputArray _src, OutputArray _dst, float sigma_s, float s void cv::pencilSketch(InputArray _src, OutputArray _dst1, OutputArray _dst2, float sigma_s, float sigma_r, float shade_factor) { + CV_INSTRUMENT_REGION() + Mat I = _src.getMat(); _dst1.create(I.size(), CV_8UC1); Mat dst1 = _dst1.getMat(); @@ -142,6 +148,8 @@ void cv::pencilSketch(InputArray _src, OutputArray _dst1, OutputArray _dst2, flo void cv::stylization(InputArray _src, OutputArray _dst, float sigma_s, float sigma_r) { + CV_INSTRUMENT_REGION() + Mat I = _src.getMat(); _dst.create(I.size(), CV_8UC3); Mat dst = _dst.getMat(); diff --git a/modules/photo/src/seamless_cloning.cpp b/modules/photo/src/seamless_cloning.cpp index 2564145e58..ed02f8cf92 100644 --- a/modules/photo/src/seamless_cloning.cpp +++ b/modules/photo/src/seamless_cloning.cpp @@ -49,6 +49,8 @@ using namespace cv; void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point p, OutputArray _blend, int flags) { + CV_INSTRUMENT_REGION() + const Mat src = _src.getMat(); const Mat dest = _dst.getMat(); const Mat mask = _mask.getMat(); @@ -116,6 +118,8 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point void cv::colorChange(InputArray _src, InputArray _mask, OutputArray _dst, float r, float g, float b) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); Mat mask = _mask.getMat(); _dst.create(src.size(), src.type()); @@ -142,6 +146,8 @@ void cv::colorChange(InputArray _src, InputArray _mask, OutputArray _dst, float void cv::illuminationChange(InputArray _src, InputArray _mask, OutputArray _dst, float a, float b) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); Mat mask = _mask.getMat(); @@ -169,6 +175,8 @@ void cv::illuminationChange(InputArray _src, InputArray _mask, OutputArray _dst, void cv::textureFlattening(InputArray _src, InputArray _mask, OutputArray _dst, float low_threshold, float high_threshold, int kernel_size) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); Mat mask = _mask.getMat(); diff --git a/modules/photo/src/seamless_cloning_impl.cpp b/modules/photo/src/seamless_cloning_impl.cpp index fe2751d143..6073a9bc4c 100644 --- a/modules/photo/src/seamless_cloning_impl.cpp +++ b/modules/photo/src/seamless_cloning_impl.cpp @@ -420,6 +420,8 @@ void Cloning::localColorChange(Mat &I, Mat &mask, Mat &wmask, Mat &cloned, float void Cloning::illuminationChange(Mat &I, Mat &mask, Mat &wmask, Mat &cloned, float alpha, float beta) { + CV_INSTRUMENT_REGION() + computeDerivatives(I,mask,wmask); arrayProduct(patchGradientX,binaryMaskFloat, patchGradientX); diff --git a/modules/photo/src/tonemap.cpp b/modules/photo/src/tonemap.cpp index a3a71fe50c..acfca04c9b 100644 --- a/modules/photo/src/tonemap.cpp +++ b/modules/photo/src/tonemap.cpp @@ -62,6 +62,8 @@ public: void process(InputArray _src, OutputArray _dst) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); CV_Assert(!src.empty()); _dst.create(src.size(), CV_32FC3); @@ -118,6 +120,8 @@ public: void process(InputArray _src, OutputArray _dst) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); CV_Assert(!src.empty()); _dst.create(src.size(), CV_32FC3); @@ -203,6 +207,8 @@ public: void process(InputArray _src, OutputArray _dst) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); CV_Assert(!src.empty()); _dst.create(src.size(), CV_32FC3); @@ -288,6 +294,8 @@ public: void process(InputArray _src, OutputArray _dst) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); CV_Assert(!src.empty()); _dst.create(src.size(), CV_32FC3); @@ -383,6 +391,8 @@ public: void process(InputArray _src, OutputArray _dst) { + CV_INSTRUMENT_REGION() + Mat src = _src.getMat(); CV_Assert(!src.empty()); _dst.create(src.size(), CV_32FC3); diff --git a/modules/shape/src/aff_trans.cpp b/modules/shape/src/aff_trans.cpp index 26644eb3a2..bbcd8abfa7 100644 --- a/modules/shape/src/aff_trans.cpp +++ b/modules/shape/src/aff_trans.cpp @@ -102,6 +102,8 @@ protected: void AffineTransformerImpl::warpImage(InputArray transformingImage, OutputArray output, int flags, int borderMode, const Scalar& borderValue) const { + CV_INSTRUMENT_REGION() + CV_Assert(!affineMat.empty()); warpAffine(transformingImage, output, affineMat, transformingImage.getMat().size(), flags, borderMode, borderValue); } @@ -183,6 +185,8 @@ static Mat _localAffineEstimate(const std::vector& shape1, const std::v void AffineTransformerImpl::estimateTransformation(InputArray _pts1, InputArray _pts2, std::vector& _matches) { + CV_INSTRUMENT_REGION() + Mat pts1 = _pts1.getMat(); Mat pts2 = _pts2.getMat(); CV_Assert((pts1.channels()==2) && (pts1.cols>0) && (pts2.channels()==2) && (pts2.cols>0)); @@ -228,6 +232,8 @@ void AffineTransformerImpl::estimateTransformation(InputArray _pts1, InputArray float AffineTransformerImpl::applyTransformation(InputArray inPts, OutputArray outPts) { + CV_INSTRUMENT_REGION() + Mat pts1 = inPts.getMat(); CV_Assert((pts1.channels()==2) && (pts1.cols>0)); diff --git a/modules/shape/src/emdL1.cpp b/modules/shape/src/emdL1.cpp index 75f1b13ad5..7baa97f0b9 100644 --- a/modules/shape/src/emdL1.cpp +++ b/modules/shape/src/emdL1.cpp @@ -787,6 +787,8 @@ float EmdL1::compuTotalFlow() float cv::EMDL1(InputArray _signature1, InputArray _signature2) { + CV_INSTRUMENT_REGION() + Mat signature1 = _signature1.getMat(), signature2 = _signature2.getMat(); EmdL1 emdl1; return emdl1.getEMDL1(signature1, signature2); diff --git a/modules/shape/src/haus_dis.cpp b/modules/shape/src/haus_dis.cpp index dd67a29982..6f372c416d 100644 --- a/modules/shape/src/haus_dis.cpp +++ b/modules/shape/src/haus_dis.cpp @@ -129,6 +129,8 @@ static float _apply(const Mat &set1, const Mat &set2, int distType, double propR float HausdorffDistanceExtractorImpl::computeDistance(InputArray contour1, InputArray contour2) { + CV_INSTRUMENT_REGION() + Mat set1=contour1.getMat(), set2=contour2.getMat(); if (set1.type() != CV_32F) set1.convertTo(set1, CV_32F); diff --git a/modules/shape/src/hist_cost.cpp b/modules/shape/src/hist_cost.cpp index 7df3c4e589..db1d42e562 100644 --- a/modules/shape/src/hist_cost.cpp +++ b/modules/shape/src/hist_cost.cpp @@ -125,6 +125,8 @@ protected: void NormHistogramCostExtractorImpl::buildCostMatrix(InputArray _descriptors1, InputArray _descriptors2, OutputArray _costMatrix) { + CV_INSTRUMENT_REGION() + // size of the costMatrix with dummies // Mat descriptors1=_descriptors1.getMat(); Mat descriptors2=_descriptors2.getMat(); @@ -251,6 +253,8 @@ protected: void EMDHistogramCostExtractorImpl::buildCostMatrix(InputArray _descriptors1, InputArray _descriptors2, OutputArray _costMatrix) { + CV_INSTRUMENT_REGION() + // size of the costMatrix with dummies // Mat descriptors1=_descriptors1.getMat(); Mat descriptors2=_descriptors2.getMat(); @@ -373,6 +377,8 @@ protected: void ChiHistogramCostExtractorImpl::buildCostMatrix(InputArray _descriptors1, InputArray _descriptors2, OutputArray _costMatrix) { + CV_INSTRUMENT_REGION() + // size of the costMatrix with dummies // Mat descriptors1=_descriptors1.getMat(); Mat descriptors2=_descriptors2.getMat(); @@ -490,6 +496,8 @@ protected: void EMDL1HistogramCostExtractorImpl::buildCostMatrix(InputArray _descriptors1, InputArray _descriptors2, OutputArray _costMatrix) { + CV_INSTRUMENT_REGION() + // size of the costMatrix with dummies // Mat descriptors1=_descriptors1.getMat(); Mat descriptors2=_descriptors2.getMat(); diff --git a/modules/shape/src/sc_dis.cpp b/modules/shape/src/sc_dis.cpp index e55247580b..89c6d91255 100644 --- a/modules/shape/src/sc_dis.cpp +++ b/modules/shape/src/sc_dis.cpp @@ -186,6 +186,8 @@ protected: float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, InputArray contour2) { + CV_INSTRUMENT_REGION() + // Checking // Mat sset1=contour1.getMat(), sset2=contour2.getMat(), set1, set2; if (set1.type() != CV_32F) @@ -492,6 +494,8 @@ void SCDMatcher::matchDescriptors(cv::Mat &descriptors1, cv::Mat &descriptors2, void SCDMatcher::buildCostMatrix(const cv::Mat &descriptors1, const cv::Mat &descriptors2, cv::Mat &costMatrix, cv::Ptr &comparer) const { + CV_INSTRUMENT_REGION() + comparer->buildCostMatrix(descriptors1, descriptors2, costMatrix); } diff --git a/modules/shape/src/tps_trans.cpp b/modules/shape/src/tps_trans.cpp index acff256b74..06cc6d7502 100644 --- a/modules/shape/src/tps_trans.cpp +++ b/modules/shape/src/tps_trans.cpp @@ -146,6 +146,8 @@ static Point2f _applyTransformation(const Mat &shapeRef, const Point2f point, co void ThinPlateSplineShapeTransformerImpl::warpImage(InputArray transformingImage, OutputArray output, int flags, int borderMode, const Scalar& borderValue) const { + CV_INSTRUMENT_REGION() + CV_Assert(tpsComputed==true); Mat theinput = transformingImage.getMat(); @@ -166,6 +168,8 @@ void ThinPlateSplineShapeTransformerImpl::warpImage(InputArray transformingImage float ThinPlateSplineShapeTransformerImpl::applyTransformation(InputArray inPts, OutputArray outPts) { + CV_INSTRUMENT_REGION() + CV_Assert(tpsComputed); Mat pts1 = inPts.getMat(); CV_Assert((pts1.channels()==2) && (pts1.cols>0)); @@ -189,6 +193,8 @@ float ThinPlateSplineShapeTransformerImpl::applyTransformation(InputArray inPts, void ThinPlateSplineShapeTransformerImpl::estimateTransformation(InputArray _pts1, InputArray _pts2, std::vector& _matches ) { + CV_INSTRUMENT_REGION() + Mat pts1 = _pts1.getMat(); Mat pts2 = _pts2.getMat(); CV_Assert((pts1.channels()==2) && (pts1.cols>0) && (pts2.channels()==2) && (pts2.cols>0)); diff --git a/modules/stitching/src/exposure_compensate.cpp b/modules/stitching/src/exposure_compensate.cpp index 1f04fff9f7..6f2562b204 100644 --- a/modules/stitching/src/exposure_compensate.cpp +++ b/modules/stitching/src/exposure_compensate.cpp @@ -147,6 +147,8 @@ void GainCompensator::feed(const std::vector &corners, const std::vector< void GainCompensator::apply(int index, Point /*corner*/, InputOutputArray image, InputArray /*mask*/) { + CV_INSTRUMENT_REGION() + multiply(image, gains_(index, 0), image); } @@ -225,6 +227,8 @@ void BlocksGainCompensator::feed(const std::vector &corners, const std::v void BlocksGainCompensator::apply(int index, Point /*corner*/, InputOutputArray _image, InputArray /*mask*/) { + CV_INSTRUMENT_REGION() + CV_Assert(_image.type() == CV_8UC3); UMat u_gain_map; diff --git a/modules/stitching/src/matchers.cpp b/modules/stitching/src/matchers.cpp index 40988b9888..3cf79822f0 100644 --- a/modules/stitching/src/matchers.cpp +++ b/modules/stitching/src/matchers.cpp @@ -144,6 +144,8 @@ private: void CpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo& matches_info) { + CV_INSTRUMENT_REGION() + CV_Assert(features1.descriptors.type() == features2.descriptors.type()); CV_Assert(features2.descriptors.depth() == CV_8U || features2.descriptors.depth() == CV_32F); @@ -212,6 +214,8 @@ void CpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &feat #ifdef HAVE_OPENCV_CUDAFEATURES2D void GpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo& matches_info) { + CV_INSTRUMENT_REGION() + matches_info.matches.clear(); ensureSizeIsEnough(features1.descriptors.size(), features1.descriptors.type(), descriptors1_); @@ -581,6 +585,8 @@ BestOf2NearestMatcher::BestOf2NearestMatcher(bool try_use_gpu, float match_conf, void BestOf2NearestMatcher::match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo &matches_info) { + CV_INSTRUMENT_REGION() + (*impl_)(features1, features2, matches_info); // Check if it makes sense to find homography diff --git a/modules/stitching/src/seam_finders.cpp b/modules/stitching/src/seam_finders.cpp index 4018127774..90bf599937 100644 --- a/modules/stitching/src/seam_finders.cpp +++ b/modules/stitching/src/seam_finders.cpp @@ -203,6 +203,8 @@ void DpSeamFinder::process( const Mat &image1, const Mat &image2, Point tl1, Point tl2, Mat &mask1, Mat &mask2) { + CV_INSTRUMENT_REGION() + CV_Assert(image1.size() == mask1.size()); CV_Assert(image2.size() == mask2.size()); diff --git a/modules/stitching/src/stitcher.cpp b/modules/stitching/src/stitcher.cpp index 7226ac7479..3760c75a63 100644 --- a/modules/stitching/src/stitcher.cpp +++ b/modules/stitching/src/stitcher.cpp @@ -93,12 +93,16 @@ Stitcher Stitcher::createDefault(bool try_use_gpu) Stitcher::Status Stitcher::estimateTransform(InputArrayOfArrays images) { + CV_INSTRUMENT_REGION() + return estimateTransform(images, std::vector >()); } Stitcher::Status Stitcher::estimateTransform(InputArrayOfArrays images, const std::vector > &rois) { + CV_INSTRUMENT_REGION() + images.getUMatVector(imgs_); rois_ = rois; @@ -117,12 +121,16 @@ Stitcher::Status Stitcher::estimateTransform(InputArrayOfArrays images, const st Stitcher::Status Stitcher::composePanorama(OutputArray pano) { + CV_INSTRUMENT_REGION() + return composePanorama(std::vector(), pano); } Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArray pano) { + CV_INSTRUMENT_REGION() + LOGLN("Warping images (auxiliary)... "); std::vector imgs; @@ -365,6 +373,8 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra Stitcher::Status Stitcher::stitch(InputArrayOfArrays images, OutputArray pano) { + CV_INSTRUMENT_REGION() + Status status = estimateTransform(images); if (status != OK) return status; @@ -374,6 +384,8 @@ Stitcher::Status Stitcher::stitch(InputArrayOfArrays images, OutputArray pano) Stitcher::Status Stitcher::stitch(InputArrayOfArrays images, const std::vector > &rois, OutputArray pano) { + CV_INSTRUMENT_REGION() + Status status = estimateTransform(images, rois); if (status != OK) return status; @@ -539,6 +551,8 @@ Stitcher::Status Stitcher::estimateCameraParams() Ptr createStitcher(bool try_use_gpu) { + CV_INSTRUMENT_REGION() + Ptr stitcher = makePtr(); stitcher->setRegistrationResol(0.6); stitcher->setSeamEstimationResol(0.1); diff --git a/modules/stitching/src/timelapsers.cpp b/modules/stitching/src/timelapsers.cpp index bc1d62e1a8..b42e79ae1a 100644 --- a/modules/stitching/src/timelapsers.cpp +++ b/modules/stitching/src/timelapsers.cpp @@ -65,6 +65,8 @@ void Timelapser::initialize(const std::vector &corners, const std::vector void Timelapser::process(InputArray _img, InputArray /*_mask*/, Point tl) { + CV_INSTRUMENT_REGION() + dst_.setTo(Scalar::all(0)); Mat img = _img.getMat(); diff --git a/modules/superres/src/btv_l1.cpp b/modules/superres/src/btv_l1.cpp index d47453f0d0..9c863411e8 100644 --- a/modules/superres/src/btv_l1.cpp +++ b/modules/superres/src/btv_l1.cpp @@ -658,6 +658,8 @@ namespace void BTVL1_Base::process(InputArrayOfArrays _src, OutputArray _dst, InputArrayOfArrays _forwardMotions, InputArrayOfArrays _backwardMotions, int baseIdx) { + CV_INSTRUMENT_REGION() + CV_Assert( scale_ > 1 ); CV_Assert( iterations_ > 0 ); CV_Assert( tau_ > 0.0 ); @@ -954,6 +956,8 @@ namespace void BTVL1::processImpl(Ptr& frameSource, OutputArray _output) { + CV_INSTRUMENT_REGION() + if (outPos_ >= storePos_) { _output.release(); @@ -1003,6 +1007,8 @@ namespace void BTVL1::readNextFrame(Ptr& frameSource) { + CV_INSTRUMENT_REGION() + frameSource->nextFrame(curFrame_); if (curFrame_.empty()) return; @@ -1065,6 +1071,8 @@ namespace void BTVL1::processFrame(int idx) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(isUmat_, ocl_processFrame(idx)) diff --git a/modules/superres/src/input_array_utility.cpp b/modules/superres/src/input_array_utility.cpp index a823e43cda..b3ea4bb914 100644 --- a/modules/superres/src/input_array_utility.cpp +++ b/modules/superres/src/input_array_utility.cpp @@ -235,6 +235,8 @@ namespace Mat cv::superres::convertToType(const Mat& src, int type, Mat& buf0, Mat& buf1) { + CV_INSTRUMENT_REGION() + if (src.type() == type) return src; @@ -260,6 +262,8 @@ Mat cv::superres::convertToType(const Mat& src, int type, Mat& buf0, Mat& buf1) UMat cv::superres::convertToType(const UMat& src, int type, UMat& buf0, UMat& buf1) { + CV_INSTRUMENT_REGION() + if (src.type() == type) return src; diff --git a/modules/superres/src/optical_flow.cpp b/modules/superres/src/optical_flow.cpp index 25a10af3f8..b5d1407eee 100644 --- a/modules/superres/src/optical_flow.cpp +++ b/modules/superres/src/optical_flow.cpp @@ -119,6 +119,8 @@ namespace void CpuOpticalFlow::calc(InputArray _frame0, InputArray _frame1, OutputArray _flow1, OutputArray _flow2) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_flow1.isUMat() && (_flow2.isUMat() || !_flow2.needed()), ocl_calc(_frame0, _frame1, _flow1, _flow2)) @@ -214,6 +216,8 @@ namespace void Farneback::calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) { + CV_INSTRUMENT_REGION() + CpuOpticalFlow::calc(frame0, frame1, flow1, flow2); } @@ -358,6 +362,8 @@ namespace void DualTVL1::calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) { + CV_INSTRUMENT_REGION() + CpuOpticalFlow::calc(frame0, frame1, flow1, flow2); } @@ -434,6 +440,8 @@ namespace void GpuOpticalFlow::calc(InputArray _frame0, InputArray _frame1, OutputArray _flow1, OutputArray _flow2) { + CV_INSTRUMENT_REGION() + GpuMat frame0 = arrGetGpuMat(_frame0, buf_[0]); GpuMat frame1 = arrGetGpuMat(_frame1, buf_[1]); diff --git a/modules/superres/src/super_resolution.cpp b/modules/superres/src/super_resolution.cpp index 3eae5a6fd2..6055920599 100644 --- a/modules/superres/src/super_resolution.cpp +++ b/modules/superres/src/super_resolution.cpp @@ -61,6 +61,8 @@ void cv::superres::SuperResolution::setInput(const Ptr& frameSource void cv::superres::SuperResolution::nextFrame(OutputArray frame) { + CV_INSTRUMENT_REGION() + isUmat_ = frame.isUMat(); if (firstCall_) diff --git a/modules/video/src/bgfg_KNN.cpp b/modules/video/src/bgfg_KNN.cpp index a532204d42..8c92d77acd 100755 --- a/modules/video/src/bgfg_KNN.cpp +++ b/modules/video/src/bgfg_KNN.cpp @@ -560,6 +560,8 @@ CV_INLINE void void BackgroundSubtractorKNNImpl::apply(InputArray _image, OutputArray _fgmask, double learningRate) { + CV_INSTRUMENT_REGION() + Mat image = _image.getMat(); bool needToInitialize = nframes == 0 || learningRate >= 1 || image.size() != frameSize || image.type() != frameType; @@ -598,6 +600,8 @@ void BackgroundSubtractorKNNImpl::apply(InputArray _image, OutputArray _fgmask, void BackgroundSubtractorKNNImpl::getBackgroundImage(OutputArray backgroundImage) const { + CV_INSTRUMENT_REGION() + int nchannels = CV_MAT_CN(frameType); //CV_Assert( nchannels == 3 ); Mat meanBackground(frameSize, CV_8UC3, Scalar::all(0)); diff --git a/modules/video/src/bgfg_gaussmix2.cpp b/modules/video/src/bgfg_gaussmix2.cpp index 2720e50e42..f4d2cc237e 100644 --- a/modules/video/src/bgfg_gaussmix2.cpp +++ b/modules/video/src/bgfg_gaussmix2.cpp @@ -836,6 +836,8 @@ void BackgroundSubtractorMOG2Impl::create_ocl_apply_kernel() void BackgroundSubtractorMOG2Impl::apply(InputArray _image, OutputArray _fgmask, double learningRate) { + CV_INSTRUMENT_REGION() + bool needToInitialize = nframes == 0 || learningRate >= 1 || _image.size() != frameSize || _image.type() != frameType; if( needToInitialize ) @@ -874,6 +876,8 @@ void BackgroundSubtractorMOG2Impl::apply(InputArray _image, OutputArray _fgmask, template void BackgroundSubtractorMOG2Impl::getBackgroundImage_intern(OutputArray backgroundImage) const { + CV_INSTRUMENT_REGION() + Mat meanBackground(frameSize, frameType, Scalar::all(0)); int firstGaussianIdx = 0; const GMM* gmm = bgmodel.ptr(); diff --git a/modules/video/src/camshift.cpp b/modules/video/src/camshift.cpp index 5449a1b47d..4a7017c82e 100644 --- a/modules/video/src/camshift.cpp +++ b/modules/video/src/camshift.cpp @@ -43,6 +43,8 @@ int cv::meanShift( InputArray _probImage, Rect& window, TermCriteria criteria ) { + CV_INSTRUMENT_REGION() + Size size; int cn; Mat mat; @@ -108,6 +110,8 @@ int cv::meanShift( InputArray _probImage, Rect& window, TermCriteria criteria ) cv::RotatedRect cv::CamShift( InputArray _probImage, Rect& window, TermCriteria criteria ) { + CV_INSTRUMENT_REGION() + const int TOLERANCE = 10; Size size; Mat mat; diff --git a/modules/video/src/kalman.cpp b/modules/video/src/kalman.cpp index 3b86771e87..d0fba8f8fb 100644 --- a/modules/video/src/kalman.cpp +++ b/modules/video/src/kalman.cpp @@ -81,6 +81,8 @@ void KalmanFilter::init(int DP, int MP, int CP, int type) const Mat& KalmanFilter::predict(const Mat& control) { + CV_INSTRUMENT_REGION() + // update the state: x'(k) = A*x(k) statePre = transitionMatrix*statePost; @@ -103,6 +105,8 @@ const Mat& KalmanFilter::predict(const Mat& control) const Mat& KalmanFilter::correct(const Mat& measurement) { + CV_INSTRUMENT_REGION() + // temp2 = H*P'(k) temp2 = measurementMatrix * errorCovPre; diff --git a/modules/video/src/lkpyramid.cpp b/modules/video/src/lkpyramid.cpp index b1ad94ddfa..b96a43c5f9 100644 --- a/modules/video/src/lkpyramid.cpp +++ b/modules/video/src/lkpyramid.cpp @@ -223,6 +223,8 @@ typedef float itemtype; void cv::detail::LKTrackerInvoker::operator()(const Range& range) const { + CV_INSTRUMENT_REGION() + Point2f halfWin((winSize.width-1)*0.5f, (winSize.height-1)*0.5f); const Mat& I = *prevImg; const Mat& J = *nextImg; @@ -740,6 +742,8 @@ void cv::detail::LKTrackerInvoker::operator()(const Range& range) const int cv::buildOpticalFlowPyramid(InputArray _img, OutputArrayOfArrays pyramid, Size winSize, int maxLevel, bool withDerivatives, int pyrBorder, int derivBorder, bool tryReuseInputImage) { + CV_INSTRUMENT_REGION() + Mat img = _img.getMat(); CV_Assert(img.depth() == CV_8U && winSize.width > 2 && winSize.height > 2 ); int pyrstep = withDerivatives ? 2 : 1; @@ -1102,6 +1106,8 @@ void SparsePyrLKOpticalFlowImpl::calc( InputArray _prevImg, InputArray _nextImg, InputArray _prevPts, InputOutputArray _nextPts, OutputArray _status, OutputArray _err) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(ocl::useOpenCL() && (_prevImg.isUMat() || _nextImg.isUMat()) && ocl::Image2D::isFormatSupported(CV_32F, 1, false), @@ -1371,6 +1377,8 @@ getRTMatrix( const Point2f* a, const Point2f* b, cv::Mat cv::estimateRigidTransform( InputArray src1, InputArray src2, bool fullAffine ) { + CV_INSTRUMENT_REGION() + Mat M(2, 3, CV_64F), A = src1.getMat(), B = src2.getMat(); const int COUNT = 15; diff --git a/modules/video/src/optflowgf.cpp b/modules/video/src/optflowgf.cpp index b486edaf84..69a7ea6189 100644 --- a/modules/video/src/optflowgf.cpp +++ b/modules/video/src/optflowgf.cpp @@ -1096,6 +1096,8 @@ private: void FarnebackOpticalFlowImpl::calc(InputArray _prev0, InputArray _next0, InputOutputArray _flow0) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_flow0.isUMat() && ocl::Image2D::isFormatSupported(CV_32F, 1, false), calc_ocl(_prev0,_next0,_flow0)) @@ -1184,6 +1186,8 @@ void cv::calcOpticalFlowFarneback( InputArray _prev0, InputArray _next0, InputOutputArray _flow0, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags ) { + CV_INSTRUMENT_REGION() + Ptr optflow; optflow = makePtr(levels,pyr_scale,false,winsize,iterations,poly_n,poly_sigma,flags); optflow->calc(_prev0,_next0,_flow0); diff --git a/modules/video/src/tvl1flow.cpp b/modules/video/src/tvl1flow.cpp index c0299e5c95..03d215d561 100644 --- a/modules/video/src/tvl1flow.cpp +++ b/modules/video/src/tvl1flow.cpp @@ -390,6 +390,8 @@ OpticalFlowDual_TVL1::OpticalFlowDual_TVL1() void OpticalFlowDual_TVL1::calc(InputArray _I0, InputArray _I1, InputOutputArray _flow) { + CV_INSTRUMENT_REGION() + CV_OCL_RUN(_flow.isUMat() && ocl::Image2D::isFormatSupported(CV_32F, 1, false), calc_ocl(_I0, _I1, _flow)) diff --git a/modules/videoio/src/cap.cpp b/modules/videoio/src/cap.cpp index 46cbf42733..55c20bef52 100644 --- a/modules/videoio/src/cap.cpp +++ b/modules/videoio/src/cap.cpp @@ -565,6 +565,8 @@ VideoCapture::~VideoCapture() bool VideoCapture::open(const String& filename, int apiPreference) { + CV_INSTRUMENT_REGION() + if (isOpened()) release(); icap = IVideoCapture_create(filename); if (!icap.empty()) @@ -576,11 +578,15 @@ bool VideoCapture::open(const String& filename, int apiPreference) bool VideoCapture::open(const String& filename) { + CV_INSTRUMENT_REGION() + return open(filename, CAP_ANY); } bool VideoCapture::open(int index) { + CV_INSTRUMENT_REGION() + if (isOpened()) release(); icap = IVideoCapture_create(index); if (!icap.empty()) @@ -602,6 +608,8 @@ void VideoCapture::release() bool VideoCapture::grab() { + CV_INSTRUMENT_REGION() + if (!icap.empty()) return icap->grabFrame(); return cvGrabFrame(cap) != 0; @@ -609,6 +617,8 @@ bool VideoCapture::grab() bool VideoCapture::retrieve(OutputArray image, int channel) { + CV_INSTRUMENT_REGION() + if (!icap.empty()) return icap->retrieveFrame(channel, image); @@ -630,6 +640,8 @@ bool VideoCapture::retrieve(OutputArray image, int channel) bool VideoCapture::read(OutputArray image) { + CV_INSTRUMENT_REGION() + if(grab()) retrieve(image); else @@ -667,6 +679,8 @@ VideoCapture& VideoCapture::operator >> (Mat& image) VideoCapture& VideoCapture::operator >> (UMat& image) { + CV_INSTRUMENT_REGION() + read(image); return *this; } @@ -707,6 +721,8 @@ VideoWriter::~VideoWriter() bool VideoWriter::open(const String& filename, int _fourcc, double fps, Size frameSize, bool isColor) { + CV_INSTRUMENT_REGION() + if (isOpened()) release(); iwriter = IVideoWriter_create(filename, _fourcc, fps, frameSize, isColor); if (!iwriter.empty()) @@ -737,6 +753,8 @@ double VideoWriter::get(int propId) const void VideoWriter::write(const Mat& image) { + CV_INSTRUMENT_REGION() + if( iwriter ) iwriter->write(image); else @@ -748,6 +766,8 @@ void VideoWriter::write(const Mat& image) VideoWriter& VideoWriter::operator << (const Mat& image) { + CV_INSTRUMENT_REGION() + write(image); return *this; } diff --git a/modules/videostab/src/deblurring.cpp b/modules/videostab/src/deblurring.cpp index 2f4cfd0725..dd6cfac825 100644 --- a/modules/videostab/src/deblurring.cpp +++ b/modules/videostab/src/deblurring.cpp @@ -52,6 +52,8 @@ namespace videostab float calcBlurriness(const Mat &frame) { + CV_INSTRUMENT_REGION() + Mat Gx, Gy; Sobel(frame, Gx, CV_32F, 1, 0); Sobel(frame, Gy, CV_32F, 0, 1); @@ -70,6 +72,8 @@ WeightingDeblurer::WeightingDeblurer() void WeightingDeblurer::deblur(int idx, Mat &frame) { + CV_INSTRUMENT_REGION() + CV_Assert(frame.type() == CV_8UC3); bSum_.create(frame.size()); diff --git a/modules/videostab/src/global_motion.cpp b/modules/videostab/src/global_motion.cpp index f7938d5c4c..53603382ad 100644 --- a/modules/videostab/src/global_motion.cpp +++ b/modules/videostab/src/global_motion.cpp @@ -356,6 +356,8 @@ static Mat estimateGlobMotionLeastSquaresAffine( Mat estimateGlobalMotionLeastSquares( InputOutputArray points0, InputOutputArray points1, int model, float *rmse) { + CV_INSTRUMENT_REGION() + CV_Assert(model <= MM_AFFINE); CV_Assert(points0.type() == points1.type()); const int npoints = points0.getMat().checkVector(2); @@ -380,6 +382,8 @@ Mat estimateGlobalMotionRansac( InputArray points0, InputArray points1, int model, const RansacParams ¶ms, float *rmse, int *ninliers) { + CV_INSTRUMENT_REGION() + CV_Assert(model <= MM_AFFINE); CV_Assert(points0.type() == points1.type()); const int npoints = points0.getMat().checkVector(2); @@ -844,6 +848,8 @@ Mat KeypointBasedMotionEstimatorGpu::estimate(const cuda::GpuMat &frame0, const Mat getMotion(int from, int to, const std::vector &motions) { + CV_INSTRUMENT_REGION() + Mat M = Mat::eye(3, 3, CV_32F); if (to > from) { diff --git a/modules/videostab/src/inpainting.cpp b/modules/videostab/src/inpainting.cpp index 991112712d..19f8e519fc 100644 --- a/modules/videostab/src/inpainting.cpp +++ b/modules/videostab/src/inpainting.cpp @@ -103,6 +103,8 @@ void InpaintingPipeline::setStabilizationMotions(const std::vector &val) void InpaintingPipeline::inpaint(int idx, Mat &frame, Mat &mask) { + CV_INSTRUMENT_REGION() + for (size_t i = 0; i < inpainters_.size(); ++i) inpainters_[i]->inpaint(idx, frame, mask); } @@ -124,6 +126,8 @@ ConsistentMosaicInpainter::ConsistentMosaicInpainter() void ConsistentMosaicInpainter::inpaint(int idx, Mat &frame, Mat &mask) { + CV_INSTRUMENT_REGION() + CV_Assert(frame.type() == CV_8UC3); CV_Assert(mask.size() == frame.size() && mask.type() == CV_8U); @@ -336,6 +340,8 @@ MotionInpainter::MotionInpainter() void MotionInpainter::inpaint(int idx, Mat &frame, Mat &mask) { + CV_INSTRUMENT_REGION() + std::priority_queue > neighbors; std::vector vmotions(2*radius_ + 1); @@ -456,6 +462,8 @@ public: void ColorAverageInpainter::inpaint(int /*idx*/, Mat &frame, Mat &mask) { + CV_INSTRUMENT_REGION() + ColorAverageInpaintBody body; body.mask = mask; body.frame = frame; @@ -465,6 +473,8 @@ void ColorAverageInpainter::inpaint(int /*idx*/, Mat &frame, Mat &mask) void ColorInpainter::inpaint(int /*idx*/, Mat &frame, Mat &mask) { + CV_INSTRUMENT_REGION() + bitwise_not(mask, invMask_); cv::inpaint(frame, invMask_, frame, radius_, method_); } @@ -474,6 +484,8 @@ void calcFlowMask( const Mat &flowX, const Mat &flowY, const Mat &errors, float maxError, const Mat &mask0, const Mat &mask1, Mat &flowMask) { + CV_INSTRUMENT_REGION() + CV_Assert(flowX.type() == CV_32F && flowX.size() == mask0.size()); CV_Assert(flowY.type() == CV_32F && flowY.size() == mask0.size()); CV_Assert(errors.type() == CV_32F && errors.size() == mask0.size()); @@ -508,6 +520,8 @@ void completeFrameAccordingToFlow( const Mat &flowMask, const Mat &flowX, const Mat &flowY, const Mat &frame1, const Mat &mask1, float distThresh, Mat &frame0, Mat &mask0) { + CV_INSTRUMENT_REGION() + CV_Assert(flowMask.type() == CV_8U); CV_Assert(flowX.type() == CV_32F && flowX.size() == flowMask.size()); CV_Assert(flowY.type() == CV_32F && flowY.size() == flowMask.size()); diff --git a/modules/videostab/src/motion_stabilizing.cpp b/modules/videostab/src/motion_stabilizing.cpp index d31c420f64..025b7d56de 100644 --- a/modules/videostab/src/motion_stabilizing.cpp +++ b/modules/videostab/src/motion_stabilizing.cpp @@ -637,6 +637,8 @@ static inline void relaxMotion(const float M[], float t, float res[]) Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio) { + CV_INSTRUMENT_REGION() + CV_Assert(M.size() == Size(3,3) && M.type() == CV_32F); const float w = static_cast(size.width); @@ -672,6 +674,8 @@ Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio) // TODO can be estimated for O(1) time float estimateOptimalTrimRatio(const Mat &M, Size size) { + CV_INSTRUMENT_REGION() + CV_Assert(M.size() == Size(3,3) && M.type() == CV_32F); const float w = static_cast(size.width); diff --git a/modules/videostab/src/outlier_rejection.cpp b/modules/videostab/src/outlier_rejection.cpp index 3ae6e6b271..0e9769c522 100644 --- a/modules/videostab/src/outlier_rejection.cpp +++ b/modules/videostab/src/outlier_rejection.cpp @@ -51,6 +51,8 @@ namespace videostab void NullOutlierRejector::process( Size /*frameSize*/, InputArray points0, InputArray points1, OutputArray mask) { + CV_INSTRUMENT_REGION() + CV_Assert(points0.type() == points1.type()); CV_Assert(points0.getMat().checkVector(2) == points1.getMat().checkVector(2)); @@ -70,6 +72,8 @@ TranslationBasedLocalOutlierRejector::TranslationBasedLocalOutlierRejector() void TranslationBasedLocalOutlierRejector::process( Size frameSize, InputArray points0, InputArray points1, OutputArray mask) { + CV_INSTRUMENT_REGION() + CV_Assert(points0.type() == points1.type()); CV_Assert(points0.getMat().checkVector(2) == points1.getMat().checkVector(2));