cosmetic changes, removed trailing spaces. Added ippGetCpuClocks if IPP is available (important for 64-bit build)
This commit is contained in:
@@ -92,16 +92,16 @@ struct HWFeatures
|
|||||||
{
|
{
|
||||||
enum { MAX_FEATURE = CV_HARDWARE_MAX_FEATURE };
|
enum { MAX_FEATURE = CV_HARDWARE_MAX_FEATURE };
|
||||||
|
|
||||||
HWFeatures()
|
HWFeatures(void)
|
||||||
{
|
{
|
||||||
memset( have, 0, sizeof(have) );
|
memset( have, 0, sizeof(have) );
|
||||||
x86_family = 0;
|
x86_family = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HWFeatures initialize()
|
static HWFeatures initialize(void)
|
||||||
{
|
{
|
||||||
HWFeatures f;
|
HWFeatures f;
|
||||||
int cpuid_data[4]={0,0,0,0};
|
int cpuid_data[4] = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
#if defined _MSC_VER && (defined _M_IX86 || defined _M_X64)
|
#if defined _MSC_VER && (defined _M_IX86 || defined _M_X64)
|
||||||
__cpuid(cpuid_data, 1);
|
__cpuid(cpuid_data, 1);
|
||||||
@@ -163,7 +163,7 @@ volatile bool useOptimizedFlag = true;
|
|||||||
|
|
||||||
struct IPPInitializer
|
struct IPPInitializer
|
||||||
{
|
{
|
||||||
IPPInitializer() { ippStaticInit(); }
|
IPPInitializer(void) { ippStaticInit(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
IPPInitializer ippInitializer;
|
IPPInitializer ippInitializer;
|
||||||
@@ -177,12 +177,12 @@ void setUseOptimized( bool flag )
|
|||||||
currentFeatures = flag ? &featuresEnabled : &featuresDisabled;
|
currentFeatures = flag ? &featuresEnabled : &featuresDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool useOptimized()
|
bool useOptimized(void)
|
||||||
{
|
{
|
||||||
return useOptimizedFlag;
|
return useOptimizedFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64 getTickCount()
|
int64 getTickCount(void)
|
||||||
{
|
{
|
||||||
#if defined WIN32 || defined _WIN32 || defined WINCE
|
#if defined WIN32 || defined _WIN32 || defined WINCE
|
||||||
LARGE_INTEGER counter;
|
LARGE_INTEGER counter;
|
||||||
@@ -202,7 +202,7 @@ int64 getTickCount()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
double getTickFrequency()
|
double getTickFrequency(void)
|
||||||
{
|
{
|
||||||
#if defined WIN32 || defined _WIN32 || defined WINCE
|
#if defined WIN32 || defined _WIN32 || defined WINCE
|
||||||
LARGE_INTEGER freq;
|
LARGE_INTEGER freq;
|
||||||
@@ -246,7 +246,7 @@ int64 getCPUTickCount(void)
|
|||||||
|
|
||||||
int64 getCPUTickCount(void)
|
int64 getCPUTickCount(void)
|
||||||
{
|
{
|
||||||
int64 result=0;
|
int64 result = 0;
|
||||||
unsigned upper, lower, tmp;
|
unsigned upper, lower, tmp;
|
||||||
__asm__ volatile(
|
__asm__ volatile(
|
||||||
"0: \n"
|
"0: \n"
|
||||||
@@ -276,10 +276,17 @@ int64 getCPUTickCount(void)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int64 getCPUTickCount()
|
#ifdef HAVE_IPP
|
||||||
|
int64 getCPUTickCount(void)
|
||||||
|
{
|
||||||
|
return ippGetCpuClocks();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int64 getCPUTickCount(void)
|
||||||
{
|
{
|
||||||
return getTickCount();
|
return getTickCount();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -368,11 +375,13 @@ void error( const Exception& exc )
|
|||||||
fprintf( stderr, "%s\n", buf );
|
fprintf( stderr, "%s\n", buf );
|
||||||
fflush( stderr );
|
fflush( stderr );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(breakOnError)
|
if(breakOnError)
|
||||||
{
|
{
|
||||||
static volatile int* p = 0;
|
static volatile int* p = 0;
|
||||||
*p = 0;
|
*p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw exc;
|
throw exc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +390,9 @@ redirectError( CvErrorCallback errCallback, void* userdata, void** prevUserdata)
|
|||||||
{
|
{
|
||||||
if( prevUserdata )
|
if( prevUserdata )
|
||||||
*prevUserdata = customErrorCallbackData;
|
*prevUserdata = customErrorCallbackData;
|
||||||
|
|
||||||
CvErrorCallback prevCallback = customErrorCallback;
|
CvErrorCallback prevCallback = customErrorCallback;
|
||||||
|
|
||||||
customErrorCallback = errCallback;
|
customErrorCallback = errCallback;
|
||||||
customErrorCallbackData = userdata;
|
customErrorCallbackData = userdata;
|
||||||
|
|
||||||
@@ -546,7 +557,7 @@ CV_IMPL int cvSetErrMode(int)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CV_IMPL int cvGetErrStatus()
|
CV_IMPL int cvGetErrStatus(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -573,7 +584,7 @@ cvErrorFromIppStatus( int status )
|
|||||||
case CV_BADMEMBLOCK_ERR: return CV_StsBadMemBlock;
|
case CV_BADMEMBLOCK_ERR: return CV_StsBadMemBlock;
|
||||||
case CV_NULLPTR_ERR: return CV_StsNullPtr;
|
case CV_NULLPTR_ERR: return CV_StsNullPtr;
|
||||||
case CV_DIV_BY_ZERO_ERR: return CV_StsDivByZero;
|
case CV_DIV_BY_ZERO_ERR: return CV_StsDivByZero;
|
||||||
case CV_BADSTEP_ERR: return CV_BadStep ;
|
case CV_BADSTEP_ERR: return CV_BadStep;
|
||||||
case CV_OUTOFMEM_ERR: return CV_StsNoMem;
|
case CV_OUTOFMEM_ERR: return CV_StsNoMem;
|
||||||
case CV_BADARG_ERR: return CV_StsBadArg;
|
case CV_BADARG_ERR: return CV_StsBadArg;
|
||||||
case CV_NOTDEFINED_ERR: return CV_StsError;
|
case CV_NOTDEFINED_ERR: return CV_StsError;
|
||||||
@@ -590,13 +601,14 @@ cvErrorFromIppStatus( int status )
|
|||||||
case CV_BADFACTOR_ERR: return CV_StsBadArg;
|
case CV_BADFACTOR_ERR: return CV_StsBadArg;
|
||||||
case CV_BADPOINT_ERR: return CV_StsBadPoint;
|
case CV_BADPOINT_ERR: return CV_StsBadPoint;
|
||||||
|
|
||||||
default: return CV_StsError;
|
default:
|
||||||
|
return CV_StsError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CvModuleInfo cxcore_info = { 0, "cxcore", CV_VERSION, 0 };
|
static CvModuleInfo cxcore_info = { 0, "cxcore", CV_VERSION, 0 };
|
||||||
|
|
||||||
CvModuleInfo *CvModule::first = 0, *CvModule::last = 0;
|
CvModuleInfo* CvModule::first = 0, *CvModule::last = 0;
|
||||||
|
|
||||||
CvModule::CvModule( CvModuleInfo* _info )
|
CvModule::CvModule( CvModuleInfo* _info )
|
||||||
{
|
{
|
||||||
@@ -604,19 +616,23 @@ CvModule::CvModule( CvModuleInfo* _info )
|
|||||||
info = last;
|
info = last;
|
||||||
}
|
}
|
||||||
|
|
||||||
CvModule::~CvModule()
|
CvModule::~CvModule(void)
|
||||||
{
|
{
|
||||||
if( info )
|
if( info )
|
||||||
{
|
{
|
||||||
CvModuleInfo* p = first;
|
CvModuleInfo* p = first;
|
||||||
for( ; p != 0 && p->next != info; p = p->next )
|
for( ; p != 0 && p->next != info; p = p->next )
|
||||||
;
|
;
|
||||||
|
|
||||||
if( p )
|
if( p )
|
||||||
p->next = info->next;
|
p->next = info->next;
|
||||||
|
|
||||||
if( first == info )
|
if( first == info )
|
||||||
first = info->next;
|
first = info->next;
|
||||||
|
|
||||||
if( last == info )
|
if( last == info )
|
||||||
last = p;
|
last = p;
|
||||||
|
|
||||||
free( info );
|
free( info );
|
||||||
info = 0;
|
info = 0;
|
||||||
}
|
}
|
||||||
@@ -645,7 +661,9 @@ cvRegisterModule( const CvModuleInfo* module )
|
|||||||
CvModule::first = module_copy;
|
CvModule::first = module_copy;
|
||||||
else
|
else
|
||||||
CvModule::last->next = module_copy;
|
CvModule::last->next = module_copy;
|
||||||
|
|
||||||
CvModule::last = module_copy;
|
CvModule::last = module_copy;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user