Prepare codes for ippicv library

This commit is contained in:
vbystricky
2014-03-21 15:27:56 +04:00
parent c2f859569c
commit 01a66a2938
19 changed files with 913 additions and 748 deletions

View File

@@ -812,8 +812,6 @@ typedef union
}
DBLINT;
#ifndef HAVE_IPP
#define EXPTAB_SCALE 6
#define EXPTAB_MASK ((1 << EXPTAB_SCALE) - 1)
@@ -898,7 +896,7 @@ static const double exp_prescale = 1.4426950408889634073599246810019 * (1 << EXP
static const double exp_postscale = 1./(1 << EXPTAB_SCALE);
static const double exp_max_val = 3000.*(1 << EXPTAB_SCALE); // log10(DBL_MAX) < 3000
static void Exp_32f( const float *_x, float *y, int n )
static void Exp_32fnoipp( const float *_x, float *y, int n )
{
static const float
A4 = (float)(1.000000000000002438532970795181890933776 / EXPPOLY_32F_A0),
@@ -1098,7 +1096,7 @@ static void Exp_32f( const float *_x, float *y, int n )
}
static void Exp_64f( const double *_x, double *y, int n )
static void Exp_64fnoipp( const double *_x, double *y, int n )
{
static const double
A5 = .99999999999999999998285227504999 / EXPPOLY_32F_A0,
@@ -1275,13 +1273,26 @@ static void Exp_64f( const double *_x, double *y, int n )
#undef EXPTAB_MASK
#undef EXPPOLY_32F_A0
#ifdef HAVE_IPP
static void Exp_32f(const float *x, float *y, int n)
{
if (ippStsNoErr == ippicvsExp_32f_A21(x, y, n))
return;
Exp_32fnoipp(x, y, n);
}
static void Exp_64f(const double *x, double *y, int n)
{
if (ippStsNoErr == ippicvsExp_64f_A50(x, y, n))
return;
Exp_64fnoipp(x, y, n);
}
#else
#define Exp_32f ippsExp_32f_A21
#define Exp_64f ippsExp_64f_A50
#define Exp_32f Exp_32fnoipp
#define Exp_64f Exp_64fnoipp
#endif
void exp( InputArray _src, OutputArray _dst )
{
int type = _src.type(), depth = _src.depth(), cn = _src.channels();
@@ -1302,9 +1313,9 @@ void exp( InputArray _src, OutputArray _dst )
for( size_t i = 0; i < it.nplanes; i++, ++it )
{
if( depth == CV_32F )
Exp_32f( (const float*)ptrs[0], (float*)ptrs[1], len );
Exp_32f((const float*)ptrs[0], (float*)ptrs[1], len);
else
Exp_64f( (const double*)ptrs[0], (double*)ptrs[1], len );
Exp_64f((const double*)ptrs[0], (double*)ptrs[1], len);
}
}
@@ -1313,8 +1324,6 @@ void exp( InputArray _src, OutputArray _dst )
* L O G *
\****************************************************************************************/
#ifndef HAVE_IPP
#define LOGTAB_SCALE 8
#define LOGTAB_MASK ((1 << LOGTAB_SCALE) - 1)
#define LOGTAB_MASK2 ((1 << (20 - LOGTAB_SCALE)) - 1)
@@ -1584,7 +1593,7 @@ static const double CV_DECL_ALIGNED(16) icvLogTab[] = {
#define LOGTAB_TRANSLATE(x,h) (((x) - 1.)*icvLogTab[(h)+1])
static const double ln_2 = 0.69314718055994530941723212145818;
static void Log_32f( const float *_x, float *y, int n )
static void Log_32fnoipp( const float *_x, float *y, int n )
{
static const float shift[] = { 0, -1.f/512 };
static const float
@@ -1733,7 +1742,7 @@ static void Log_32f( const float *_x, float *y, int n )
}
static void Log_64f( const double *x, double *y, int n )
static void Log_64fnoipp( const double *x, double *y, int n )
{
static const double shift[] = { 0, -1./512 };
static const double
@@ -1922,11 +1931,23 @@ static void Log_64f( const double *x, double *y, int n )
}
}
#ifdef HAVE_IPP
static void Log_32f(const float *x, float *y, int n)
{
if (ippStsNoErr == ippicvsLn_32f_A21(x, y, n))
return;
Log_32fnoipp(x, y, n);
}
static void Log_64f(const double *x, double *y, int n)
{
if (ippStsNoErr == ippicvsLn_64f_A50(x, y, n))
return;
Log_64fnoipp(x, y, n);
}
#else
#define Log_32f ippsLn_32f_A21
#define Log_64f ippsLn_64f_A50
#define Log_32f Log_32fnoipp
#define Log_64f Log_64fnoipp
#endif
void log( InputArray _src, OutputArray _dst )