cv::multiply

This commit is contained in:
Ilya Lavrenov
2014-04-14 18:42:21 +04:00
parent 9cc80a68db
commit fe644ede19
6 changed files with 41 additions and 74 deletions

View File

@@ -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,