From ae827a638c4b4f25f8e314aa3585340b179f63f8 Mon Sep 17 00:00:00 2001 From: Konstantin Matskevich Date: Fri, 24 Jan 2014 14:01:31 +0400 Subject: [PATCH] fixes --- modules/core/include/opencv2/core/ocl.hpp | 12 ++++++------ modules/core/src/ocl.cpp | 22 +++++++++++----------- modules/ts/src/ocl_test.cpp | 8 ++++---- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/core/include/opencv2/core/ocl.hpp b/modules/core/include/opencv2/core/ocl.hpp index 5d339a4..12c7b8b 100644 --- a/modules/core/include/opencv2/core/ocl.hpp +++ b/modules/core/include/opencv2/core/ocl.hpp @@ -59,7 +59,7 @@ class CV_EXPORTS Kernel; class CV_EXPORTS Program; class CV_EXPORTS ProgramSource2; class CV_EXPORTS Queue; -class CV_EXPORTS PlatformInform; +class CV_EXPORTS PlatformInfo2; class CV_EXPORTS Device { @@ -551,12 +551,12 @@ protected: Impl* p; }; -class CV_EXPORTS PlatformInform +class CV_EXPORTS PlatformInfo2 { public: - PlatformInform(); - explicit PlatformInform(void* id); - ~PlatformInform(); + PlatformInfo2(); + explicit PlatformInfo2(void* id); + ~PlatformInfo2(); String name() const; String vendor() const; @@ -572,7 +572,7 @@ protected: CV_EXPORTS const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf); CV_EXPORTS const char* typeToStr(int t); CV_EXPORTS const char* memopTypeToStr(int t); -CV_EXPORTS void getPlatfomsInfo(std::vector& platform_info); +CV_EXPORTS void getPlatfomsInfo(std::vector& platform_info); }} diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index c485954..7398062 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -3640,7 +3640,7 @@ static void getDevices(std::vector& devices,cl_platform_id& platfo devices.resize(numDevices); } -struct PlatformInform::Impl +struct PlatformInfo2::Impl { Impl(void* id) { @@ -3661,45 +3661,45 @@ struct PlatformInform::Impl cl_platform_id handle; }; -PlatformInform::PlatformInform() +PlatformInfo2::PlatformInfo2() { p = 0; } -PlatformInform::PlatformInform(void* platform_id) +PlatformInfo2::PlatformInfo2(void* platform_id) { p = new Impl(platform_id); } -PlatformInform::~PlatformInform() +PlatformInfo2::~PlatformInfo2() { if(p) p->release(); } -int PlatformInform::deviceNumber() const +int PlatformInfo2::deviceNumber() const { return p ? (int)p->devices.size() : 0; } -void PlatformInform::getDevice(Device& device, int d) const +void PlatformInfo2::getDevice(Device& device, int d) const { CV_Assert(d < (int)p->devices.size() ); if(p) device.set(p->devices[d]); } -String PlatformInform::name() const +String PlatformInfo2::name() const { return p ? p->getStrProp(CL_PLATFORM_NAME) : String(); } -String PlatformInform::vendor() const +String PlatformInfo2::vendor() const { return p ? p->getStrProp(CL_PLATFORM_VENDOR) : String(); } -String PlatformInform::version() const +String PlatformInfo2::version() const { return p ? p->getStrProp(CL_PLATFORM_VERSION) : String(); } @@ -3718,13 +3718,13 @@ static void getPlatforms(std::vector& platforms) platforms.resize(numPlatforms); } -void getPlatfomsInfo(std::vector& platformsInfo) +void getPlatfomsInfo(std::vector& platformsInfo) { std::vector platforms; getPlatforms(platforms); for (size_t i = 0; i < platforms.size(); i++) { - platformsInfo.push_back( PlatformInform((void*)&platforms[i]) ); + platformsInfo.push_back( PlatformInfo2((void*)&platforms[i]) ); } } diff --git a/modules/ts/src/ocl_test.cpp b/modules/ts/src/ocl_test.cpp index 7c9ca9c..32cc528 100644 --- a/modules/ts/src/ocl_test.cpp +++ b/modules/ts/src/ocl_test.cpp @@ -98,21 +98,21 @@ void dumpOpenCLDevice() using namespace cv::ocl; try { - std::vector platforms; + std::vector platforms; cv::ocl::getPlatfomsInfo(platforms); if (platforms.size() > 0) { DUMP_MESSAGE_STDOUT("OpenCL Platforms: "); for (size_t i = 0; i < platforms.size(); i++) { - const PlatformInform* platform = &platforms[i]; + const PlatformInfo2* platform = &platforms[i]; DUMP_MESSAGE_STDOUT(" " << platform->name().c_str()); Device current_device; for (int j = 0; j < platform->deviceNumber(); j++) { platform->getDevice(current_device, j); const char* deviceTypeStr = current_device.type() == Device::TYPE_CPU - ? ("CPU") : (current_device.type() == Device::TYPE_GPU ? "GPU" : "unknown"); + ? ("CPU") : (current_device.type() == Device::TYPE_GPU ? current_device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown"); DUMP_MESSAGE_STDOUT( " " << deviceTypeStr << ": " << current_device.name().c_str() << " (" << current_device.version().c_str() << ")"); DUMP_PROPERTY_XML( cv::format("cv_ocl_platform_%d_device_%d", (int)i, (int)j ), cv::format("(Platform=%sType=%sName=%sVersion=%s", @@ -136,7 +136,7 @@ void dumpOpenCLDevice() #endif const char* deviceTypeStr = device.type() == Device::TYPE_CPU - ? "CPU" : (device.type() == Device::TYPE_GPU ? "GPU" : "unknown"); + ? ("CPU") : (device.type() == Device::TYPE_GPU ? device.hostUnifiedMemory() ? "iGPU" : "dGPU" : "unknown"); DUMP_MESSAGE_STDOUT(" Type = "<< deviceTypeStr); DUMP_PROPERTY_XML("cv_ocl_current_deviceType", deviceTypeStr); -- 2.7.4