From: Ilya Lavrenov Date: Wed, 16 Apr 2014 15:23:44 +0000 (+0400) Subject: added status check X-Git-Tag: submit/tizen_ivi/20141117.190038~2^2~460^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce0941160efa71dea559a8ac9da540a8680482bb;p=profile%2Fivi%2Fopencv.git added status check --- diff --git a/modules/core/src/mathfuncs.cpp b/modules/core/src/mathfuncs.cpp index bb33e95..3b45855 100644 --- a/modules/core/src/mathfuncs.cpp +++ b/modules/core/src/mathfuncs.cpp @@ -241,6 +241,7 @@ static void Magnitude_32f(const float* x, const float* y, float* mag, int len) IppStatus status = ippsMagnitude_32f(x, y, mag, len); if (status >= 0) return; + setIppErrorStatus(); #endif int i = 0; @@ -273,6 +274,7 @@ static void Magnitude_64f(const double* x, const double* y, double* mag, int len IppStatus status = ippsMagnitude_64f(x, y, mag, len); if (status >= 0) return; + setIppErrorStatus(); #endif int i = 0; @@ -305,6 +307,7 @@ static void InvSqrt_32f(const float* src, float* dst, int len) #if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (ippsInvSqrt_32f_A21(src, dst, len) >= 0) return; + setIppErrorStatus(); #endif int i = 0; @@ -353,6 +356,7 @@ static void Sqrt_32f(const float* src, float* dst, int len) #if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (ippsSqrt_32f_A21(src, dst, len) >= 0) return; + setIppErrorStatus(); #endif int i = 0; @@ -386,6 +390,7 @@ static void Sqrt_64f(const double* src, double* dst, int len) #if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (ippsSqrt_64f_A50(src, dst, len) >= 0) return; + setIppErrorStatus(); #endif int i = 0; @@ -767,6 +772,7 @@ void polarToCart( InputArray src1, InputArray src2, IppStatus status = ippFunc(Mag.data, Angle.data, X.data, Y.data, static_cast(cn * X.total())); if (status >= 0) return; + setIppErrorStatus(); } #endif @@ -1319,6 +1325,7 @@ static void Exp_32f_ipp(const float *x, float *y, int n) { if (0 <= ippsExp_32f_A21(x, y, n)) return; + setIppErrorStatus(); Exp_32f(x, y, n); } @@ -1326,6 +1333,7 @@ static void Exp_64f_ipp(const double *x, double *y, int n) { if (0 <= ippsExp_64f_A50(x, y, n)) return; + setIppErrorStatus(); Exp_64f(x, y, n); } @@ -1977,6 +1985,7 @@ static void Log_32f_ipp(const float *x, float *y, int n) { if (0 <= ippsLn_32f_A21(x, y, n)) return; + setIppErrorStatus(); Log_32f(x, y, n); } @@ -1984,6 +1993,7 @@ static void Log_64f_ipp(const double *x, double *y, int n) { if (0 <= ippsLn_64f_A50(x, y, n)) return; + setIppErrorStatus(); Log_64f(x, y, n); } @@ -2181,6 +2191,7 @@ void pow( InputArray _src, double power, OutputArray _dst ) if (status >= 0) return; + setIppErrorStatus(); } #endif if (same) @@ -2241,6 +2252,7 @@ void pow( InputArray _src, double power, OutputArray _dst ) if (status >= 0) return; + setIppErrorStatus(); } #endif diff --git a/modules/core/src/matmul.cpp b/modules/core/src/matmul.cpp index 2373519..fb23d1c 100644 --- a/modules/core/src/matmul.cpp +++ b/modules/core/src/matmul.cpp @@ -2229,6 +2229,7 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray (const Ipp32f *)src2.data, (int)src2.step, sizeof(Ipp32f), (Ipp32f *)dst.data, (int)dst.step, sizeof(Ipp32f), (int)len, 1) >= 0) return; + setIppErrorStatus(); #endif func(src1.data, src2.data, dst.data, (int)len, palpha); return; @@ -2810,6 +2811,7 @@ static double dotProd_8u(const uchar* src1, const uchar* src2, int len) src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) return r; + setIppErrorStatus(); #endif int i = 0; @@ -2870,6 +2872,7 @@ static double dotProd_16u(const ushort* src1, const ushort* src2, int len) double r = 0; if (0 <= ippiDotProd_16u64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) return r; + setIppErrorStatus(); #endif return dotProd_(src1, src2, len); } @@ -2880,6 +2883,7 @@ static double dotProd_16s(const short* src1, const short* src2, int len) double r = 0; if (0 <= ippiDotProd_16s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) return r; + setIppErrorStatus(); #endif return dotProd_(src1, src2, len); } @@ -2890,6 +2894,7 @@ static double dotProd_32s(const int* src1, const int* src2, int len) double r = 0; if (0 <= ippiDotProd_32s64f_C1R(src1, (int)(len*sizeof(src1[0])), src2, (int)(len*sizeof(src2[0])), ippiSize(len, 1), &r)) return r; + setIppErrorStatus(); #endif return dotProd_(src1, src2, len); } @@ -2900,6 +2905,7 @@ static double dotProd_32f(const float* src1, const float* src2, int len) double r = 0; if (0 <= ippsDotProd_32f64f(src1, src2, len, &r)) return r; + setIppErrorStatus(); #endif return dotProd_(src1, src2, len); } @@ -2910,6 +2916,7 @@ static double dotProd_64f(const double* src1, const double* src2, int len) double r = 0; if (0 <= ippsDotProd_64f(src1, src2, len, &r)) return r; + setIppErrorStatus(); #endif return dotProd_(src1, src2, len); } diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index f7aded7..d753b97 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -3039,8 +3039,12 @@ void cv::transpose( InputArray _src, OutputArray _dst ) type == CV_32FC4 ? (ippiTranspose)ippiTranspose_32f_C4R : 0; IppiSize roiSize = { src.cols, src.rows }; - if (ippFunc != 0 && ippFunc(src.data, (int)src.step, dst.data, (int)dst.step, roiSize) >= 0) - return; + if (ippFunc != 0) + { + if (ippFunc(src.data, (int)src.step, dst.data, (int)dst.step, roiSize) >= 0) + return; + setIppErrorStatus(); + } #endif if( dst.data == src.data ) diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index 66866ab..e5f10bf 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -579,11 +579,10 @@ cv::Scalar cv::sum( InputArray _src ) { Scalar sc; for( int i = 0; i < cn; i++ ) - { sc[i] = res[i]; - } return sc; } + setIppErrorStatus(); } } #endif @@ -714,6 +713,7 @@ int cv::countNonZero( InputArray _src ) if (status >= 0) return (Ipp32s)src.total() - count; + setIppErrorStatus(); } #endif @@ -757,9 +757,8 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask ) { Ipp64f res; if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, &res) >= 0 ) - { return Scalar(res); - } + setIppErrorStatus(); } typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *); ippiMaskMeanFuncC3 ippFuncC3 = @@ -776,6 +775,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask ) { return Scalar(res1, res2, res3); } + setIppErrorStatus(); } } else @@ -809,11 +809,10 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask ) { Scalar sc; for( int i = 0; i < cn; i++ ) - { sc[i] = res[i]; - } return sc; } + setIppErrorStatus(); } } } @@ -977,6 +976,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input { if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, pmean, pstddev) >= 0 ) return; + setIppErrorStatus(); } typedef IppStatus (CV_STDCALL* ippiMaskMeanStdDevFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *, Ipp64f *); ippiMaskMeanStdDevFuncC3 ippFuncC3 = @@ -990,6 +990,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 && ippFuncC3(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 ) return; + setIppErrorStatus(); } } else @@ -1006,6 +1007,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input { if( ippFuncC1(src.data, (int)src.step[0], sz, pmean, pstddev) >= 0 ) return; + setIppErrorStatus(); } typedef IppStatus (CV_STDCALL* ippiMeanStdDevFuncC3)(const void *, int, IppiSize, int, Ipp64f *, Ipp64f *); ippiMeanStdDevFuncC3 ippFuncC3 = @@ -1019,6 +1021,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input ippFuncC3(src.data, (int)src.step[0], sz, 2, &pmean[1], &pstddev[1]) >= 0 && ippFuncC3(src.data, (int)src.step[0], sz, 3, &pmean[2], &pstddev[2]) >= 0 ) return; + setIppErrorStatus(); } } } @@ -1404,6 +1407,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal, } return; } + setIppErrorStatus(); } } else @@ -1436,6 +1440,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal, } return; } + setIppErrorStatus(); } } } @@ -2076,9 +2081,9 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) { Ipp64f norm; if( ippFuncC1(src.data, (int)src.step[0], mask.data, (int)mask.step[0], sz, &norm) >= 0 ) - { return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm; - } + + setIppErrorStatus(); } typedef IppStatus (CV_STDCALL* ippiMaskNormFuncC3)(const void *, int, const void *, int, IppiSize, int, Ipp64f *); ippiMaskNormFuncC3 ippFuncC3 = @@ -2114,6 +2119,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) 0; return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm; } + setIppErrorStatus(); } } else @@ -2190,6 +2196,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) } return normType == NORM_L2 ? (double)std::sqrt(norm) : (double)norm; } + setIppErrorStatus(); } } } @@ -2430,6 +2437,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m Ipp64f norm; if( ippFuncC1(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, &norm) >= 0 ) return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm; + setIppErrorStatus(); } } else @@ -2459,6 +2467,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m Ipp64f norm; if( ippFunc(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 ) return (double)norm; + setIppErrorStatus(); } } } @@ -2511,6 +2520,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m Ipp64f norm; if( ippFuncC1(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], mask.data, (int)mask.step[0], sz, &norm) >= 0 ) return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm; + setIppErrorStatus(); } typedef IppStatus (CV_STDCALL* ippiMaskNormDiffFuncC3)(const void *, int, const void *, int, const void *, int, IppiSize, int, Ipp64f *); ippiMaskNormDiffFuncC3 ippFuncC3 = @@ -2546,6 +2556,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m 0; return normType == NORM_L2SQR ? (double)(norm * norm) : (double)norm; } + setIppErrorStatus(); } } else @@ -2622,6 +2633,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m } return normType == NORM_L2 ? (double)std::sqrt(norm) : (double)norm; } + setIppErrorStatus(); } } } diff --git a/modules/imgproc/src/accum.cpp b/modules/imgproc/src/accum.cpp index 74a63e9..0e99d74 100644 --- a/modules/imgproc/src/accum.cpp +++ b/modules/imgproc/src/accum.cpp @@ -503,6 +503,7 @@ void cv::accumulateSquare( InputArray _src, InputOutputArray _dst, InputArray _m if (status >= 0) return; + setIppErrorStatus(); } } #endif @@ -584,6 +585,7 @@ void cv::accumulateProduct( InputArray _src1, InputArray _src2, if (status >= 0) return; + setIppErrorStatus(); } } #endif @@ -663,6 +665,7 @@ void cv::accumulateWeighted( InputArray _src, InputOutputArray _dst, if (status >= 0) return; + setIppErrorStatus(); } } #endif diff --git a/modules/imgproc/src/canny.cpp b/modules/imgproc/src/canny.cpp index 65e8173..3590e29 100644 --- a/modules/imgproc/src/canny.cpp +++ b/modules/imgproc/src/canny.cpp @@ -59,10 +59,14 @@ static bool ippCanny(const Mat& _src, Mat& _dst, float low, float high) int size = 0, size1 = 0; IppiSize roi = { _src.cols, _src.rows }; - ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size); - ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size1); + if (ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size) < 0) + return false; + if (ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &size1) < 0) + return false; size = std::max(size, size1); - ippiCannyGetSize(roi, &size1); + + if (ippiCannyGetSize(roi, &size1) < 0) + return false; size = std::max(size, size1); AutoBuffer buf(size + 64); @@ -286,9 +290,12 @@ void cv::Canny( InputArray _src, OutputArray _dst, #endif #ifdef USE_IPP_CANNY - if( aperture_size == 3 && !L2gradient && 1 == cn && - ippCanny(src, dst, (float)low_thresh, (float)high_thresh) ) - return; + if( aperture_size == 3 && !L2gradient && 1 == cn ) + { + if (ippCanny(src, dst, (float)low_thresh, (float)high_thresh)) + return; + setIppErrorStatus(); + } #endif Mat dx(src.rows, src.cols, CV_16SC(cn)); diff --git a/modules/imgproc/src/color.cpp b/modules/imgproc/src/color.cpp index 92a8cdd..5839cb3 100644 --- a/modules/imgproc/src/color.cpp +++ b/modules/imgproc/src/color.cpp @@ -3288,32 +3288,38 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if ( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 0, 1, 2)) ) return; + setIppErrorStatus(); } else if( code == CV_BGRA2BGR ) { if ( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiCopyAC4C3RTab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_BGR2RGBA ) { if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC3C4RTab[depth], 2, 1, 0)) ) return; + setIppErrorStatus(); } else if( code == CV_RGBA2BGR ) { if( CvtColorIPPLoop(src, dst, IPPReorderFunctor(ippiSwapChannelsC4C3RTab[depth], 2, 1, 0)) ) return; + setIppErrorStatus(); } else if( code == CV_RGB2BGR ) { if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC3RTab[depth], 2, 1, 0)) ) return; + setIppErrorStatus(); } #if !defined(HAVE_IPP_ICV_ONLY) && (IPP_VERSION_X100 >= 801) else if( code == CV_RGBA2BGRA ) { if( CvtColorIPPLoopCopy(src, dst, IPPReorderFunctor(ippiSwapChannelsC4RTab[depth], 2, 1, 0)) ) return; + setIppErrorStatus(); } #endif #endif @@ -3343,24 +3349,29 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R))) return; + setIppErrorStatus(); } else if (code == CV_BGRA2BGR565) { - if (CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], - (ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 0, 1, 2, depth))) + if (CvtColorIPPLoopCopy(src, dst, + IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], + (ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 0, 1, 2, depth))) return; + setIppErrorStatus(); } else if (code == CV_RGB2BGR565) { if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], (ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if (code == CV_RGBA2BGR565) { if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], (ippiGeneralFunc)ippiBGRToBGR565_8u16u_C3R, 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } CV_SUPPRESS_DEPRECATED_END #endif @@ -3392,24 +3403,28 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R))) return; + setIppErrorStatus(); } else if (code == CV_BGR5652RGB) { if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R, ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth))) return; + setIppErrorStatus(); } if (code == CV_BGR5652BGRA) { if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R, ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth))) return; + setIppErrorStatus(); } else if (code == CV_BGR5652RGBA) { if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiBGR565ToBGR_16u8u_C3R, ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth))) return; + setIppErrorStatus(); } CV_SUPPRESS_DEPRECATED_END #endif @@ -3432,21 +3447,25 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC3Tab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_RGB2GRAY ) { if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC3Tab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_BGRA2GRAY ) { if( CvtColorIPPLoop(src, dst, IPPColor2GrayFunctor(ippiColor2GrayC4Tab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_RGBA2GRAY ) { if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGB2GrayC4Tab[depth])) ) return; + setIppErrorStatus(); } #endif @@ -3484,11 +3503,13 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if( CvtColorIPPLoop(src, dst, IPPGray2BGRFunctor(ippiCopyP3C3RTab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_GRAY2BGRA ) { if( CvtColorIPPLoop(src, dst, IPPGray2BGRAFunctor(ippiCopyP3C3RTab[depth], ippiSwapChannelsC3C4RTab[depth], depth)) ) return; + setIppErrorStatus(); } #endif @@ -3532,24 +3553,28 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiRGBToYUV_8u_C3R))) return; + setIppErrorStatus(); } else if (code == CV_BGR2YUV && scn == 3 && depth == CV_8U) { if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], (ippiGeneralFunc)ippiRGBToYUV_8u_C3R, 2, 1, 0, depth))) return; + setIppErrorStatus(); } else if (code == CV_RGB2YUV && scn == 4 && depth == CV_8U) { if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], (ippiGeneralFunc)ippiRGBToYUV_8u_C3R, 0, 1, 2, depth))) return; + setIppErrorStatus(); } else if (code == CV_BGR2YUV && scn == 4 && depth == CV_8U) { if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], (ippiGeneralFunc)ippiRGBToYUV_8u_C3R, 2, 1, 0, depth))) return; + setIppErrorStatus(); } #endif @@ -3587,24 +3612,28 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R))) return; + setIppErrorStatus(); } else if (code == CV_YUV2BGR && dcn == 3 && depth == CV_8U) { if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R, ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth))) return; + setIppErrorStatus(); } else if (code == CV_YUV2RGB && dcn == 4 && depth == CV_8U) { if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R, ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth))) return; + setIppErrorStatus(); } else if (code == CV_YUV2BGR && dcn == 4 && depth == CV_8U) { if (CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiYUVToRGB_8u_C3R, ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth))) return; + setIppErrorStatus(); } #endif @@ -3629,21 +3658,25 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_BGR2XYZ && scn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_RGB2XYZ && scn == 3 ) { if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2XYZTab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_RGB2XYZ && scn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2XYZTab[depth], 0, 1, 2, depth)) ) return; + setIppErrorStatus(); } #endif @@ -3668,21 +3701,25 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_XYZ2BGR && dcn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } if( code == CV_XYZ2RGB && dcn == 3 ) { if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiXYZ2RGBTab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_XYZ2RGB && dcn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiXYZ2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) return; + setIppErrorStatus(); } #endif @@ -3713,41 +3750,49 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_BGR2HSV_FULL && scn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_RGB2HSV_FULL && scn == 3 ) { if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HSVTab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_RGB2HSV_FULL && scn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HSVTab[depth], 0, 1, 2, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_BGR2HLS_FULL && scn == 3 ) { if( CvtColorIPPLoopCopy(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_BGR2HLS_FULL && scn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_RGB2HLS_FULL && scn == 3 ) { if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiRGB2HLSTab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_RGB2HLS_FULL && scn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGB2HLSTab[depth], 0, 1, 2, depth)) ) return; + setIppErrorStatus(); } } #endif @@ -3794,41 +3839,49 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_HSV2BGR_FULL && dcn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_HSV2RGB_FULL && dcn == 3 ) { if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHSV2RGBTab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_HSV2RGB_FULL && dcn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHSV2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_HLS2BGR_FULL && dcn == 3 ) { if( CvtColorIPPLoopCopy(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_HLS2BGR_FULL && dcn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_HLS2RGB_FULL && dcn == 3 ) { if( CvtColorIPPLoopCopy(src, dst, IPPGeneralFunctor(ippiHLS2RGBTab[depth])) ) return; + setIppErrorStatus(); } else if( code == CV_HLS2RGB_FULL && dcn == 4 ) { if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor(ippiHLS2RGBTab[depth], ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) return; + setIppErrorStatus(); } } #endif @@ -3868,47 +3921,55 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiBGRToLab_8u_C3R))) return; + setIppErrorStatus(); } else if (code == CV_LBGR2Lab && scn == 4 && depth == CV_8U) { if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], (ippiGeneralFunc)ippiBGRToLab_8u_C3R, 0, 1, 2, depth))) return; + setIppErrorStatus(); } else if (code == CV_LRGB2Lab && scn == 3 && depth == CV_8U) { if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], (ippiGeneralFunc)ippiBGRToLab_8u_C3R, 2, 1, 0, depth))) return; + setIppErrorStatus(); } else if (code == CV_LRGB2Lab && scn == 4 && depth == CV_8U) { if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], (ippiGeneralFunc)ippiBGRToLab_8u_C3R, 2, 1, 0, depth))) return; + setIppErrorStatus(); } else if (code == CV_LRGB2Luv && scn == 3) { if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor(ippiRGBToLUVTab[depth]))) return; + setIppErrorStatus(); } else if (code == CV_LRGB2Luv && scn == 4) { if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGBToLUVTab[depth], 0, 1, 2, depth))) return; + setIppErrorStatus(); } else if (code == CV_LBGR2Luv && scn == 3) { if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC3RTab[depth], ippiRGBToLUVTab[depth], 2, 1, 0, depth))) return; + setIppErrorStatus(); } else if (code == CV_LBGR2Luv && scn == 4) { if (CvtColorIPPLoop(src, dst, IPPReorderGeneralFunctor(ippiSwapChannelsC4C3RTab[depth], ippiRGBToLUVTab[depth], 2, 1, 0, depth))) return; + setIppErrorStatus(); } #endif @@ -3949,24 +4010,28 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) { if( CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R)) ) return; + setIppErrorStatus(); } else if( code == CV_Lab2LBGR && dcn == 4 && depth == CV_8U ) { if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R, ippiSwapChannelsC3C4RTab[depth], 0, 1, 2, depth)) ) return; + setIppErrorStatus(); } if( code == CV_Lab2LRGB && dcn == 3 && depth == CV_8U ) { if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R, ippiSwapChannelsC3RTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } else if( code == CV_Lab2LRGB && dcn == 4 && depth == CV_8U ) { if( CvtColorIPPLoop(src, dst, IPPGeneralReorderFunctor((ippiGeneralFunc)ippiLabToBGR_8u_C3R, ippiSwapChannelsC3C4RTab[depth], 2, 1, 0, depth)) ) return; + setIppErrorStatus(); } #endif if( code == CV_Luv2LRGB && dcn == 3 ) @@ -4194,6 +4259,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn ) #if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) if (CvtColorIPPLoop(src, dst, IPPGeneralFunctor((ippiGeneralFunc)ippiAlphaPremul_8u_AC4R))) return; + setIppErrorStatus(); #endif CvtColorLoop(src, dst, RGBA2mRGBA()); } diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index 326f86c..8e79f2a 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -456,6 +456,7 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, Mat src = _src.getMat(), dst = _dst.getMat(); if (IPPDeriv(src, dst, ddepth, dx, dy, ksize,scale)) return; + setIppErrorStatus(); } #endif int ktype = std::max(CV_32F, std::max(ddepth, sdepth)); @@ -498,6 +499,7 @@ void cv::Scharr( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, Mat src = _src.getMat(), dst = _dst.getMat(); if(IPPDerivScharr(src, dst, ddepth, dx, dy, scale)) return; + setIppErrorStatus(); } #endif int ktype = std::max(CV_32F, std::max(ddepth, sdepth)); @@ -630,6 +632,7 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize, if (status >= 0) return; + setIppErrorStatus(); } } #undef IPP_FILTER_LAPLACIAN diff --git a/modules/imgproc/src/distransform.cpp b/modules/imgproc/src/distransform.cpp index 94a5592..7173fe3 100644 --- a/modules/imgproc/src/distransform.cpp +++ b/modules/imgproc/src/distransform.cpp @@ -752,6 +752,7 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe src.ptr(), (int)src.step, dst.ptr(), (int)dst.step, roi, _mask) >= 0 ) return; + setIppErrorStatus(); } #endif Mat zpix = src == 0; diff --git a/modules/imgproc/src/filter.cpp b/modules/imgproc/src/filter.cpp index 1af9e9d..a6ab7af 100644 --- a/modules/imgproc/src/filter.cpp +++ b/modules/imgproc/src/filter.cpp @@ -1488,7 +1488,10 @@ private: ippBorderRepl, borderValue[0], bufptr) < 0) || (cn == 3 && ippiFilterRowBorderPipeline_32f_C3R(src, step, &dst, roisz, _kx, _ksize, 0, ippBorderRepl, borderValue, bufptr) < 0)) + { + setIppErrorStatus(); return 0; + } return width - _ksize + 1; } #endif diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index ea73547..339546f 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -1255,6 +1255,7 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels, ihist.convertTo(hist, CV_32F); return; } + setIppErrorStatus(); } #endif diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 03a9d79..d4a74b6 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -2424,6 +2424,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, parallel_for_(range, invoker, dst.total()/(double)(1<<16)); if( ok ) return; + setIppErrorStatus(); } } #undef IPP_RESIZE_EPS @@ -4281,6 +4282,7 @@ void cv::warpAffine( InputArray _src, OutputArray _dst, parallel_for_(range, invoker, dst.total()/(double)(1<<16)); if( ok ) return; + setIppErrorStatus(); } #endif */ @@ -4524,6 +4526,7 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0, parallel_for_(range, invoker, dst.total()/(double)(1<<16)); if( ok ) return; + setIppErrorStatus(); } #endif */ diff --git a/modules/imgproc/src/moments.cpp b/modules/imgproc/src/moments.cpp index 8e07497..277600c 100644 --- a/modules/imgproc/src/moments.cpp +++ b/modules/imgproc/src/moments.cpp @@ -519,6 +519,7 @@ cv::Moments cv::moments( InputArray _src, bool binary ) } ippiMomentFree_64f(moment); } + setIppErrorStatus(); CV_SUPPRESS_DEPRECATED_END } #endif diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 5b13ffc..897d19e 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -1466,6 +1466,7 @@ static void morphOp( int op, InputArray _src, OutputArray _dst, #if IPP_VERSION_X100 >= 801 if( IPPMorphOp(op, _src, _dst, kernel, anchor, iterations, borderType, borderValue) ) return; + setIppErrorStatus(); #endif if (iterations == 0 || kernel.rows*kernel.cols == 1) diff --git a/modules/imgproc/src/samplers.cpp b/modules/imgproc/src/samplers.cpp index 197a7ce..d3edbbf 100644 --- a/modules/imgproc/src/samplers.cpp +++ b/modules/imgproc/src/samplers.cpp @@ -390,9 +390,13 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center, srctype == CV_8UC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_8u32f_C1R : srctype == CV_32FC1 && ddepth == CV_32F ? (ippiGetRectSubPixFunc)ippiCopySubpixIntersect_32f_C1R : 0; - if( ippfunc && ippfunc(image.data, (int)image.step, src_size, patch.data, - (int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 ) - return; + if( ippfunc) + { + if (ippfunc(image.data, (int)image.step, src_size, patch.data, + (int)patch.step, win_size, icenter, &minpt, &maxpt) >= 0 ) + return; + setIppErrorStatus(); + } #endif if( depth == CV_8U && ddepth == CV_8U ) diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index 4318cd1..300217b 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -888,6 +888,7 @@ void cv::boxFilter( InputArray _src, OutputArray _dst, int ddepth, if (status >= 0) \ return; \ } \ + setIppErrorStatus(); \ } while ((void)0, 0) if (stype == CV_8UC1) @@ -1193,6 +1194,7 @@ void cv::GaussianBlur( InputArray _src, OutputArray _dst, Size ksize, return; } } + setIppErrorStatus(); } #endif @@ -2033,6 +2035,7 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) if (status >= 0) \ return; \ } \ + setIppErrorStatus(); \ } \ while ((void)0, 0) @@ -2433,6 +2436,7 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d, parallel_for_(Range(0, dst.rows), body, dst.total()/(double)(1<<16)); if( ok ) return; + setIppErrorStatus(); } #endif diff --git a/modules/imgproc/src/sumpixels.cpp b/modules/imgproc/src/sumpixels.cpp index 6802916..b86e084 100755 --- a/modules/imgproc/src/sumpixels.cpp +++ b/modules/imgproc/src/sumpixels.cpp @@ -393,6 +393,7 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output } if (0 <= status) return; + setIppErrorStatus(); } #endif diff --git a/modules/imgproc/src/templmatch.cpp b/modules/imgproc/src/templmatch.cpp index 75ae2f7..91306ed 100644 --- a/modules/imgproc/src/templmatch.cpp +++ b/modules/imgproc/src/templmatch.cpp @@ -423,6 +423,12 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr, Size corrsize, int ctype, Point anchor, double delta, int borderType ) { +#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY + if (ipp_crossCorr(img, _templ, corr)) + return; + setIppErrorStatus(); +#endif + const double blockScale = 4.5; const int minBlockSize = 256; std::vector buf; @@ -639,8 +645,12 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result, #endif #if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY - if (method == CV_TM_SQDIFF && ipp_sqrDistance(img, templ, result)) - return; + if (method == CV_TM_SQDIFF) + { + if (ipp_sqrDistance(img, templ, result)) + return; + setIppErrorStatus(); + } #endif int cn = img.channels(); diff --git a/modules/imgproc/src/thresh.cpp b/modules/imgproc/src/thresh.cpp index 17f323a..c419989 100644 --- a/modules/imgproc/src/thresh.cpp +++ b/modules/imgproc/src/thresh.cpp @@ -75,14 +75,17 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type ) case THRESH_TRUNC: if (0 <= ippiThreshold_GT_8u_C1R(_src.data, (int)src_step, _dst.data, (int)dst_step, sz, thresh)) return; + setIppErrorStatus(); break; case THRESH_TOZERO: if (0 <= ippiThreshold_LTVal_8u_C1R(_src.data, (int)src_step, _dst.data, (int)dst_step, sz, thresh+1, 0)) return; + setIppErrorStatus(); break; case THRESH_TOZERO_INV: if (0 <= ippiThreshold_GTVal_8u_C1R(_src.data, (int)src_step, _dst.data, (int)dst_step, sz, thresh, 0)) return; + setIppErrorStatus(); break; } #endif @@ -313,14 +316,17 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type ) case THRESH_TRUNC: if (0 <= ippiThreshold_GT_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh)) return; + setIppErrorStatus(); break; case THRESH_TOZERO: if (0 <= ippiThreshold_LTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+1, 0)) return; + setIppErrorStatus(); break; case THRESH_TOZERO_INV: if (0 <= ippiThreshold_GTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0)) return; + setIppErrorStatus(); break; } #endif @@ -504,14 +510,17 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int 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)) return; + 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)) return; + 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)) return; + setIppErrorStatus(); break; } #endif