From 52dbbae82c0269dc9db805b4f4939cde72391d9b Mon Sep 17 00:00:00 2001 From: yao Date: Tue, 7 May 2013 16:14:50 +0800 Subject: [PATCH] some cleanup, remove some commented codes --- modules/ocl/test/test_arithm.cpp | 4 --- modules/ocl/test/test_blend.cpp | 15 ++------- modules/ocl/test/test_columnsum.cpp | 16 ++-------- modules/ocl/test/test_filters.cpp | 25 ++------------- modules/ocl/test/test_gemm.cpp | 3 +- modules/ocl/test/test_haar.cpp | 6 ---- modules/ocl/test/test_imgproc.cpp | 37 ++-------------------- modules/ocl/test/test_match_template.cpp | 5 --- modules/ocl/test/test_matrix_operation.cpp | 28 +++------------- modules/ocl/test/test_pyrdown.cpp | 11 ------- modules/ocl/test/test_pyrlk.cpp | 12 ------- modules/ocl/test/test_pyrup.cpp | 3 -- modules/ocl/test/test_split_merge.cpp | 12 ++----- 13 files changed, 18 insertions(+), 159 deletions(-) diff --git a/modules/ocl/test/test_arithm.cpp b/modules/ocl/test/test_arithm.cpp index e46fdbddd..81dab430e 100644 --- a/modules/ocl/test/test_arithm.cpp +++ b/modules/ocl/test/test_arithm.cpp @@ -125,10 +125,6 @@ PARAM_TEST_CASE(ArithmTestBase, MatType, bool) val = cv::Scalar(rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0)); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() diff --git a/modules/ocl/test/test_blend.cpp b/modules/ocl/test/test_blend.cpp index f9c8657d0..fcc192543 100644 --- a/modules/ocl/test/test_blend.cpp +++ b/modules/ocl/test/test_blend.cpp @@ -33,20 +33,14 @@ void blendLinearGold(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &we PARAM_TEST_CASE(Blend, cv::Size, MatType/*, UseRoi*/) { - //std::vector oclinfo; cv::Size size; int type; bool useRoi; virtual void SetUp() { - //devInfo = GET_PARAM(0); size = GET_PARAM(0); type = GET_PARAM(1); - /*useRoi = GET_PARAM(3);*/ - - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); } }; @@ -59,12 +53,9 @@ TEST_P(Blend, Accuracy) cv::Mat weights1 = randomMat(size, CV_32F, 0, 1); cv::Mat weights2 = randomMat(size, CV_32F, 0, 1); - cv::ocl::oclMat gimg1(size, type), gimg2(size, type), gweights1(size, CV_32F), gweights2(size, CV_32F); - cv::ocl::oclMat dst(size, type); - gimg1.upload(img1); - gimg2.upload(img2); - gweights1.upload(weights1); - gweights2.upload(weights2); + cv::ocl::oclMat gimg1(img1), gimg2(img2), gweights1(weights1), gweights2(weights2); + cv::ocl::oclMat dst; + cv::ocl::blendLinear(gimg1, gimg2, gweights1, gweights2, dst); cv::Mat result; cv::Mat result_gold; diff --git a/modules/ocl/test/test_columnsum.cpp b/modules/ocl/test/test_columnsum.cpp index 9bd2e6f8e..bf389d1b8 100644 --- a/modules/ocl/test/test_columnsum.cpp +++ b/modules/ocl/test/test_columnsum.cpp @@ -47,27 +47,16 @@ #include "precomp.hpp" #include -/////////////////////////////////////////////////////////////////////////////// -/// ColumnSum - #ifdef HAVE_OPENCL -//////////////////////////////////////////////////////////////////////// -// ColumnSum - -PARAM_TEST_CASE(ColumnSum, cv::Size, bool ) +PARAM_TEST_CASE(ColumnSum, cv::Size) { cv::Size size; cv::Mat src; - bool useRoi; - //std::vector oclinfo; virtual void SetUp() { size = GET_PARAM(0); - useRoi = GET_PARAM(1); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); } }; @@ -99,8 +88,7 @@ TEST_P(ColumnSum, Accuracy) } } -INSTANTIATE_TEST_CASE_P(GPU_ImgProc, ColumnSum, testing::Combine( - DIFFERENT_SIZES, testing::Values(Inverse(false), Inverse(true)))); +INSTANTIATE_TEST_CASE_P(GPU_ImgProc, ColumnSum, DIFFERENT_SIZES); #endif diff --git a/modules/ocl/test/test_filters.cpp b/modules/ocl/test/test_filters.cpp index 70d407944..d598b6a18 100644 --- a/modules/ocl/test/test_filters.cpp +++ b/modules/ocl/test/test_filters.cpp @@ -285,7 +285,7 @@ PARAM_TEST_CASE(LaplacianTestBase, MatType, int) //src mat with roi cv::Mat mat_roi; cv::Mat dst_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -304,10 +304,6 @@ PARAM_TEST_CASE(LaplacianTestBase, MatType, int) mat = randomMat(rng, size, type, 5, 16, false); dst = randomMat(rng, size, type, 5, 16, false); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -388,7 +384,7 @@ PARAM_TEST_CASE(ErodeDilateBase, MatType, int) //src mat with roi cv::Mat mat1_roi; cv::Mat dst_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -518,7 +514,7 @@ PARAM_TEST_CASE(Sobel, MatType, int, int, int, int) //src mat with roi cv::Mat mat1_roi; cv::Mat dst_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -540,11 +536,6 @@ PARAM_TEST_CASE(Sobel, MatType, int, int, int, int) mat1 = randomMat(rng, size, type, 5, 16, false); dst = randomMat(rng, size, type, 5, 16, false); - - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -622,7 +613,6 @@ PARAM_TEST_CASE(Scharr, MatType, int, int, int) //src mat with roi cv::Mat mat1_roi; cv::Mat dst_roi; - //std::vector oclinfo; //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -645,10 +635,6 @@ PARAM_TEST_CASE(Scharr, MatType, int, int, int) mat1 = randomMat(rng, size, type, 5, 16, false); dst = randomMat(rng, size, type, 5, 16, false); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -729,7 +715,6 @@ PARAM_TEST_CASE(GaussianBlur, MatType, cv::Size, int) //src mat with roi cv::Mat mat1_roi; cv::Mat dst_roi; - //std::vector oclinfo; //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -752,10 +737,6 @@ PARAM_TEST_CASE(GaussianBlur, MatType, cv::Size, int) mat1 = randomMat(rng, size, type, 5, 16, false); dst = randomMat(rng, size, type, 5, 16, false); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() diff --git a/modules/ocl/test/test_gemm.cpp b/modules/ocl/test/test_gemm.cpp index c26a8481f..a5d90ff01 100644 --- a/modules/ocl/test/test_gemm.cpp +++ b/modules/ocl/test/test_gemm.cpp @@ -53,13 +53,12 @@ PARAM_TEST_CASE(Gemm, int, cv::Size, int) int type; cv::Size mat_size; int flags; - //vector info; + virtual void SetUp() { type = GET_PARAM(0); mat_size = GET_PARAM(1); flags = GET_PARAM(2); - //cv::ocl::getDevice(info); } }; diff --git a/modules/ocl/test/test_haar.cpp b/modules/ocl/test/test_haar.cpp index 9bff32466..eab676921 100644 --- a/modules/ocl/test/test_haar.cpp +++ b/modules/ocl/test/test_haar.cpp @@ -63,7 +63,6 @@ struct getRect PARAM_TEST_CASE(HaarTestBase, int, int) { - //std::vector oclinfo; cv::ocl::OclCascadeClassifier cascade, nestedCascade; cv::CascadeClassifier cpucascade, cpunestedCascade; // Mat img; @@ -82,11 +81,6 @@ PARAM_TEST_CASE(HaarTestBase, int, int) cout << "ERROR: Could not load classifier cascade" << endl; return; } - //int devnums = getDevice(oclinfo); - //CV_Assert(devnums>0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); - //cv::ocl::setBinpath("E:\\"); } }; diff --git a/modules/ocl/test/test_imgproc.cpp b/modules/ocl/test/test_imgproc.cpp index 9cc6c1c89..92e2ee9d4 100644 --- a/modules/ocl/test/test_imgproc.cpp +++ b/modules/ocl/test/test_imgproc.cpp @@ -327,7 +327,7 @@ PARAM_TEST_CASE(ImgprocTestBase, MatType, MatType, MatType, MatType, MatType, bo cv::Mat mask_roi; cv::Mat dst_roi; cv::Mat dst1_roi; //bak - //std::vector oclinfo; + //ocl mat cv::ocl::oclMat clmat1; cv::ocl::oclMat clmat2; @@ -352,10 +352,6 @@ PARAM_TEST_CASE(ImgprocTestBase, MatType, MatType, MatType, MatType, MatType, bo cv::RNG &rng = TS::ptr()->get_rng(); cv::Size size(MWIDTH, MHEIGHT); double min = 1, max = 20; - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); if(type1 != nulltype) { @@ -720,7 +716,7 @@ PARAM_TEST_CASE(WarpTestBase, MatType, int) //src mat with roi cv::Mat mat1_roi; cv::Mat dst_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -740,10 +736,6 @@ PARAM_TEST_CASE(WarpTestBase, MatType, int) mat1 = randomMat(rng, size, type, 5, 16, false); dst = randomMat(rng, size, type, 5, 16, false); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -905,9 +897,6 @@ PARAM_TEST_CASE(Remap, MatType, MatType, MatType, int, int) interpolation = GET_PARAM(3); bordertype = GET_PARAM(4); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - cv::RNG &rng = TS::ptr()->get_rng(); cv::Size srcSize = cv::Size(MWIDTH, MHEIGHT); cv::Size map1Size = cv::Size(MWIDTH, MHEIGHT); @@ -1051,7 +1040,6 @@ PARAM_TEST_CASE(Resize, MatType, cv::Size, double, double, int) int dstx; int dsty; - //std::vector oclinfo; //src mat with roi cv::Mat mat1_roi; cv::Mat dst_roi; @@ -1090,10 +1078,6 @@ PARAM_TEST_CASE(Resize, MatType, cv::Size, double, double, int) mat1 = randomMat(rng, size, type, 5, 16, false); dst = randomMat(rng, dsize, type, 5, 16, false); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -1181,7 +1165,7 @@ PARAM_TEST_CASE(Threshold, MatType, ThreshOp) //src mat with roi cv::Mat mat1_roi; cv::Mat dst_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -1199,11 +1183,6 @@ PARAM_TEST_CASE(Threshold, MatType, ThreshOp) mat1 = randomMat(rng, size, type, 5, 16, false); dst = randomMat(rng, size, type, 5, 16, false); - - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -1288,7 +1267,6 @@ PARAM_TEST_CASE(meanShiftTestBase, MatType, MatType, int, int, cv::TermCriteria) cv::ocl::oclMat gdst; cv::ocl::oclMat gdstCoor; - //std::vector oclinfo; //ocl mat with roi cv::ocl::oclMat gsrc_roi; cv::ocl::oclMat gdst_roi; @@ -1311,10 +1289,6 @@ PARAM_TEST_CASE(meanShiftTestBase, MatType, MatType, int, int, cv::TermCriteria) dst = randomMat(rng, size, type, 5, 16, false); dstCoor = randomMat(rng, size, typeCoor, 5, 16, false); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -1436,7 +1410,6 @@ PARAM_TEST_CASE(histTestBase, MatType, MatType) cv::ocl::oclMat gdst_hist; //ocl mat with roi cv::ocl::oclMat gsrc_roi; - // std::vector oclinfo; virtual void SetUp() { @@ -1447,10 +1420,6 @@ PARAM_TEST_CASE(histTestBase, MatType, MatType) src = randomMat(rng, size, type_src, 0, 256, false); - // int devnums = getDevice(oclinfo); - // CV_Assert(devnums > 0); - //if you want to use undefault device, set it here - //setDevice(oclinfo[0]); } void random_roi() diff --git a/modules/ocl/test/test_match_template.cpp b/modules/ocl/test/test_match_template.cpp index 5da7f01cd..e6f1f7080 100644 --- a/modules/ocl/test/test_match_template.cpp +++ b/modules/ocl/test/test_match_template.cpp @@ -62,7 +62,6 @@ PARAM_TEST_CASE(MatchTemplate8U, cv::Size, TemplateSize, Channels, TemplateMetho cv::Size templ_size; int cn; int method; - //std::vector oclinfo; virtual void SetUp() { @@ -70,8 +69,6 @@ PARAM_TEST_CASE(MatchTemplate8U, cv::Size, TemplateSize, Channels, TemplateMetho templ_size = GET_PARAM(1); cn = GET_PARAM(2); method = GET_PARAM(3); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); } }; @@ -114,8 +111,6 @@ PARAM_TEST_CASE(MatchTemplate32F, cv::Size, TemplateSize, Channels, TemplateMeth templ_size = GET_PARAM(1); cn = GET_PARAM(2); method = GET_PARAM(3); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); } }; diff --git a/modules/ocl/test/test_matrix_operation.cpp b/modules/ocl/test/test_matrix_operation.cpp index ef11aaa13..cfcafbcfc 100644 --- a/modules/ocl/test/test_matrix_operation.cpp +++ b/modules/ocl/test/test_matrix_operation.cpp @@ -72,7 +72,7 @@ PARAM_TEST_CASE(ConvertToTestBase, MatType, MatType) //src mat with roi cv::Mat mat_roi; cv::Mat dst_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -90,11 +90,6 @@ PARAM_TEST_CASE(ConvertToTestBase, MatType, MatType) mat = randomMat(rng, size, type, 5, 16, false); dst = randomMat(rng, size, type, 5, 16, false); - //std::vector oclinfo; - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -175,7 +170,7 @@ PARAM_TEST_CASE(CopyToTestBase, MatType, bool) cv::Mat mat_roi; cv::Mat mask_roi; cv::Mat dst_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -197,10 +192,6 @@ PARAM_TEST_CASE(CopyToTestBase, MatType, bool) cv::threshold(mask, mask, 0.5, 255., CV_8UC1); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -301,7 +292,7 @@ PARAM_TEST_CASE(SetToTestBase, MatType, bool) //src mat with roi cv::Mat mat_roi; cv::Mat mask_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gmat_whole; @@ -322,10 +313,6 @@ PARAM_TEST_CASE(SetToTestBase, MatType, bool) cv::threshold(mask, mask, 0.5, 255., CV_8UC1); val = cv::Scalar(rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0), rng.uniform(-10.0, 10.0)); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -417,7 +404,7 @@ PARAM_TEST_CASE(convertC3C4, MatType, cv::Size) //src mat with roi cv::Mat mat1_roi; cv::Mat dst_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -430,13 +417,6 @@ PARAM_TEST_CASE(convertC3C4, MatType, cv::Size) type = GET_PARAM(0); ksize = GET_PARAM(1); - - - //dst = randomMat(rng, size, type, 5, 16, false); - //int devnums = getDevice(oclinfo); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[1]); } void random_roi() diff --git a/modules/ocl/test/test_pyrdown.cpp b/modules/ocl/test/test_pyrdown.cpp index c7233cc78..a67e0b0ac 100644 --- a/modules/ocl/test/test_pyrdown.cpp +++ b/modules/ocl/test/test_pyrdown.cpp @@ -65,15 +65,6 @@ PARAM_TEST_CASE(PyrDown, MatType, int) { type = GET_PARAM(0); channels = GET_PARAM(1); - - //int devnums = getDevice(oclinfo); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); - } - - void Cleanup() - { } }; @@ -97,8 +88,6 @@ TEST_P(PyrDown, Mat) char s[1024] = {0}; EXPECT_MAT_NEAR(dst, dst_cpu, dst.depth() == CV_32F ? 1e-4f : 1.0f, s); - - Cleanup(); } } diff --git a/modules/ocl/test/test_pyrlk.cpp b/modules/ocl/test/test_pyrlk.cpp index 7c747ee4f..064cb30bd 100644 --- a/modules/ocl/test/test_pyrlk.cpp +++ b/modules/ocl/test/test_pyrlk.cpp @@ -50,19 +50,7 @@ using namespace cvtest; using namespace testing; using namespace std; -//#define DUMP - -///////////////////////////////////////////////////////////////////////////////////////////////// -// BroxOpticalFlow extern string workdir; -#define BROX_OPTICAL_FLOW_DUMP_FILE "opticalflow/brox_optical_flow.bin" -#define BROX_OPTICAL_FLOW_DUMP_FILE_CC20 "opticalflow/brox_optical_flow_cc20.bin" - - -///////////////////////////////////////////////////////////////////////////////////////////////// -// PyrLKOpticalFlow - -//IMPLEMENT_PARAM_CLASS(UseGray, bool) PARAM_TEST_CASE(Sparse, bool, bool) { diff --git a/modules/ocl/test/test_pyrup.cpp b/modules/ocl/test/test_pyrup.cpp index 9889b92ac..b2d45ef4f 100644 --- a/modules/ocl/test/test_pyrup.cpp +++ b/modules/ocl/test/test_pyrup.cpp @@ -58,12 +58,9 @@ PARAM_TEST_CASE(PyrUp, MatType, int) { int type; int channels; - //std::vector oclinfo; virtual void SetUp() { - //int devnums = cv::ocl::getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); type = GET_PARAM(0); channels = GET_PARAM(1); } diff --git a/modules/ocl/test/test_split_merge.cpp b/modules/ocl/test/test_split_merge.cpp index f41d16eee..5543bbac4 100644 --- a/modules/ocl/test/test_split_merge.cpp +++ b/modules/ocl/test/test_split_merge.cpp @@ -87,7 +87,7 @@ PARAM_TEST_CASE(MergeTestBase, MatType, int) //dst mat with roi cv::Mat dst_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst_whole; @@ -112,10 +112,6 @@ PARAM_TEST_CASE(MergeTestBase, MatType, int) mat4 = randomMat(rng, size, CV_MAKETYPE(type, 1), 5, 16, false); dst = randomMat(rng, size, CV_MAKETYPE(type, channels), 5, 16, false); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi() @@ -252,7 +248,7 @@ PARAM_TEST_CASE(SplitTestBase, MatType, int) cv::Mat dst2_roi; cv::Mat dst3_roi; cv::Mat dst4_roi; - //std::vector oclinfo; + //ocl dst mat for testing cv::ocl::oclMat gdst1_whole; cv::ocl::oclMat gdst2_whole; @@ -280,10 +276,6 @@ PARAM_TEST_CASE(SplitTestBase, MatType, int) dst3 = randomMat(rng, size, CV_MAKETYPE(type, 1), 5, 16, false); dst4 = randomMat(rng, size, CV_MAKETYPE(type, 1), 5, 16, false); - //int devnums = getDevice(oclinfo, OPENCV_DEFAULT_OPENCL_DEVICE); - //CV_Assert(devnums > 0); - ////if you want to use undefault device, set it here - ////setDevice(oclinfo[0]); } void random_roi()