mirror of
https://github.com/opencv/opencv.git
synced 2024-11-26 04:00:30 +08:00
cv::multiply
This commit is contained in:
parent
9cc80a68db
commit
fe644ede19
@ -1096,10 +1096,10 @@ void cv::filterSpeckles( InputOutputArray _img, double _newval, int maxSpeckleSi
|
||||
|
||||
if (type == CV_8UC1)
|
||||
status = ippiMarkSpeckles_8u_C1IR((Ipp8u *)img.data, (int)img.step, roisize,
|
||||
(Ipp8u)newVal, maxSpeckleSize, maxDiff, ippiNormL1, buffer);
|
||||
(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, maxDiff, ippiNormL1, buffer);
|
||||
(Ipp16s)newVal, maxSpeckleSize, (Ipp16s)maxDiff, ippiNormL1, buffer);
|
||||
|
||||
if (status >= 0)
|
||||
return;
|
||||
|
@ -705,7 +705,7 @@ static void max64f( const double* src1, size_t step1,
|
||||
const double* src2, size_t step2,
|
||||
double* dst, size_t step, Size sz, void* )
|
||||
{
|
||||
#if ARITHM_USE_IPP == 1
|
||||
#if ARITHM_USE_IPP == 1 && !defined HAVE_IPP_ICV_ONLY
|
||||
double* s1 = (double*)src1;
|
||||
double* s2 = (double*)src2;
|
||||
double* d = dst;
|
||||
@ -825,7 +825,7 @@ static void min64f( const double* src1, size_t step1,
|
||||
const double* src2, size_t step2,
|
||||
double* dst, size_t step, Size sz, void* )
|
||||
{
|
||||
#if ARITHM_USE_IPP == 1
|
||||
#if ARITHM_USE_IPP == 1 && !defined HAVE_IPP_ICV_ONLY
|
||||
double* s1 = (double*)src1;
|
||||
double* s2 = (double*)src2;
|
||||
double* d = dst;
|
||||
@ -2012,6 +2012,11 @@ static void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t st
|
||||
uchar* dst, size_t step, Size sz, void* scale)
|
||||
{
|
||||
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;
|
||||
#endif
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||
}
|
||||
|
||||
@ -2024,13 +2029,25 @@ static void mul8s( const schar* src1, size_t step1, const schar* src2, size_t st
|
||||
static void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2,
|
||||
ushort* dst, size_t step, Size sz, void* scale)
|
||||
{
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, (float)*(const double*)scale);
|
||||
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;
|
||||
#endif
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||
}
|
||||
|
||||
static void mul16s( const short* src1, size_t step1, const short* src2, size_t step2,
|
||||
short* dst, size_t step, Size sz, void* scale)
|
||||
{
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, (float)*(const double*)scale);
|
||||
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;
|
||||
#endif
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||
}
|
||||
|
||||
static void mul32s( const int* src1, size_t step1, const int* src2, size_t step2,
|
||||
@ -2042,7 +2059,13 @@ static void mul32s( const int* src1, size_t step1, const int* src2, size_t step2
|
||||
static void mul32f( const float* src1, size_t step1, const float* src2, size_t step2,
|
||||
float* dst, size_t step, Size sz, void* scale)
|
||||
{
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, (float)*(const double*)scale);
|
||||
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;
|
||||
#endif
|
||||
mul_(src1, step1, src2, step2, dst, step, sz, fscale);
|
||||
}
|
||||
|
||||
static void mul64f( const double* src1, size_t step1, const double* src2, size_t step2,
|
||||
|
@ -356,7 +356,7 @@ Mat& Mat::operator = (const Scalar& s)
|
||||
|
||||
if( is[0] == 0 && is[1] == 0 && is[2] == 0 && is[3] == 0 )
|
||||
{
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY && 0
|
||||
if (dims <= 2 || isContinuous())
|
||||
{
|
||||
IppiSize roisize = { cols, rows };
|
||||
@ -365,10 +365,10 @@ Mat& Mat::operator = (const Scalar& s)
|
||||
roisize.width = (int)total();
|
||||
roisize.height = 1;
|
||||
|
||||
if (ippsZero_8u(data, roisize.width * elemSize()) >= 0)
|
||||
if (ippsZero_8u(data, static_cast<int>(roisize.width * elemSize())) >= 0)
|
||||
return *this;
|
||||
}
|
||||
roisize.width *= elemSize();
|
||||
roisize.width *= (int)elemSize();
|
||||
|
||||
if (ippiSet_8u_C1R(0, data, (int)step, roisize) >= 0)
|
||||
return *this;
|
||||
@ -416,8 +416,9 @@ Mat& Mat::setTo(InputArray _value, InputArray _mask)
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if (!mask.empty() && (dims <= 2 || (isContinuous() && mask.isContinuous())))
|
||||
{
|
||||
uchar buf[32];
|
||||
convertAndUnrollScalar( value, type(), buf, 1 );
|
||||
uchar _buf[32];
|
||||
void * buf = _buf;
|
||||
convertAndUnrollScalar( value, type(), _buf, 1 );
|
||||
|
||||
int cn = channels(), depth0 = depth();
|
||||
IppStatus status = (IppStatus)-1;
|
||||
@ -678,6 +679,7 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
|
||||
|
||||
if (src.data == dst.data)
|
||||
{
|
||||
CV_SUPPRESS_DEPRECATED_START
|
||||
ippFuncI =
|
||||
type == CV_8UC1 ? (ippiMirrorI)ippiMirror_8u_C1IR :
|
||||
type == CV_8UC3 ? (ippiMirrorI)ippiMirror_8u_C3IR :
|
||||
@ -694,6 +696,7 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
|
||||
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
|
||||
{
|
||||
|
@ -3027,6 +3027,7 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
||||
|
||||
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 :
|
||||
@ -3043,6 +3044,7 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
||||
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
|
||||
{
|
||||
|
@ -389,7 +389,7 @@ static bool ocl_cornerMinEigenValVecs(InputArray _src, OutputArray _dst, int blo
|
||||
scale = 1.0 / scale;
|
||||
|
||||
UMat Dx, Dy;
|
||||
if (!extractCovData(_src, Dx, Dy, depth, (double)scale, aperture_size, borderType))
|
||||
if (!extractCovData(_src, Dx, Dy, depth, (float)scale, aperture_size, borderType))
|
||||
return false;
|
||||
|
||||
ocl::Kernel cornelKernel("corner", ocl::imgproc::corner_oclsrc,
|
||||
|
@ -483,67 +483,6 @@ void cv::Scharr( InputArray _src, OutputArray _dst, int ddepth, int dx, int dy,
|
||||
int dtype = CV_MAKETYPE(ddepth, cn);
|
||||
_dst.create( _src.size(), dtype );
|
||||
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
if ((ksize == 3 || ksize == 5) && ((borderType & BORDER_ISOLATED) == 0 || !_src.isSubmatrix()) &&
|
||||
((stype == CV_8UC1 && ddepth == CV_16S) || (ddepth == CV_32F && stype == CV_32FC1)))
|
||||
{
|
||||
int iscale = saturate_cast<int>(scale), idelta = saturate_cast<int>(delta);
|
||||
bool floatScale = std::fabs(scale - iscale) > DBL_EPSILON, needScale = iscale != 1;
|
||||
bool floatDelta = std::fabs(delta - idelta) > DBL_EPSILON, needDelta = delta != 0;
|
||||
int borderTypeNI = borderType & ~BORDER_ISOLATED;
|
||||
Mat src = _src.getMat(), dst = _dst.getMat();
|
||||
|
||||
if (src.data != dst.data)
|
||||
{
|
||||
Ipp32s bufsize;
|
||||
IppStatus status = (IppStatus)-1;
|
||||
IppiSize roisize = { src.cols, src.rows };
|
||||
IppiMaskSize masksize = ksize == 3 ? ippMskSize3x3 : ippMskSize5x5;
|
||||
IppiBorderType borderTypeIpp =
|
||||
borderTypeNI == BORDER_CONSTANT ? ippBorderConst :
|
||||
borderTypeNI == BORDER_WRAP ? ippBorderWrap :
|
||||
borderTypeNI == BORDER_REPLICATE ? ippBorderRepl :
|
||||
borderTypeNI == BORDER_REFLECT_101 ? ippBorderMirror :
|
||||
borderTypeNI == BORDER_REFLECT ? ippBorderMirrorR : (IppiBorderType)-1;
|
||||
|
||||
#define IPP_FILTER_LAPLACIAN(ippsrctype, ippdsttype, ippfavor) \
|
||||
do \
|
||||
{ \
|
||||
if (borderTypeIpp >= 0 && ippiFilterLaplacianGetBufferSize_##ippfavor##_C1R(roisize, masksize, &bufsize) >= 0) \
|
||||
{ \
|
||||
Ipp8u * buffer = ippsMalloc_8u(bufsize); \
|
||||
status = ippiFilterLaplacianBorder_##ippfavor##_C1R((const ippsrctype *)src.data, (int)src.step, (ippdsttype *)dst.data, \
|
||||
(int)dst.step, roisize, masksize, borderTypeIpp, 0, buffer); \
|
||||
ippsFree(buffer); \
|
||||
} \
|
||||
} while ((void)0, 0)
|
||||
|
||||
if (sdepth == CV_8U && ddepth == CV_16S && !floatScale && !floatDelta)
|
||||
{
|
||||
IPP_FILTER_LAPLACIAN(Ipp8u, Ipp16s, 8u16s);
|
||||
|
||||
if (needScale)
|
||||
status = ippiMulC_16s_C1IRSfs((Ipp16s)iscale, (Ipp16s *)dst.data, (int)dst.step, roisize, 0);
|
||||
if (needDelta)
|
||||
status = ippiAddC_16s_C1IRSfs((Ipp16s)idelta, (Ipp16s *)dst.data, (int)dst.step, roisize, 0);
|
||||
}
|
||||
else if (sdepth == CV_32F && ddepth == CV_32F)
|
||||
{
|
||||
IPP_FILTER_LAPLACIAN(Ipp32f, Ipp32f, 32f);
|
||||
|
||||
if (needScale)
|
||||
status = ippiMulC_32f_C1IR((Ipp32f)scale, (Ipp32f *)dst.data, (int)dst.step, roisize);
|
||||
if (needDelta)
|
||||
status = ippiAddC_32f_C1IR((Ipp32f)delta, (Ipp32f *)dst.data, (int)dst.step, roisize);
|
||||
}
|
||||
|
||||
if (status >= 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#undef IPP_FILTER_LAPLACIAN
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TEGRA_OPTIMIZATION
|
||||
if (scale == 1.0 && delta == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user