|
|
@ -44,8 +44,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
using namespace std; |
|
|
|
using namespace std; |
|
|
|
|
|
|
|
|
|
|
|
#undef HAVE_IPP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace { |
|
|
|
namespace { |
|
|
|
|
|
|
|
|
|
|
|
static const float atan2_p1 = 0.9997878412794807f*(float)(180/CV_PI); |
|
|
|
static const float atan2_p1 = 0.9997878412794807f*(float)(180/CV_PI); |
|
|
@ -224,18 +222,7 @@ void fastAtan2(const float *Y, const float *X, float *angle, int len, bool angle |
|
|
|
void magnitude32f(const float* x, const float* y, float* mag, int len) |
|
|
|
void magnitude32f(const float* x, const float* y, float* mag, int len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(magnitude32f, cv_hal_magnitude32f, x, y, mag, len); |
|
|
|
CALL_HAL(magnitude32f, cv_hal_magnitude32f, x, y, mag, len); |
|
|
|
#if defined HAVE_IPP |
|
|
|
CV_IPP_RUN_FAST(ippsMagnitude_32f(x, y, mag, len) >= 0); |
|
|
|
CV_IPP_CHECK() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IppStatus status = ippsMagnitude_32f(x, y, mag, len); |
|
|
|
|
|
|
|
if (status >= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setIppErrorStatus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0; |
|
|
|
int i = 0; |
|
|
|
|
|
|
|
|
|
|
@ -261,18 +248,7 @@ void magnitude32f(const float* x, const float* y, float* mag, int len) |
|
|
|
void magnitude64f(const double* x, const double* y, double* mag, int len) |
|
|
|
void magnitude64f(const double* x, const double* y, double* mag, int len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(magnitude64f, cv_hal_magnitude64f, x, y, mag, len); |
|
|
|
CALL_HAL(magnitude64f, cv_hal_magnitude64f, x, y, mag, len); |
|
|
|
#if defined(HAVE_IPP) |
|
|
|
CV_IPP_RUN_FAST(ippsMagnitude_64f(x, y, mag, len) >= 0); |
|
|
|
CV_IPP_CHECK() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IppStatus status = ippsMagnitude_64f(x, y, mag, len); |
|
|
|
|
|
|
|
if (status >= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setIppErrorStatus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0; |
|
|
|
int i = 0; |
|
|
|
|
|
|
|
|
|
|
@ -299,17 +275,7 @@ void magnitude64f(const double* x, const double* y, double* mag, int len) |
|
|
|
void invSqrt32f(const float* src, float* dst, int len) |
|
|
|
void invSqrt32f(const float* src, float* dst, int len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(invSqrt32f, cv_hal_invSqrt32f, src, dst, len); |
|
|
|
CALL_HAL(invSqrt32f, cv_hal_invSqrt32f, src, dst, len); |
|
|
|
#if defined(HAVE_IPP) |
|
|
|
CV_IPP_RUN_FAST(ippsInvSqrt_32f_A21(src, dst, len) >= 0); |
|
|
|
CV_IPP_CHECK() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (ippsInvSqrt_32f_A21(src, dst, len) >= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setIppErrorStatus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0; |
|
|
|
int i = 0; |
|
|
|
|
|
|
|
|
|
|
@ -331,6 +297,8 @@ void invSqrt32f(const float* src, float* dst, int len) |
|
|
|
void invSqrt64f(const double* src, double* dst, int len) |
|
|
|
void invSqrt64f(const double* src, double* dst, int len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(invSqrt64f, cv_hal_invSqrt64f, src, dst, len); |
|
|
|
CALL_HAL(invSqrt64f, cv_hal_invSqrt64f, src, dst, len); |
|
|
|
|
|
|
|
CV_IPP_RUN_FAST(ippsInvSqrt_64f_A50(src, dst, len) >= 0); |
|
|
|
|
|
|
|
|
|
|
|
int i = 0; |
|
|
|
int i = 0; |
|
|
|
|
|
|
|
|
|
|
|
#if CV_SSE2 |
|
|
|
#if CV_SSE2 |
|
|
@ -347,17 +315,7 @@ void invSqrt64f(const double* src, double* dst, int len) |
|
|
|
void sqrt32f(const float* src, float* dst, int len) |
|
|
|
void sqrt32f(const float* src, float* dst, int len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(sqrt32f, cv_hal_sqrt32f, src, dst, len); |
|
|
|
CALL_HAL(sqrt32f, cv_hal_sqrt32f, src, dst, len); |
|
|
|
#if defined(HAVE_IPP) |
|
|
|
CV_IPP_RUN_FAST(ippsSqrt_32f_A21(src, dst, len) >= 0); |
|
|
|
CV_IPP_CHECK() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (ippsSqrt_32f_A21(src, dst, len) >= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setIppErrorStatus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0; |
|
|
|
int i = 0; |
|
|
|
|
|
|
|
|
|
|
@ -379,17 +337,7 @@ void sqrt32f(const float* src, float* dst, int len) |
|
|
|
void sqrt64f(const double* src, double* dst, int len) |
|
|
|
void sqrt64f(const double* src, double* dst, int len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(sqrt64f, cv_hal_sqrt64f, src, dst, len); |
|
|
|
CALL_HAL(sqrt64f, cv_hal_sqrt64f, src, dst, len); |
|
|
|
#if defined(HAVE_IPP) |
|
|
|
CV_IPP_RUN_FAST(ippsSqrt_64f_A50(src, dst, len) >= 0); |
|
|
|
CV_IPP_CHECK() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (ippsSqrt_64f_A50(src, dst, len) >= 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CV_IMPL_ADD(CV_IMPL_IPP); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setIppErrorStatus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0; |
|
|
|
int i = 0; |
|
|
|
|
|
|
|
|
|
|
@ -511,6 +459,8 @@ static const double exp_max_val = 3000.*(1 << EXPTAB_SCALE); // log10(DBL_MAX) < |
|
|
|
void exp32f( const float *_x, float *y, int n ) |
|
|
|
void exp32f( const float *_x, float *y, int n ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(exp32f, cv_hal_exp32f, _x, y, n); |
|
|
|
CALL_HAL(exp32f, cv_hal_exp32f, _x, y, n); |
|
|
|
|
|
|
|
CV_IPP_RUN_FAST(ippsExp_32f_A21(_x, y, n) >= 0); |
|
|
|
|
|
|
|
|
|
|
|
static const float |
|
|
|
static const float |
|
|
|
A4 = (float)(1.000000000000002438532970795181890933776 / EXPPOLY_32F_A0), |
|
|
|
A4 = (float)(1.000000000000002438532970795181890933776 / EXPPOLY_32F_A0), |
|
|
|
A3 = (float)(.6931471805521448196800669615864773144641 / EXPPOLY_32F_A0), |
|
|
|
A3 = (float)(.6931471805521448196800669615864773144641 / EXPPOLY_32F_A0), |
|
|
@ -711,6 +661,8 @@ void exp32f( const float *_x, float *y, int n ) |
|
|
|
void exp64f( const double *_x, double *y, int n ) |
|
|
|
void exp64f( const double *_x, double *y, int n ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(exp64f, cv_hal_exp64f, _x, y, n); |
|
|
|
CALL_HAL(exp64f, cv_hal_exp64f, _x, y, n); |
|
|
|
|
|
|
|
CV_IPP_RUN_FAST(ippsExp_64f_A50(_x, y, n) >= 0); |
|
|
|
|
|
|
|
|
|
|
|
static const double |
|
|
|
static const double |
|
|
|
A5 = .99999999999999999998285227504999 / EXPPOLY_32F_A0, |
|
|
|
A5 = .99999999999999999998285227504999 / EXPPOLY_32F_A0, |
|
|
|
A4 = .69314718055994546743029643825322 / EXPPOLY_32F_A0, |
|
|
|
A4 = .69314718055994546743029643825322 / EXPPOLY_32F_A0, |
|
|
@ -1156,6 +1108,8 @@ static const double ln_2 = 0.69314718055994530941723212145818; |
|
|
|
void log32f( const float *_x, float *y, int n ) |
|
|
|
void log32f( const float *_x, float *y, int n ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(log32f, cv_hal_log32f, _x, y, n); |
|
|
|
CALL_HAL(log32f, cv_hal_log32f, _x, y, n); |
|
|
|
|
|
|
|
CV_IPP_RUN_FAST(ippsLn_32f_A21(_x, y, n) >= 0); |
|
|
|
|
|
|
|
|
|
|
|
static const float shift[] = { 0, -1.f/512 }; |
|
|
|
static const float shift[] = { 0, -1.f/512 }; |
|
|
|
static const float |
|
|
|
static const float |
|
|
|
A0 = 0.3333333333333333333333333f, |
|
|
|
A0 = 0.3333333333333333333333333f, |
|
|
@ -1301,6 +1255,8 @@ void log32f( const float *_x, float *y, int n ) |
|
|
|
void log64f( const double *x, double *y, int n ) |
|
|
|
void log64f( const double *x, double *y, int n ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CALL_HAL(log64f, cv_hal_log64f, x, y, n); |
|
|
|
CALL_HAL(log64f, cv_hal_log64f, x, y, n); |
|
|
|
|
|
|
|
CV_IPP_RUN_FAST(ippsLn_64f_A50(x, y, n) >= 0); |
|
|
|
|
|
|
|
|
|
|
|
static const double shift[] = { 0, -1./512 }; |
|
|
|
static const double shift[] = { 0, -1./512 }; |
|
|
|
static const double |
|
|
|
static const double |
|
|
|
A7 = 1.0, |
|
|
|
A7 = 1.0, |
|
|
|