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
}
if (i == sz.height)
return;
+ setIppErrorStatus();
#endif
vBinOp64<double, OpMax<double>, IF_SIMD(VMax<double>)>(src1, step1, src2, step2, dst, step, sz);
}
}
if (i == sz.height)
return;
+ setIppErrorStatus();
#endif
vBinOp64<double, OpMin<double>, IF_SIMD(VMin<double>)>(src1, step1, src2, step2, dst, step, sz);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
#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 )
#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 )
{ \
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
#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 )
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
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;
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)
if (status >= 0)
return *this;
+ setIppErrorStatus();
}
#endif
return;
setIppErrorStatus();
}
+#endif
if( flip_mode <= 0 )
flipVert( src.data, src.step, dst.data, dst.step, src.size(), esz );
return;
setIppErrorStatus();
}
+#endif
if( dst.data == src.data )
{
if (status >= 0)
return;
+ setIppErrorStatus();
}
}
#endif
if (status >= 0)
return;
+ setIppErrorStatus();
}
+ else
+ setIppErrorStatus();
}
#endif