fixed some compilation under ubuntu

This commit is contained in:
Anatoly Baksheev 2011-02-04 18:29:05 +00:00
parent 21f0d1e174
commit 7b1c265563
9 changed files with 141 additions and 101 deletions

View File

@ -35,51 +35,59 @@ source_group("Include" FILES ${lib_hdrs})
file(GLOB lib_device_hdrs "src/opencv2/gpu/device/*.h*")
source_group("Device" FILES ${lib_device_hdrs})
if (HAVE_CUDA AND MSVC)
if (HAVE_CUDA)
file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp")
file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu")
file(GLOB_RECURSE ncv_hdr1 "src/nvidia/*.hpp")
file(GLOB_RECURSE ncv_hdr2 "src/nvidia/*.h")
source_group("Src\\NVidia" FILES ${ncv_srcs} ${ncv_hdr1} ${ncv_hdr2} ${ncv_cuda})
include_directories("src/nvidia/core" "src/nvidia/NPP_staging")
file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu")
file(GLOB_RECURSE ncv_hdr1 "src/nvidia/*.hpp")
file(GLOB_RECURSE ncv_hdr2 "src/nvidia/*.h")
if (NOT MSVS)
file(GLOB vvv "src/nvidia/*.cu")
list(GET vvv 0 vv)
list(REMOVE_ITEM ncv_cuda ${vv})
endif()
message(STATUS ${ncv_cuda})
source_group("Src\\NVidia" FILES ${ncv_srcs} ${ncv_hdr1} ${ncv_hdr2} ${ncv_cuda})
include_directories("src/nvidia/core" "src/nvidia/NPP_staging")
endif()
if (HAVE_CUDA)
get_filename_component(_path_to_findnpp "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_path_to_findnpp})
find_package(NPP 3.2.16 REQUIRED)
message(STATUS "NPP detected: " ${NPP_VERSION})
get_filename_component(_path_to_findnpp "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_path_to_findnpp})
find_package(NPP 3.2.16 REQUIRED)
message(STATUS "NPP detected: " ${NPP_VERSION})
include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_NPP_INCLUDES})
if (UNIX OR APPLE)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" "-fPIC")
endif()
include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_NPP_INCLUDES})
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep")
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
if (UNIX OR APPLE)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" "-fPIC")
endif()
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep")
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
if(MSVC)
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408")
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif()
if(MSVC)
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408")
string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif()
CUDA_COMPILE(cuda_objs ${lib_cuda} ${ncv_cuda})
#CUDA_BUILD_CLEAN_TARGET()
CUDA_COMPILE(cuda_objs ${lib_cuda} ${ncv_cuda})
#CUDA_BUILD_CLEAN_TARGET()
endif()
add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${lib_cuda} ${lib_cuda_hdrs} ${lib_device_hdrs} ${ncv_srcs} ${ncv_hdr1} ${ncv_hdr2} ${ncv_cuda} ${cuda_objs})

View File

