fixes
This commit is contained in:
parent
fe644ede19
commit
51e2a8ec96
@ -1089,20 +1089,24 @@ void cv::filterSpeckles( InputOutputArray _img, double _newval, int maxSpeckleSi
|
||||
IppiSize roisize = { img.cols, img.rows };
|
||||
IppDataType datatype = type == CV_8UC1 ? ipp8u : ipp16s;
|
||||
|
||||
if (!__buf.needed() && ippiMarkSpecklesGetBufferSize(roisize, datatype, CV_MAT_CN(type), &bufsize))
|
||||
if (!__buf.needed() && (type == CV_8UC1 || type == CV_16SC1))
|
||||
{
|
||||
IppStatus status = ippiMarkSpecklesGetBufferSize(roisize, datatype, CV_MAT_CN(type), &bufsize);
|
||||
Ipp8u * buffer = ippsMalloc_8u(bufsize);
|
||||
IppStatus status = (IppStatus)-1;
|
||||
|
||||
if (type == CV_8UC1)
|
||||
status = ippiMarkSpeckles_8u_C1IR((Ipp8u *)img.data, (int)img.step, roisize,
|
||||
(Ipp8u)newVal, maxSpeckleSize, (Ipp8u)maxDiff, ippiNormL1, buffer);
|
||||
else if (type == CV_16SC1)
|
||||
status = ippiMarkSpeckles_16s_C1IR((Ipp16s *)img.data, (int)img.step, roisize,
|
||||
(Ipp16s)newVal, maxSpeckleSize, (Ipp16s)maxDiff, ippiNormL1, buffer);
|
||||
if ((int)status >= 0)
|
||||
{
|
||||
if (type == CV_8UC1)
|
||||
status = ippiMarkSpeckles_8u_C1IR((Ipp8u *)img.data, (int)img.step, roisize,
|
||||
(Ipp8u)newVal, maxSpeckleSize, (Ipp8u)maxDiff, ippiNormL1, buffer);
|
||||
else
|
||||
status = ippiMarkSpeckles_16s_C1IR((Ipp16s *)img.data, (int)img.step, roisize,
|
||||
(Ipp16s)newVal, maxSpeckleSize, (Ipp16s)maxDiff, ippiNormL1, buffer);
|
||||
}
|
||||
|
||||
if (status >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -721,6 +721,7 @@ static void max64f( const double* src1, size_t step1,
|
||||
}
|
||||
if (i == sz.height)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
#endif
|
||||
vBinOp64<double, OpMax<double>, IF_SIMD(VMax<double>)>(src1, step1, src2, step2, dst, step, sz);
|
||||
}
|
||||
@ -841,6 +842,7 @@ static void min64f( const double* src1, size_t step1,
|
||||
}
|
||||
if (i == sz.height)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
#endif
|
||||
vBinOp64<double, OpMin<double>, IF_SIMD(VMin<double>)>(src1, step1, src2, step2, dst, step, sz);
|
||||
}
|
||||
@ -2013,9 +2015,12 @@ static void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t st
|
||||
{
|
||||
float fscale = (float)*(const double*)scale;
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON &&
|
||||
ippiMul_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||
return;
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||
{
|
||||
if (ippiMul_8u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||
}
|
||||
@ -2031,9 +2036,12 @@ static void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t
|
||||
{
|
||||
float fscale = (float)*(const double*)scale;
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON &&
|
||||
ippiMul_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||
return;
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||
{
|
||||
if (ippiMul_16u_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||
}
|
||||
@ -2043,9 +2051,12 @@ static void mul16s( const short* src1, size_t step1, const short* src2, size_t s
|
||||
{
|
||||
float fscale = (float)*(const double*)scale;
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON &&
|
||||
ippiMul_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||
return;
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||
{
|
||||
if (ippiMul_16s_C1RSfs(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz), 0) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||
}
|
||||
@ -2061,9 +2072,12 @@ static void mul32f( const float* src1, size_t step1, const float* src2, size_t s
|
||||
{
|
||||
float fscale = (float)*(const double*)scale;
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON &&
|
||||
ippiMul_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)) >= 0)
|
||||
return;
|
||||
if (std::fabs(fscale - 1) <= FLT_EPSILON)
|
||||
{
|
||||
if (ippiMul_32f_C1R(src1, (int)step1, src2, (int)step2, dst, (int)step, ippiSize(sz)) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ copyMask_<uchar>(const uchar* _src, size_t sstep, const uchar* mask, size_t mste
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if (ippiCopy_8u_C1MR(_src, (int)sstep, _dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
#endif
|
||||
|
||||
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
||||
@ -119,6 +120,7 @@ copyMask_<ushort>(const uchar* _src, size_t sstep, const uchar* mask, size_t mst
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if (ippiCopy_16u_C1MR((const Ipp16u *)_src, (int)sstep, (Ipp16u *)_dst, (int)dstep, ippiSize(size), mask, (int)mstep) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
#endif
|
||||
|
||||
for( ; size.height--; mask += mstep, _src += sstep, _dst += dstep )
|
||||
@ -182,6 +184,7 @@ static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask,
|
||||
{ \
|
||||
if (ippiCopy_##ippfavor((const ipptype *)src, (int)sstep, (ipptype *)dst, (int)dstep, ippiSize(size), (const Ipp8u *)mask, (int)mstep) >= 0) \
|
||||
return; \
|
||||
setIppErrorStatus(); \
|
||||
copyMask_<type>(src, sstep, mask, mstep, dst, dstep, size); \
|
||||
}
|
||||
#else
|
||||
@ -281,6 +284,7 @@ void Mat::copyTo( OutputArray _dst ) const
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if (ippiCopy_8u_C1R(sptr, (int)step, dptr, (int)dst.step, ippiSize((int)len, sz.height)) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
#endif
|
||||
|
||||
for( ; sz.height--; sptr += step, dptr += dst.step )
|
||||
@ -367,11 +371,13 @@ Mat& Mat::operator = (const Scalar& s)
|
||||
|
||||
if (ippsZero_8u(data, static_cast<int>(roisize.width * elemSize())) >= 0)
|
||||
return *this;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
roisize.width *= (int)elemSize();
|
||||
|
||||
if (ippiSet_8u_C1R(0, data, (int)step, roisize) >= 0)
|
||||
return *this;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -414,13 +420,16 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask)
|
||||
CV_Assert( mask.empty() || (mask.type() == CV_8U && size == mask.size) );
|
||||
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if (!mask.empty() && (dims <= 2 || (isContinuous() && mask.isContinuous())))
|
||||
int cn = channels(), depth0 = depth();
|
||||
|
||||
if (!mask.empty() && (dims <= 2 || (isContinuous() && mask.isContinuous())) &&
|
||||
(depth0 == CV_8U || depth0 == CV_16U || depth0 == CV_16S || depth0 == CV_32S || depth0 == CV_32F) &&
|
||||
(cn == 1 || cn == 3 || cn == 4))
|
||||
{
|
||||
uchar _buf[32];
|
||||
void * buf = _buf;
|
||||
convertAndUnrollScalar( value, type(), _buf, 1 );
|
||||
|
||||
int cn = channels(), depth0 = depth();
|
||||
IppStatus status = (IppStatus)-1;
|
||||
IppiSize roisize = { cols, rows };
|
||||
int mstep = (int)mask.step, dstep = (int)step;
|
||||
@ -444,13 +453,13 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask)
|
||||
else if (depth0 == CV_32F)
|
||||
status = ippiSet_32f_C1MR(*(Ipp32f *)buf, (Ipp32f *)data, dstep, roisize, mask.data, mstep);
|
||||
}
|
||||
else if (cn == 3 || cn == 3)
|
||||
else if (cn == 3 || cn == 4)
|
||||
{
|
||||
#define IPP_SET(ippfavor, ippcn) \
|
||||
do \
|
||||
{ \
|
||||
typedef Ipp##ippfavor ipptype; \
|
||||
ipptype ippvalue[4] = { ((ipptype *)buf)[0], ((ipptype *)buf)[1], ((ipptype *)buf)[2], ((ipptype *)buf)[4] }; \
|
||||
ipptype ippvalue[4] = { ((ipptype *)buf)[0], ((ipptype *)buf)[1], ((ipptype *)buf)[2], ((ipptype *)buf)[3] }; \
|
||||
status = ippiSet_##ippfavor##_C##ippcn##MR(ippvalue, (ipptype *)data, dstep, roisize, mask.data, mstep); \
|
||||
} while ((void)0, 0)
|
||||
|
||||
@ -481,6 +490,7 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask)
|
||||
|
||||
if (status >= 0)
|
||||
return *this;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -733,6 +743,7 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
|
||||
if( flip_mode <= 0 )
|
||||
flipVert( src.data, src.step, dst.data, dst.step, src.size(), esz );
|
||||
|
@ -3079,6 +3079,7 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
|
||||
if( dst.data == src.data )
|
||||
{
|
||||
|
@ -479,6 +479,7 @@ void cv::accumulate( InputArray _src, InputOutputArray _dst, InputArray _mask )
|
||||
|
||||
if (status >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -510,7 +510,10 @@ void cv::cornerHarris( InputArray _src, OutputArray _dst, int blockSize, int ksi
|
||||
|
||||
if (status >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
else
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user