#if defined _MSC_VER && _MSC_VER >= 1200 # pragma warning (disable : 4408 4201 4100) #endif #if !defined CUDA_DISABLER #include #include "NCV.hpp" #include "NCVHaarObjectDetection.hpp" #include "TestIntegralImage.h" #include "TestIntegralImageSquared.h" #include "TestRectStdDev.h" #include "TestResize.h" #include "TestCompact.h" #include "TestTranspose.h" #include "TestDrawRects.h" #include "TestHypothesesGrow.h" #include "TestHypothesesFilter.h" #include "TestHaarCascadeLoader.h" #include "TestHaarCascadeApplication.h" #include "NCVAutoTestLister.hpp" #include "NCVTestSourceProvider.hpp" #include "main_test_nvidia.h" static std::string path; namespace { template void generateIntegralTests(NCVAutoTestLister &testLister, NCVTestSourceProvider &src, Ncv32u maxWidth, Ncv32u maxHeight) { for (Ncv32f _i=1.0; _i(testName, src, i, 2)); } for (Ncv32f _i=1.0; _i(testName, src, 2, i)); } testLister.add(new TestIntegralImage("LinIntImg_VGA", src, 640, 480)); } void generateSquaredIntegralTests(NCVAutoTestLister &testLister, NCVTestSourceProvider &src, Ncv32u maxWidth, Ncv32u maxHeight) { for (Ncv32f _i=1.0; _i &src, Ncv32u maxWidth, Ncv32u maxHeight) { NcvRect32u rect(1,1,18,18); for (Ncv32f _i=32; _i void generateResizeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider &src) { for (Ncv32u i=2; i<10; ++i) { char testName[80]; sprintf(testName, "TestResize_VGA_s%d", i); testLister.add(new TestResize(testName, src, 640, 480, i, true)); testLister.add(new TestResize(testName, src, 640, 480, i, false)); } for (Ncv32u i=2; i<10; ++i) { char testName[80]; sprintf(testName, "TestResize_1080_s%d", i); testLister.add(new TestResize(testName, src, 1920, 1080, i, true)); testLister.add(new TestResize(testName, src, 1920, 1080, i, false)); } } void generateNPPSTVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvider &src, Ncv32u maxLength) { //compaction for (Ncv32f _i=256.0; _i void generateTransposeTests(NCVAutoTestLister &testLister, NCVTestSourceProvider &src) { for (int i=2; i<64; i+=4) { for (int j=2; j<64; j+=4) { char testName[80]; sprintf(testName, "TestTranspose_%dx%d", i, j); testLister.add(new TestTranspose(testName, src, i, j)); } } for (int i=1; i<128; i+=1) { for (int j=1; j<2; j+=1) { char testName[80]; sprintf(testName, "TestTranspose_%dx%d", i, j); testLister.add(new TestTranspose(testName, src, i, j)); } } testLister.add(new TestTranspose("TestTranspose_VGA", src, 640, 480)); testLister.add(new TestTranspose("TestTranspose_HD1080", src, 1920, 1080)); //regression tests testLister.add(new TestTranspose("TestTranspose_reg_0", src, 1072, 375)); } template void generateDrawRectsTests(NCVAutoTestLister &testLister, NCVTestSourceProvider &src, NCVTestSourceProvider &src32u, Ncv32u maxWidth, Ncv32u maxHeight) { for (Ncv32f _i=16.0; _i(testName, src, src32u, i, j, i*j/1000+1, (T)0xFFFFFFFF)); } else if (sizeof(T) == sizeof(Ncv8u)) { testLister.add(new TestDrawRects(testName, src, src32u, i, j, i*j/1000+1, (T)0xFF)); } else { ncvAssertPrintCheck(false, "Attempted to instantiate non-existing DrawRects test suite"); } } //test VGA testLister.add(new TestDrawRects("DrawRects_VGA", src, src32u, 640, 480, 640*480/1000, (T)0xFF)); } void generateVectorTests(NCVAutoTestLister &testLister, NCVTestSourceProvider &src, Ncv32u maxLength) { //growth for (Ncv32f _i=10.0; _i &src, Ncv32u maxLength) { for (Ncv32f _i=1.0; _i &src, Ncv32u maxWidth, Ncv32u maxHeight) { (void)maxHeight; for (Ncv32u i=100; i<512; i+=41) { for (Ncv32u j=100; j<128; j+=25) { char testName[80]; sprintf(testName, "HaarAppl%d_%d", i, j); testLister.add(new TestHaarCascadeApplication(testName, src, path + "haarcascade_frontalface_alt.xml", j, i)); } } for (Ncv32f _i=20.0; _i testSrcRandom_8u(2010, 0, 255, 2048, 2048); NCVTestSourceProvider testSrcRandom_32f(2010, -1.0f, 1.0f, 2048, 2048); generateIntegralTests(testListerII, testSrcRandom_8u, 2048, 2048); generateIntegralTests(testListerII, testSrcRandom_32f, 2048, 2048); return testListerII.invoke(); } bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerSII("NPPST Squared Integral Image", outputLevel); NCVTestSourceProvider testSrcRandom_8u(2010, 0, 255, 2048, 2048); generateSquaredIntegralTests(testListerSII, testSrcRandom_8u, 2048, 2048); return testListerSII.invoke(); } bool nvidia_NPPST_RectStdDev(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerRStdDev("NPPST RectStdDev", outputLevel); NCVTestSourceProvider testSrcRandom_8u(2010, 0, 255, 2048, 2048); generateRectStdDevTests(testListerRStdDev, testSrcRandom_8u, 2048, 2048); return testListerRStdDev.invoke(); } bool nvidia_NPPST_Resize(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerResize("NPPST Resize", outputLevel); NCVTestSourceProvider testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048); NCVTestSourceProvider testSrcRandom_64u(2010, 0, -1, 2048, 2048); generateResizeTests(testListerResize, testSrcRandom_32u); generateResizeTests(testListerResize, testSrcRandom_64u); return testListerResize.invoke(); } bool nvidia_NPPST_Vector_Operations(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerNPPSTVectorOperations("NPPST Vector Operations", outputLevel); NCVTestSourceProvider testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048); generateNPPSTVectorTests(testListerNPPSTVectorOperations, testSrcRandom_32u, 2048*2048); return testListerNPPSTVectorOperations.invoke(); } bool nvidia_NPPST_Transpose(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerTranspose("NPPST Transpose", outputLevel); NCVTestSourceProvider testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048); NCVTestSourceProvider testSrcRandom_64u(2010, 0, -1, 2048, 2048); generateTransposeTests(testListerTranspose, testSrcRandom_32u); generateTransposeTests(testListerTranspose, testSrcRandom_64u); return testListerTranspose.invoke(); } bool nvidia_NCV_Vector_Operations(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerVectorOperations("Vector Operations", outputLevel); NCVTestSourceProvider testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048); generateVectorTests(testListerVectorOperations, testSrcRandom_32u, 2048*2048); return testListerVectorOperations.invoke(); } bool nvidia_NCV_Haar_Cascade_Loader(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerHaarLoader("Haar Cascade Loader", outputLevel); generateHaarLoaderTests(testListerHaarLoader); return testListerHaarLoader.invoke(); } bool nvidia_NCV_Haar_Cascade_Application(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerHaarAppl("Haar Cascade Application", outputLevel); NCVTestSourceProvider testSrcFacesVGA_8u(path + "group_1_640x480_VGA.pgm"); generateHaarApplicationTests(testListerHaarAppl, testSrcFacesVGA_8u, 640, 480); return testListerHaarAppl.invoke(); } bool nvidia_NCV_Hypotheses_Filtration(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerHypFiltration("Hypotheses Filtration", outputLevel); NCVTestSourceProvider testSrcRandom_32u(2010, 0, 0xFFFFFFFF, 2048, 2048); generateHypothesesFiltrationTests(testListerHypFiltration, testSrcRandom_32u, 512); return testListerHypFiltration.invoke(); } bool nvidia_NCV_Visualization(const std::string& test_data_path, OutputLevel outputLevel) { path = test_data_path; ncvSetDebugOutputHandler(devNullOutput); NCVAutoTestLister testListerVisualize("Visualization", outputLevel); NCVTestSourceProvider testSrcRandom_8u(2010, 0, 255, 2048, 2048); NCVTestSourceProvider testSrcRandom_32u(2010, 0, RAND_MAX, 2048, 2048); generateDrawRectsTests(testListerVisualize, testSrcRandom_8u, testSrcRandom_32u, 2048, 2048); generateDrawRectsTests(testListerVisualize, testSrcRandom_32u, testSrcRandom_32u, 2048, 2048); return testListerVisualize.invoke(); } #endif /* CUDA_DISABLER */