@ -56,6 +56,7 @@
////////////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <cstdio>
#include "NCV.hpp"
#include "NPP_staging/NPP_staging.hpp"
@ -2396,11 +2397,10 @@ static NCVStatus loadFromNVBIN(const std::string &filename,
FILE *fp = fopen(filename.c_str(), "rb");
ncvAssertReturn(fp != NULL, NCV_FILE_ERROR);
Ncv32u fileVersion;
fread(&fileVersion, sizeof(Ncv32u), 1, fp);
ncvAssertReturn(1 == fread(&fileVersion, sizeof(Ncv32u), 1, fp), NCV_FILE_ERROR);
ncvAssertReturn(fileVersion == NVBIN_HAAR_VERSION, NCV_FILE_ERROR);
Ncv32u fsize;
fread_s(&fsize, sizeof(Ncv32u), sizeof(Ncv32u), 1, fp);
ncvAssertReturn(1 == fread(&fsize, sizeof(Ncv32u), 1, fp), NCV_FILE_ERROR);
fseek(fp, 0, SEEK_END);
Ncv32u fsizeActual = ftell(fp);
ncvAssertReturn(fsize == fsizeActual, NCV_FILE_ERROR);
@ -2409,7 +2409,7 @@ static NCVStatus loadFromNVBIN(const std::string &filename,
fdata.resize(fsize);
Ncv32u dataOffset = 0;
fseek(fp, 0, SEEK_SET);
fread(&fdata[0], fsize, 1, fp);
ncvAssertReturn(1 == fread(&fdata[0], fsize, 1, fp), NCV_FILE_ERROR);
fclose(fp);
//data
@ -2458,18 +2458,17 @@ NCVStatus ncvHaarGetClassifierSize(const std::string &filename, Ncv32u &numStage
if (fext == "nvbin")
{
FILE *fp;
fopen_s(&fp, filename.c_str(), "rb");
FILE *fp = fopen(filename.c_str(), "rb");
ncvAssertReturn(fp != NULL, NCV_FILE_ERROR);
Ncv32u fileVersion;
fread_s(&fileVersion, sizeof(Ncv32u), sizeof(Ncv32u), 1, fp);
ncvAssertReturn(1 == fread(&fileVersion, sizeof(Ncv32u), 1, fp), NCV_FILE_ERROR);
ncvAssertReturn(fileVersion == NVBIN_HAAR_VERSION, NCV_FILE_ERROR);
fseek(fp, NVBIN_HAAR_SIZERESERVED, SEEK_SET);
Ncv32u tmp;
fread_s(&numStages, sizeof(Ncv32u), sizeof(Ncv32u), 1, fp);
fread_s(&tmp, sizeof(Ncv32u), sizeof(Ncv32u), 1, fp);
fread_s(&numNodes, sizeof(Ncv32u), sizeof(Ncv32u), 1, fp);
fread_s(&numFeatures, sizeof(Ncv32u), sizeof(Ncv32u), 1, fp);
ncvAssertReturn(1 == fread(&numStages, sizeof(Ncv32u), 1, fp), NCV_FILE_ERROR);
ncvAssertReturn(1 == fread(&tmp, sizeof(Ncv32u), 1, fp), NCV_FILE_ERROR);
ncvAssertReturn(1 == fread(&numNodes, sizeof(Ncv32u), 1, fp), NCV_FILE_ERROR);
ncvAssertReturn(1 == fread(&numFeatures, sizeof(Ncv32u), 1, fp), NCV_FILE_ERROR);
fclose(fp);
}
else if (fext == "xml")
@ -2596,8 +2595,7 @@ NCVStatus ncvHaarStoreNVBIN_host(const std::string &filename,
dataOffset = sizeof(Ncv32u);
*(Ncv32u *)(&fdata[0]+dataOffset) = fsize;
FILE *fp;
fopen_s(&fp, filename.c_str(), "wb");
FILE *fp = fopen(filename.c_str(), "wb");
ncvAssertReturn(fp != NULL, NCV_FILE_ERROR);
fwrite(&fdata[0], fsize, 1, fp);
fclose(fp);

View File

@ -161,20 +161,32 @@ const Ncv32u NUM_SCAN_THREADS = 256;
const Ncv32u LOG2_NUM_SCAN_THREADS = 8;
struct T_true {};
struct T_false {};
template <typename T, typename U> struct is_same : T_false {};
template <typename T> struct is_same<T, T> : T_true {};
template <int v>
struct Int2Type
{
enum { value = v };
};
template<class T_in, class T_out>
struct _scanElemOp
{
template<bool tbDoSqr>
static inline __host__ __device__ T_out scanElemOp(T_in elem);
template<>
static inline __host__ __device__ T_out scanElemOp<false>(T_in elem)
static inline __host__ __device__ T_out scanElemOp(T_in elem)
{
return scanElemOp_( elem, Int2Type<(int)tbDoSqr>() );
}
private:
static inline __host__ __device__ T_out scanElemOp_(T_in elem,const Int2Type<0>&)
{
return (T_out)elem;
}
template<>
static inline __host__ __device__ T_out scanElemOp<true>(T_in elem)
static inline __host__ __device__ T_out scanElemOp_(T_in elem, const Int2Type<1>&)
{
return (T_out)(elem*elem);
}

View File

@ -73,7 +73,7 @@ void ncvDebugOutput(const char *msg, ...)
char buffer[K_DEBUG_STRING_MAXLEN];
va_list args;
va_start(args, msg);
vsnprintf_s(buffer, K_DEBUG_STRING_MAXLEN, K_DEBUG_STRING_MAXLEN-1, msg, args);
vsnprintf(buffer, K_DEBUG_STRING_MAXLEN, msg, args);
va_end (args);
debugOutputHandler(buffer);
}
@ -531,6 +531,10 @@ typedef struct _NcvTimeMoment NcvTimeMoment;
return (((double)t2->tv.tv_sec - (double)t1->tv.tv_sec) * 1000000 + (double)t2->tv.tv_usec - (double)t1->tv.tv_usec);
}
double _ncvMomentsDiffToMilliseconds(NcvTimeMoment *t1, NcvTimeMoment *t2)
{
return ((double)t2->tv.tv_sec - (double)t1->tv.tv_sec) * 1000;
}
#endif //#if defined(_WIN32) || defined(_WIN64)
@ -569,4 +573,4 @@ double ncvEndQueryTimerMs(NcvTimer t)
return res;
}
#endif /* !defined (HAVE_CUDA) */
#endif /* !defined (HAVE_CUDA) */

View File

@ -146,10 +146,10 @@ namespace NCVRuntimeTemplateBool
{
//Convenience function used by the user
//Takes a variable argument list, transforms it into a list
static void call(Func &functor, int dummy, ...)
static void call(Func &functor, Ncv32u dummy, ...)
{
//Vector used to collect arguments
std::vector<int> templateParamList;
std::vector<NcvBool> templateParamList;
//Variable argument list manipulation
va_list listPointer;
@ -157,7 +157,7 @@ namespace NCVRuntimeTemplateBool
//Collect parameters into the list
for(int i=0; i<NumArguments; i++)
{
int val = va_arg(listPointer, int);
NcvBool val = va_arg(listPointer, NcvBool);
templateParamList.push_back(val);
}
va_end(listPointer);
@ -168,26 +168,26 @@ namespace NCVRuntimeTemplateBool
//Actual function called recursively to build a typelist based
//on a list of values
static void call( Func &functor, std::vector<int> &templateParamList)
static void call( Func &functor, std::vector<NcvBool> &templateParamList)
{
//Get current parameter value in the list
int val = templateParamList[templateParamList.size() - 1];
NcvBool val = templateParamList[templateParamList.size() - 1];
templateParamList.pop_back();
//Select the compile time value to add into the typelist
//depending on the runtime variable and make recursive call.
//depending on the runtime variable and make recursive call.
//Both versions are really instantiated
if(val)
if (val)
{
KernelCaller<
Loki::Typelist<typename Loki::Int2Type<true>, TList >,
Loki::Typelist<typename Loki::Int2Type<1>, TList >,
NumArguments-1, Func >
::call(functor, templateParamList);
}
else
{
KernelCaller<
Loki::Typelist<typename Loki::Int2Type<false>, TList >,
KernelCaller<
Loki::Typelist<typename Loki::Int2Type<0>, TList >,
NumArguments-1, Func >
::call(functor, templateParamList);
}
@ -205,7 +205,7 @@ namespace NCVRuntimeTemplateBool
functor.call(TList()); //TList instantiated to get the method template parameter resolved
}
static void call(Func &functor, std::vector<int> &templateParams)
static void call(Func &functor, std::vector<NcvBool> &templateParams)
{
functor.call(TList());
}

View File

@ -70,9 +70,9 @@
#include "opencv2/gpu/stream_accessor.hpp"
#include "npp.h"
#include "nvidia/core/NCV.hpp"
#include "nvidia/NPP_staging/npp_staging.hpp"
#include "nvidia/NCVHaarObjectDetection.hpp"
#include "nvidia/core/NCV.hpp"
#include "nvidia/NPP_staging/NPP_staging.hpp"
#include "nvidia/NCVHaarObjectDetection.hpp"
#define CUDART_MINIMUM_REQUIRED_VERSION 3020
#define NPP_MINIMUM_REQUIRED_VERSION 3216

View File

@ -2,20 +2,16 @@
#include <cstdio>
#include "cvconfig.h"
#if !defined(HAVE_CUDA)
int main( int argc, const char** argv ) { return printf("Please compile the librarary with CUDA support."), -1; }
#if !defined(HAVE_CUDA) || defined(__GNUC__)
int main( int argc, const char** argv ) { return printf("Please compile the librarary with CUDA support."), -1; }
#else
#include <cuda_runtime.h>
#include "opencv2/opencv.hpp"
#include "NCVHaarObjectDetection.hpp"
using namespace cv;
const Size2i preferredVideoFrameSize(640, 480);
std::string preferredClassifier = "haarcascade_frontalface_alt.xml";
@ -37,10 +33,9 @@ void imagePrintf(Mat& img, int lineOffsY, Scalar color, const char *format, ...)
va_list arg_ptr;
va_start(arg_ptr, format);
int len = _vscprintf(format, arg_ptr) + 1;
vector<char> strBuf(len);
vsprintf_s(&strBuf[0], len, format, arg_ptr);
char strBuf[4096];
vsprintf(&strBuf[0], format, arg_ptr);
Point org(1, 3 * textSize.height * (lineOffsY + 1) / 2);
putText(img, &strBuf[0], org, fontFace, fontScale, color);
@ -357,4 +352,4 @@ int main( int argc, const char** argv )
}
#endif
#endif

View File

@ -10,6 +10,11 @@
*/
#include <float.h>
#if defined(__GNUC__)
#include <fpu_control.h>
#endif
#include "TestHaarCascadeApplication.h"
#include "NCVHaarObjectDetection.hpp"
@ -195,6 +200,24 @@ bool TestHaarCascadeApplication::process()
}
ncvAssertReturn(cudaSuccess == cudaStreamSynchronize(0), false);
#if defined(__GNUC__)
//http://www.christian-seiler.de/projekte/fpmath/
fpu_control_t fpu_oldcw, fpu_cw;
_FPU_GETCW(fpu_oldcw); // store old cw
fpu_cw = (fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_DOUBLE & ~_FPU_SINGLE) | _FPU_SINGLE;
_FPU_SETCW(fpu_cw);
// calculations here
ncvStat = ncvApplyHaarClassifierCascade_host(
h_integralImage, h_rectStdDev, h_pixelMask,
detectionsOnThisScale_h,
haar, h_HaarStages, h_HaarNodes, h_HaarFeatures, false,
searchRoiU, 1, 1.0f);
ncvAssertReturn(ncvStat == NCV_SUCCESS, false);
_FPU_SETCW(fpu_oldcw); // restore old cw
#else
Ncv32u fpu_oldcw, fpu_cw;
_controlfp_s(&fpu_cw, 0, 0);
fpu_oldcw = fpu_cw;
@ -206,7 +229,7 @@ bool TestHaarCascadeApplication::process()
searchRoiU, 1, 1.0f);
ncvAssertReturn(ncvStat == NCV_SUCCESS, false);
_controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC);
#endif
NCV_SKIP_COND_END
int devId;

