From: Ilya Lavrenov Date: Wed, 16 Apr 2014 15:45:35 +0000 (+0400) Subject: fixed some errors X-Git-Tag: submit/tizen_ivi/20141117.190038~2^2~460^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f9ca3d77cac2572b20c2a10bf272d652648e20a;p=profile%2Fivi%2Fopencv.git fixed some errors --- diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index f7256b8..966db71 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -939,7 +939,7 @@ void convertAndUnrollScalar( const Mat& sc, int buftype, uchar* scbuf, size_t bl { int scn = (int)sc.total(), cn = CV_MAT_CN(buftype); size_t esz = CV_ELEM_SIZE(buftype); - getConvertFunc(sc.depth(), buftype)(sc.data, 0, 0, 0, scbuf, 0, Size(std::min(cn, scn), 1), 0); + getConvertFunc(sc.depth(), buftype)(sc.data, 1, 0, 1, scbuf, 1, Size(std::min(cn, scn), 1), 0); // unroll the scalar if( scn < cn ) { @@ -1628,33 +1628,33 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, uchar* dptr = ptrs[2]; if( cvtsrc1 ) { - cvtsrc1( sptr1, 0, 0, 0, buf1, 0, bszn, 0 ); + cvtsrc1( sptr1, 1, 0, 1, buf1, 1, bszn, 0 ); sptr1 = buf1; } if( ptrs[0] == ptrs[1] ) sptr2 = sptr1; else if( cvtsrc2 ) { - cvtsrc2( sptr2, 0, 0, 0, buf2, 0, bszn, 0 ); + cvtsrc2( sptr2, 1, 0, 1, buf2, 1, bszn, 0 ); sptr2 = buf2; } if( !haveMask && !cvtdst ) - func( sptr1, 0, sptr2, 0, dptr, 0, bszn, usrdata ); + func( sptr1, 1, sptr2, 1, dptr, 1, bszn, usrdata ); else { - func( sptr1, 0, sptr2, 0, wbuf, 0, bszn, usrdata ); + func( sptr1, 1, sptr2, 1, wbuf, 0, bszn, usrdata ); if( !haveMask ) - cvtdst( wbuf, 0, 0, 0, dptr, 0, bszn, 0 ); + cvtdst( wbuf, 1, 0, 1, dptr, 1, bszn, 0 ); else if( !cvtdst ) { - copymask( wbuf, 0, ptrs[3], 0, dptr, 0, Size(bsz, 1), &dsz ); + copymask( wbuf, 1, ptrs[3], 1, dptr, 1, Size(bsz, 1), &dsz ); ptrs[3] += bsz; } else { - cvtdst( wbuf, 0, 0, 0, maskbuf, 0, bszn, 0 ); - copymask( maskbuf, 0, ptrs[3], 0, dptr, 0, Size(bsz, 1), &dsz ); + cvtdst( wbuf, 1, 0, 1, maskbuf, 1, bszn, 0 ); + copymask( maskbuf, 1, ptrs[3], 1, dptr, 1, Size(bsz, 1), &dsz ); ptrs[3] += bsz; } } @@ -1695,7 +1695,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, if( cvtsrc1 ) { - cvtsrc1( sptr1, 0, 0, 0, buf1, 0, bszn, 0 ); + cvtsrc1( sptr1, 1, 0, 1, buf1, 1, bszn, 0 ); sptr1 = buf1; } @@ -1703,21 +1703,21 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, std::swap(sptr1, sptr2); if( !haveMask && !cvtdst ) - func( sptr1, 0, sptr2, 0, dptr, 0, bszn, usrdata ); + func( sptr1, 1, sptr2, 1, dptr, 1, bszn, usrdata ); else { - func( sptr1, 0, sptr2, 0, wbuf, 0, bszn, usrdata ); + func( sptr1, 1, sptr2, 1, wbuf, 1, bszn, usrdata ); if( !haveMask ) - cvtdst( wbuf, 0, 0, 0, dptr, 0, bszn, 0 ); + cvtdst( wbuf, 1, 0, 1, dptr, 1, bszn, 0 ); else if( !cvtdst ) { - copymask( wbuf, 0, ptrs[2], 0, dptr, 0, Size(bsz, 1), &dsz ); + copymask( wbuf, 1, ptrs[2], 1, dptr, 1, Size(bsz, 1), &dsz ); ptrs[2] += bsz; } else { - cvtdst( wbuf, 0, 0, 0, maskbuf, 0, bszn, 0 ); - copymask( maskbuf, 0, ptrs[2], 0, dptr, 0, Size(bsz, 1), &dsz ); + cvtdst( wbuf, 1, 0, 1, maskbuf, 1, bszn, 0 ); + copymask( maskbuf, 1, ptrs[2], 1, dptr, 1, Size(bsz, 1), &dsz ); ptrs[2] += bsz; } } @@ -2712,7 +2712,7 @@ static bool ocl_compare(InputArray _src1, InputArray _src2, OutputArray _dst, in else { double fval = 0; - getConvertFunc(depth2, CV_64F)(src2.data, 0, 0, 0, (uchar *)&fval, 0, Size(1, 1), 0); + getConvertFunc(depth2, CV_64F)(src2.data, 1, 0, 1, (uchar *)&fval, 1, Size(1, 1), 0); if( fval < getMinVal(depth1) ) return dst.setTo(Scalar::all(op == CMP_GT || op == CMP_GE || op == CMP_NE ? 255 : 0)), true; @@ -2833,7 +2833,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op) else { double fval=0; - getConvertFunc(depth2, CV_64F)(src2.data, 0, 0, 0, (uchar*)&fval, 0, Size(1,1), 0); + getConvertFunc(depth2, CV_64F)(src2.data, 1, 0, 1, (uchar*)&fval, 1, Size(1,1), 0); if( fval < getMinVal(depth1) ) { dst = Scalar::all(op == CMP_GT || op == CMP_GE || op == CMP_NE ? 255 : 0); @@ -3060,8 +3060,8 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb, int* iubuf = ilbuf + cn; BinaryFunc sccvtfunc = getConvertFunc(ldepth, CV_32S); - sccvtfunc(lscalar.data, 0, 0, 0, (uchar*)ilbuf, 0, Size(cn, 1), 0); - sccvtfunc(uscalar.data, 0, 0, 0, (uchar*)iubuf, 0, Size(cn, 1), 0); + sccvtfunc(lscalar.data, 1, 0, 1, (uchar*)ilbuf, 1, Size(cn, 1), 0); + sccvtfunc(uscalar.data, 1, 0, 1, (uchar*)iubuf, 1, Size(cn, 1), 0); int minval = cvRound(getMinVal(sdepth)), maxval = cvRound(getMaxVal(sdepth)); for( int k = 0; k < cn; k++ ) @@ -3171,8 +3171,8 @@ void cv::inRange(InputArray _src, InputArray _lowerb, int* iubuf = ilbuf + cn; BinaryFunc sccvtfunc = getConvertFunc(scdepth, CV_32S); - sccvtfunc(lb.data, 0, 0, 0, (uchar*)ilbuf, 0, Size(cn, 1), 0); - sccvtfunc(ub.data, 0, 0, 0, (uchar*)iubuf, 0, Size(cn, 1), 0); + sccvtfunc(lb.data, 1, 0, 1, (uchar*)ilbuf, 1, Size(cn, 1), 0); + sccvtfunc(ub.data, 1, 0, 1, (uchar*)iubuf, 1, Size(cn, 1), 0); int minval = cvRound(getMinVal(depth)), maxval = cvRound(getMaxVal(depth)); for( int k = 0; k < cn; k++ ) diff --git a/modules/core/src/matmul.cpp b/modules/core/src/matmul.cpp index fb23d1c..df42dac 100644 --- a/modules/core/src/matmul.cpp +++ b/modules/core/src/matmul.cpp @@ -2223,14 +2223,6 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray if (src1.isContinuous() && src2.isContinuous() && dst.isContinuous()) { size_t len = src1.total()*cn; -#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY - if (depth == CV_32F && - ippmSaxpy_vava_32f((const Ipp32f *)src1.data, (int)src1.step, sizeof(Ipp32f), falpha, - (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; } diff --git a/modules/imgproc/src/deriv.cpp b/modules/imgproc/src/deriv.cpp index 8e79f2a..c6885d4 100644 --- a/modules/imgproc/src/deriv.cpp +++ b/modules/imgproc/src/deriv.cpp @@ -201,7 +201,7 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy, switch(src.type()) { - case CV_8U: + case CV_8UC1: { if(scale != 1) return false; @@ -232,14 +232,14 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy, return false; } } - case CV_32F: + case CV_32FC1: #if defined(HAVE_IPP_ICV_ONLY) // N/A: ippiMulC_32f_C1R return false; #else { switch(dst.type()) { - case CV_32F: + case CV_32FC1: { if ((dx == 1) && (dy == 0)) { @@ -289,67 +289,64 @@ static bool IPPDerivScharr(const Mat& src, Mat& dst, int ddepth, int dx, int dy, static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int ksize, double scale) { - int bufSize = 0; + int stype = src.type(), dtype = dst.type(), bufSize = 0; cv::AutoBuffer buffer; if (ksize == 3 || ksize == 5) { - if ( ddepth < 0 ) - ddepth = src.depth(); - - if (src.type() == CV_8U && dst.type() == CV_16S && scale == 1) + if (stype == CV_8UC1 && dtype == CV_16SC1 && scale == 1) { - if ((dx == 1) && (dy == 0)) + if (dx == 1 && dy == 0) { if (0 > ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) return false; buffer.allocate(bufSize); - return (0 <= ippiFilterSobelNegVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + return 0 <= ippiFilterSobelNegVertBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), - ippBorderRepl, 0, (Ipp8u*)(char*)buffer)); + ippBorderRepl, 0, (Ipp8u*)(char*)buffer); } - if ((dx == 0) && (dy == 1)) + if (dx == 0 && dy == 1) { if (0 > ippiFilterSobelHorizGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) return false; buffer.allocate(bufSize); - return (0 <= ippiFilterSobelHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + return 0 <= ippiFilterSobelHorizBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), - ippBorderRepl, 0, (Ipp8u*)(char*)buffer)); + ippBorderRepl, 0, (Ipp8u*)(char*)buffer); } - if ((dx == 2) && (dy == 0)) + if (dx == 2 && dy == 0) { if (0 > ippiFilterSobelVertSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) return false; buffer.allocate(bufSize); - return (0 <= ippiFilterSobelVertSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + return 0 <= ippiFilterSobelVertSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), - ippBorderRepl, 0, (Ipp8u*)(char*)buffer)); + ippBorderRepl, 0, (Ipp8u*)(char*)buffer); } - if ((dx == 0) && (dy == 2)) + if (dx == 0 && dy == 2) { if (0 > ippiFilterSobelHorizSecondGetBufferSize_8u16s_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) return false; buffer.allocate(bufSize); - return (0 <= ippiFilterSobelHorizSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, + return 0 <= ippiFilterSobelHorizSecondBorder_8u16s_C1R((const Ipp8u*)src.data, (int)src.step, (Ipp16s*)dst.data, (int)dst.step, ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), - ippBorderRepl, 0, (Ipp8u*)(char*)buffer)); + ippBorderRepl, 0, (Ipp8u*)(char*)buffer); } } - if (src.type() == CV_32F && dst.type() == CV_32F) + if (stype == CV_32FC1 && dtype == CV_32FC1) { #if defined(HAVE_IPP_ICV_ONLY) // N/A: ippiMulC_32f_C1R return false; #else #if 0 - if ((dx == 1) && (dy == 0)) + if (dx == 1 && dy == 0) { if (0 > ippiFilterSobelNegVertGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize), &bufSize)) return false; @@ -366,7 +363,7 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k return true; } - if ((dx == 0) && (dy == 1)) + if (dx == 0 && dy == 1) { if (0 > ippiFilterSobelHorizGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) return false; @@ -384,7 +381,7 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k } #endif - if((dx == 2) && (dy == 0)) + if(dx == 2 && dy == 0) { if (0 > ippiFilterSobelVertSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) return false; @@ -401,7 +398,7 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k return true; } - if((dx == 0) && (dy == 2)) + if(dx == 0 && dy == 2) { if (0 > ippiFilterSobelHorizSecondGetBufferSize_32f_C1R(ippiSize(src.cols, src.rows), (IppiMaskSize)(ksize*10+ksize),&bufSize)) return false; @@ -422,7 +419,7 @@ static bool IPPDeriv(const Mat& src, Mat& dst, int ddepth, int dx, int dy, int k } } - if(ksize <= 0) + if (ksize <= 0) return IPPDerivScharr(src, dst, ddepth, dx, dy, scale); return false; } @@ -437,7 +434,8 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype); if (ddepth < 0) ddepth = sdepth; - _dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) ); + int dtype = CV_MAKE_TYPE(ddepth, cn); + _dst.create( _src.size(), dtype ); #ifdef HAVE_TEGRA_OPTIMIZATION if (scale == 1.0 && delta == 0) @@ -451,12 +449,12 @@ void cv::Sobel( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, #endif #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - if(dx < 3 && dy < 3 && cn == 1 && borderType == BORDER_REPLICATE) + if (dx < 3 && dy < 3 && cn == 1 && borderType == BORDER_REPLICATE && + ((stype == CV_8UC1 && dtype == CV_16SC1) || (stype == CV_32FC1 && dtype == CV_32FC1))) { 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)); @@ -482,7 +480,8 @@ void cv::Scharr( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, int stype = _src.type(), sdepth = CV_MAT_DEPTH(stype), cn = CV_MAT_CN(stype); if (ddepth < 0) ddepth = sdepth; - _dst.create( _src.size(), CV_MAKETYPE(ddepth, cn) ); + int dtype = CV_MAKETYPE(ddepth, cn); + _dst.create( _src.size(), dtype ); #ifdef HAVE_TEGRA_OPTIMIZATION if (scale == 1.0 && delta == 0) @@ -494,7 +493,8 @@ void cv::Scharr( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy, #endif #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - if(dx < 2 && dy < 2 && _src.channels() == 1 && borderType == 1) + if(dx < 2 && dy < 2 && borderType == BORDER_REPLICATE && + ((stype == CV_8UC1 && dtype == CV_16SC1) || (stype == CV_32FC1 && dtype == CV_32FC1))) { Mat src = _src.getMat(), dst = _dst.getMat(); if(IPPDerivScharr(src, dst, ddepth, dx, dy, scale))