From 287c8a33308865d90a019a6228ebf9ad4846d8ec Mon Sep 17 00:00:00 2001 From: peng xiao Date: Wed, 28 Aug 2013 09:17:05 +0800 Subject: [PATCH] Let ocl::context only be initialized once in retina_ocl test. --- modules/bioinspired/test/test_retina_ocl.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/bioinspired/test/test_retina_ocl.cpp b/modules/bioinspired/test/test_retina_ocl.cpp index ee01d901fe..a732d7e37e 100644 --- a/modules/bioinspired/test/test_retina_ocl.cpp +++ b/modules/bioinspired/test/test_retina_ocl.cpp @@ -62,6 +62,7 @@ static double checkNear(const cv::Mat &m1, const cv::Mat &m2) #define PARAM_TEST_CASE(name, ...) struct name : testing::TestWithParam< std::tr1::tuple< __VA_ARGS__ > > #define GET_PARAM(k) std::tr1::get< k >(GetParam()) +static int oclInit = false; PARAM_TEST_CASE(Retina_OCL, bool, int, bool, double, double) { @@ -81,8 +82,12 @@ PARAM_TEST_CASE(Retina_OCL, bool, int, bool, double, double) reductionFactor = GET_PARAM(3); samplingStrength = GET_PARAM(4); - cv::ocl::getDevice(infos); - std::cout << "Device name:" << infos[0].DeviceName[0] << std::endl; + if(!oclInit) + { + cv::ocl::getDevice(infos); + std::cout << "Device name:" << infos[0].DeviceName[0] << std::endl; + oclInit = true; + } } };