View File

@ -30,14 +30,14 @@ void generateIntegralTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<
{
Ncv32u i = (Ncv32u)_i;
char testName[80];
sprintf_s(testName, sizeof(testName), "LinIntImgW%dH%d", i, 2);
sprintf(testName, "LinIntImgW%dH%d", i, 2);
testLister.add(new TestIntegralImage<T_in, T_out>(testName, src, i, 2));
}
for (Ncv32f _i=1.0; _i<maxHeight; _i*=1.2f)
{
Ncv32u i = (Ncv32u)_i;
char testName[80];
sprintf_s(testName, sizeof(testName), "LinIntImgW%dH%d", 2, i);
sprintf(testName, "LinIntImgW%dH%d", 2, i);
testLister.add(new TestIntegralImage<T_in, T_out>(testName, src, 2, i));
}
@ -55,14 +55,14 @@ void generateSquaredIntegralTests(NCVAutoTestLister &testLister, NCVTestSourcePr
{
Ncv32u i = (Ncv32u)_i;
char testName[80];
sprintf_s(testName, sizeof(testName), "SqIntImgW%dH%d", i, 32);
sprintf(testName, "SqIntImgW%dH%d", i, 32);
testLister.add(new TestIntegralImageSquared(testName, src, i, 32));
}
for (Ncv32f _i=1.0; _i<maxHeight; _i*=1.2f)
{
Ncv32u i = (Ncv32u)_i;
char testName[80];
sprintf_s(testName, sizeof(testName), "SqIntImgW%dH%d", 32, i);
sprintf(testName, "SqIntImgW%dH%d", 32, i);
testLister.add(new TestIntegralImageSquared(testName, src, 32, i));
}
@ -82,7 +82,7 @@ void generateRectStdDevTests(NCVAutoTestLister &testLister, NCVTestSourceProvide
{
Ncv32u i = (Ncv32u)_i;
char testName[80];
sprintf_s(testName, sizeof(testName), "RectStdDevW%dH%d", i*2, i);
sprintf(testName, "RectStdDevW%dH%d", i*2, i);
testLister.add(new TestRectStdDev(testName, src, i*2, i, rect, 1, true));
testLister.add(new TestRectStdDev(testName, src, i*2, i, rect, 1.5, false));
testLister.add(new TestRectStdDev(testName, src, i-1, i*2-1, rect, 1, false));
@ -103,7 +103,7 @@ void generateResizeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<T>
for (Ncv32u i=1; i<480; i+=3)
{
char testName[80];
sprintf_s(testName, sizeof(testName), "TestResize_VGA_s%d", i);
sprintf(testName, "TestResize_VGA_s%d", i);
testLister.add(new TestResize<T>(testName, src, 640, 480, i, true));
testLister.add(new TestResize<T>(testName, src, 640, 480, i, false));
}
@ -112,7 +112,7 @@ void generateResizeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<T>
for (Ncv32u i=1; i<1080; i+=5)
{
char testName[80];
sprintf_s(testName, sizeof(testName), "TestResize_1080_s%d", i);
sprintf(testName, "TestResize_1080_s%d", i);
testLister.add(new TestResize<T>(testName, src, 1920, 1080, i, true));
testLister.add(new TestResize<T>(testName, src, 1920, 1080, i, false));
}
@ -128,13 +128,13 @@ void generateNPPSTVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvid
{
Ncv32u i = (Ncv32u)_i;
char testName[80];
sprintf_s(testName, sizeof(testName), "Compaction%d", i);
sprintf(testName, "Compaction%d", i);
testLister.add(new TestCompact(testName, src, i, 0xFFFFFFFF, 30));
}
for (Ncv32u i=1; i<260; i++)
{
char testName[80];
sprintf_s(testName, sizeof(testName), "Compaction%d", i);
sprintf(testName, "Compaction%d", i);
testLister.add(new TestCompact(testName, src, i, 0xC001C0DE, 70));
testLister.add(new TestCompact(testName, src, i, 0xC001C0DE, 0));
testLister.add(new TestCompact(testName, src, i, 0xC001C0DE, 100));
@ -142,13 +142,13 @@ void generateNPPSTVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvid
for (Ncv32u i=256*256-256; i<256*256+257; i++)
{
char testName[80];
sprintf_s(testName, sizeof(testName), "Compaction%d", i);
sprintf(testName, "Compaction%d", i);
testLister.add(new TestCompact(testName, src, i, 0xFFFFFFFF, 40));
}
for (Ncv32u i=256*256*256-10; i<256*256*256+10; i++)
{
char testName[80];
sprintf_s(testName, sizeof(testName), "Compaction%d", i);
sprintf(testName, "Compaction%d", i);
testLister.add(new TestCompact(testName, src, i, 0x00000000, 2));
}
}
@ -162,7 +162,7 @@ void generateTransposeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider
for (int j=2; j<64; j+=4)
{
char testName[80];
sprintf_s(testName, sizeof(testName), "TestTranspose_%dx%d", i, j);
sprintf(testName, "TestTranspose_%dx%d", i, j);
testLister.add(new TestTranspose<T>(testName, src, i, j));
}
}
@ -172,7 +172,7 @@ void generateTransposeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider
for (int j=1; j<2; j+=1)
{
char testName[80];
sprintf_s(testName, sizeof(testName), "TestTranspose_%dx%d", i, j);
sprintf(testName, "TestTranspose_%dx%d", i, j);
testLister.add(new TestTranspose<T>(testName, src, i, j));
}
}
@ -192,7 +192,7 @@ void generateDrawRectsTests(NCVAutoTestLister &testLister, NCVTestSourceProvider
Ncv32u j = maxHeight * i / maxWidth;
if (!j) continue;
char testName[80];
sprintf_s(testName, sizeof(testName), "DrawRectsW%dH%d", i, j);
sprintf(testName, "DrawRectsW%dH%d", i, j);
if (sizeof(T) == sizeof(Ncv32u))
{
@ -222,7 +222,7 @@ void generateVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvider<Nc
{
Ncv32u i = (Ncv32u)_i;
char testName[80];
sprintf_s(testName, sizeof(testName), "VectorGrow%d", i);
sprintf(testName, "VectorGrow%d", i);
testLister.add(new TestHypothesesGrow(testName, src, 20, 20, 2.2f, i, i/2, i, i/4));
testLister.add(new TestHypothesesGrow(testName, src, 10, 42, 1.2f, i, i, i, 0));
}
@ -239,7 +239,7 @@ void generateHypothesesFiltrationTests(NCVAutoTestLister &testLister, NCVTestSou
{
Ncv32u i = (Ncv32u)_i;
char testName[80];
sprintf_s(testName, sizeof(testName), "HypFilter%d", i);
sprintf(testName, "HypFilter%d", i);
testLister.add(new TestHypothesesFilter(testName, src, i, 3, 0.2f));
testLister.add(new TestHypothesesFilter(testName, src, i, 0, 0.2f));
testLister.add(new TestHypothesesFilter(testName, src, i, 1, 0.1f));
@ -265,7 +265,7 @@ void generateHaarApplicationTests(NCVAutoTestLister &testLister, NCVTestSourcePr
for (Ncv32u j=20; j<128; j+=5)
{
char testName[80];
sprintf_s(testName, sizeof(testName), "HaarAppl%d_%d", i, j);
sprintf(testName, "HaarAppl%d_%d", i, j);
testLister.add(new TestHaarCascadeApplication(testName, src, "haarcascade_frontalface_alt.xml", j, i));
}
}
@ -273,7 +273,7 @@ void generateHaarApplicationTests(NCVAutoTestLister &testLister, NCVTestSourcePr
{
Ncv32u i = (Ncv32u)_i;
char testName[80];
sprintf_s(testName, sizeof(testName), "HaarAppl%d", i);
sprintf(testName, "HaarAppl%d", i);
testLister.add(new TestHaarCascadeApplication(testName, src, "haarcascade_frontalface_alt.xml", i, i));
}
}