Merge pull request #18235 from alalek:ocl_off_cleanup

This commit is contained in:
Alexander Alekhin 2020-08-31 20:37:41 +00:00
commit 1d42560018
4 changed files with 379 additions and 1328 deletions

View File

@ -40,6 +40,11 @@
//M*/
#include "precomp.hpp"
#ifndef HAVE_OPENCL
#include "ocl_disabled.impl.hpp"
#else // HAVE_OPENCL
#include <list>
#include <map>
#include <deque>
@ -106,23 +111,7 @@
#include "opencv2/core/opencl/runtime/opencl_clamdblas.hpp"
#include "opencv2/core/opencl/runtime/opencl_clamdfft.hpp"
#ifdef HAVE_OPENCL
#include "opencv2/core/opencl/runtime/opencl_core.hpp"
#else
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4100)
#pragma warning(disable : 4702)
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
// TODO FIXIT: This file can't be build without OPENCL
#include "ocl_deprecated.hpp"
#endif // HAVE_OPENCL
#ifdef HAVE_OPENCL_SVM
#include "opencv2/core/opencl/runtime/opencl_svm_20.hpp"
@ -147,31 +136,6 @@ cv::utils::AllocatorStatisticsInterface& getOpenCLAllocatorStatistics()
return opencl_allocator_stats;
}
#ifndef HAVE_OPENCL
#define CV_OPENCL_NO_SUPPORT() CV_Error(cv::Error::OpenCLApiCallError, "OpenCV build without OpenCL support")
namespace {
struct DummyImpl
{
DummyImpl() { CV_OPENCL_NO_SUPPORT(); }
~DummyImpl() { /* do not throw in desctructors */ }
IMPLEMENT_REFCOUNTABLE();
};
} // namespace
// TODO Replace to empty body (without HAVE_OPENCL)
#define CV_OCL_TRACE_CHECK_RESULT(status, message) /* nothing */
#define CV_OCL_API_ERROR_MSG(check_result, msg) cv::String()
#define CV_OCL_CHECK_RESULT(check_result, msg) (void)check_result
#define CV_OCL_CHECK_(expr, check_result) expr; (void)check_result
#define CV_OCL_CHECK(expr) do { cl_int __cl_result = (expr); CV_OCL_CHECK_RESULT(__cl_result, #expr); } while (0)
#define CV_OCL_DBG_CHECK_RESULT(check_result, msg) (void)check_result
#define CV_OCL_DBG_CHECK_(expr, check_result) expr; (void)check_result
#define CV_OCL_DBG_CHECK(expr) do { cl_int __cl_result = (expr); CV_OCL_CHECK_RESULT(__cl_result, #expr); } while (0)
static const bool CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS = false;
#else // HAVE_OPENCL
#ifndef _DEBUG
static bool isRaiseError()
{
@ -270,7 +234,6 @@ static const String getBuildExtraOptions()
static const bool CV_OPENCL_ENABLE_MEM_USE_HOST_PTR = utils::getConfigurationParameterBool("OPENCV_OPENCL_ENABLE_MEM_USE_HOST_PTR", true);
static const size_t CV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR = utils::getConfigurationParameterSizeT("OPENCV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR", 4);
#endif // HAVE_OPENCL
struct UMat2D
{
@ -331,7 +294,7 @@ static uint64 crc64( const uchar* data, size_t size, uint64 crc0=0 )
return ~crc;
}
#if defined HAVE_OPENCL && OPENCV_HAVE_FILESYSTEM_SUPPORT
#if OPENCV_HAVE_FILESYSTEM_SUPPORT
struct OpenCLBinaryCacheConfigurator
{
cv::String cache_path_;
@ -872,7 +835,6 @@ static bool g_isOpenCVActivated = false;
bool haveOpenCL()
{
CV_TRACE_FUNCTION();
#ifdef HAVE_OPENCL
static bool g_isOpenCLInitialized = false;
static bool g_isOpenCLAvailable = false;
@ -902,9 +864,6 @@ bool haveOpenCL()
g_isOpenCLInitialized = true;
}
return g_isOpenCLAvailable;
#else
return false;
#endif
}
bool useOpenCL()
@ -924,14 +883,12 @@ bool useOpenCL()
return data.useOpenCL > 0;
}
#ifdef HAVE_OPENCL
bool isOpenCLActivated()
{
if (!g_isOpenCVActivated)
return false; // prevent unnecessary OpenCL activation via useOpenCL()->haveOpenCL() calls
return useOpenCL();
}
#endif
void setUseOpenCL(bool flag)
{
@ -1958,7 +1915,6 @@ static unsigned int getSVMCapabilitiesMask()
} // namespace
#endif
#ifdef HAVE_OPENCL
static size_t getProgramCountLimit()
{
static bool initialized = false;
@ -1970,7 +1926,6 @@ static size_t getProgramCountLimit()
}
return count;
}
#endif
struct Context::Impl
{
@ -3553,8 +3508,6 @@ internal::ProgramEntry::operator ProgramSource&() const
/////////////////////////////////////////// Program /////////////////////////////////////////////
#ifdef HAVE_OPENCL
static
cv::String joinBuildOptions(const cv::String& a, const cv::String& b)
{
@ -3968,10 +3921,6 @@ struct Program::Impl
String sourceName_;
};
#else // HAVE_OPENCL
struct Program::Impl : public DummyImpl {};
#endif // HAVE_OPENCL
Program::Program() { p = 0; }
@ -4014,7 +3963,6 @@ bool Program::create(const ProgramSource& src,
p->release();
p = NULL;
}
#ifdef HAVE_OPENCL
p = new Impl(src, buildflags, errmsg);
if(!p->handle)
{
@ -4022,18 +3970,11 @@ bool Program::create(const ProgramSource& src,
p = 0;
}
return p != 0;
#else
CV_OPENCL_NO_SUPPORT();
#endif
}
void* Program::ptr() const
{
#ifdef HAVE_OPENCL
return p ? p->handle : 0;
#else
CV_OPENCL_NO_SUPPORT();
#endif
}
#ifndef OPENCV_REMOVE_DEPRECATED_API
@ -4056,44 +3997,30 @@ bool Program::write(String& bin) const
String Program::getPrefix() const
{
#ifdef HAVE_OPENCL
if(!p)
return String();
Context::Impl* ctx_ = Context::getDefault().getImpl();
CV_Assert(ctx_);
return cv::format("opencl=%s\nbuildflags=%s", ctx_->getPrefixString().c_str(), p->buildflags.c_str());
#else
CV_OPENCL_NO_SUPPORT();
#endif
}
String Program::getPrefix(const String& buildflags)
{
#ifdef HAVE_OPENCL
Context::Impl* ctx_ = Context::getDefault().getImpl();
CV_Assert(ctx_);
return cv::format("opencl=%s\nbuildflags=%s", ctx_->getPrefixString().c_str(), buildflags.c_str());
#else
CV_OPENCL_NO_SUPPORT();
#endif
}
#endif
#endif // OPENCV_REMOVE_DEPRECATED_API
void Program::getBinary(std::vector<char>& binary) const
{
#ifdef HAVE_OPENCL
CV_Assert(p && "Empty program");
p->getProgramBinary(binary);
#else
binary.clear();
CV_OPENCL_NO_SUPPORT();
#endif
}
Program Context::Impl::getProg(const ProgramSource& src,
const String& buildflags, String& errmsg)
{
#ifdef HAVE_OPENCL
size_t limit = getProgramCountLimit();
const ProgramSource::Impl* src_ = src.getImpl();
CV_Assert(src_);
@ -4145,9 +4072,6 @@ Program Context::Impl::getProg(const ProgramSource& src,
cacheList.push_front(key);
}
return prog;
#else
CV_OPENCL_NO_SUPPORT();
#endif
}
@ -4707,9 +4631,6 @@ public:
bool allocate(UMatData* u, int accessFlags, UMatUsageFlags usageFlags) const CV_OVERRIDE
{
#ifndef HAVE_OPENCL
return false;
#else
if(!u)
return false;
@ -4828,7 +4749,6 @@ public:
u->markHostCopyObsolete(true);
opencl_allocator_stats.onAllocate(u->size);
return true;
#endif // HAVE_OPENCL
}
/*void sync(UMatData* u) const
@ -6699,27 +6619,19 @@ struct Timer::Impl
void start()
{
#ifdef HAVE_OPENCL
CV_OCL_DBG_CHECK(clFinish((cl_command_queue)queue.ptr()));
timer.start();
#endif
}
void stop()
{
#ifdef HAVE_OPENCL
CV_OCL_DBG_CHECK(clFinish((cl_command_queue)queue.ptr()));
timer.stop();
#endif
}
uint64 durationNS() const
{
#ifdef HAVE_OPENCL
return (uint64)(timer.getTimeSec() * 1e9);
#else
return 0;
#endif
}
TickMeter timer;
@ -6746,13 +6658,6 @@ uint64 Timer::durationNS() const
return p->durationNS();
}
#ifndef HAVE_OPENCL
#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#endif
}} // namespace
#endif // HAVE_OPENCL

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,366 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include "opencv2/core/ocl_genbase.hpp"
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4100)
#pragma warning(disable : 4702)
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
namespace cv { namespace ocl {
static
CV_NORETURN void throw_no_ocl()
{
CV_Error(Error::OpenCLApiCallError, "OpenCV build without OpenCL support");
}
#define OCL_NOT_AVAILABLE() throw_no_ocl();
CV_EXPORTS_W bool haveOpenCL() { return false; }
CV_EXPORTS_W bool useOpenCL() { return false; }
CV_EXPORTS_W bool haveAmdBlas() { return false; }
CV_EXPORTS_W bool haveAmdFft() { return false; }
CV_EXPORTS_W void setUseOpenCL(bool flag) { /* nothing */ }
CV_EXPORTS_W void finish() { /* nothing */ }
CV_EXPORTS bool haveSVM() { return false; }
Device::Device() : p(NULL) { }
Device::Device(void* d) : p(NULL) { OCL_NOT_AVAILABLE(); }
Device::Device(const Device& d) : p(NULL) { }
Device& Device::operator=(const Device& d) { return *this; }
Device::~Device() { }
void Device::set(void* d) { OCL_NOT_AVAILABLE(); }
String Device::name() const { OCL_NOT_AVAILABLE(); }
String Device::extensions() const { OCL_NOT_AVAILABLE(); }
bool Device::isExtensionSupported(const String& extensionName) const { OCL_NOT_AVAILABLE(); }
String Device::version() const { OCL_NOT_AVAILABLE(); }
String Device::vendorName() const { OCL_NOT_AVAILABLE(); }
String Device::OpenCL_C_Version() const { OCL_NOT_AVAILABLE(); }
String Device::OpenCLVersion() const { OCL_NOT_AVAILABLE(); }
int Device::deviceVersionMajor() const { OCL_NOT_AVAILABLE(); }
int Device::deviceVersionMinor() const { OCL_NOT_AVAILABLE(); }
String Device::driverVersion() const { OCL_NOT_AVAILABLE(); }
void* Device::ptr() const { /*OCL_NOT_AVAILABLE();*/ return NULL; }
int Device::type() const { OCL_NOT_AVAILABLE(); }
int Device::addressBits() const { OCL_NOT_AVAILABLE(); }
bool Device::available() const { OCL_NOT_AVAILABLE(); }
bool Device::compilerAvailable() const { OCL_NOT_AVAILABLE(); }
bool Device::linkerAvailable() const { OCL_NOT_AVAILABLE(); }
int Device::doubleFPConfig() const { OCL_NOT_AVAILABLE(); }
int Device::singleFPConfig() const { OCL_NOT_AVAILABLE(); }
int Device::halfFPConfig() const { OCL_NOT_AVAILABLE(); }
bool Device::endianLittle() const { OCL_NOT_AVAILABLE(); }
bool Device::errorCorrectionSupport() const { OCL_NOT_AVAILABLE(); }
int Device::executionCapabilities() const { OCL_NOT_AVAILABLE(); }
size_t Device::globalMemCacheSize() const { OCL_NOT_AVAILABLE(); }
int Device::globalMemCacheType() const { OCL_NOT_AVAILABLE(); }
int Device::globalMemCacheLineSize() const { OCL_NOT_AVAILABLE(); }
size_t Device::globalMemSize() const { OCL_NOT_AVAILABLE(); }
size_t Device::localMemSize() const { OCL_NOT_AVAILABLE(); }
int Device::localMemType() const { return NO_LOCAL_MEM; }
bool Device::hostUnifiedMemory() const { OCL_NOT_AVAILABLE(); }
bool Device::imageSupport() const { OCL_NOT_AVAILABLE(); }
bool Device::imageFromBufferSupport() const { OCL_NOT_AVAILABLE(); }
uint Device::imagePitchAlignment() const { OCL_NOT_AVAILABLE(); }
uint Device::imageBaseAddressAlignment() const { OCL_NOT_AVAILABLE(); }
bool Device::intelSubgroupsSupport() const { OCL_NOT_AVAILABLE(); }
size_t Device::image2DMaxWidth() const { OCL_NOT_AVAILABLE(); }
size_t Device::image2DMaxHeight() const { OCL_NOT_AVAILABLE(); }
size_t Device::image3DMaxWidth() const { OCL_NOT_AVAILABLE(); }
size_t Device::image3DMaxHeight() const { OCL_NOT_AVAILABLE(); }
size_t Device::image3DMaxDepth() const { OCL_NOT_AVAILABLE(); }
size_t Device::imageMaxBufferSize() const { OCL_NOT_AVAILABLE(); }
size_t Device::imageMaxArraySize() const { OCL_NOT_AVAILABLE(); }
int Device::vendorID() const { OCL_NOT_AVAILABLE(); }
int Device::maxClockFrequency() const { OCL_NOT_AVAILABLE(); }
int Device::maxComputeUnits() const { OCL_NOT_AVAILABLE(); }
int Device::maxConstantArgs() const { OCL_NOT_AVAILABLE(); }
size_t Device::maxConstantBufferSize() const { OCL_NOT_AVAILABLE(); }
size_t Device::maxMemAllocSize() const { OCL_NOT_AVAILABLE(); }
size_t Device::maxParameterSize() const { OCL_NOT_AVAILABLE(); }
int Device::maxReadImageArgs() const { OCL_NOT_AVAILABLE(); }
int Device::maxWriteImageArgs() const { OCL_NOT_AVAILABLE(); }
int Device::maxSamplers() const { OCL_NOT_AVAILABLE(); }
size_t Device::maxWorkGroupSize() const { OCL_NOT_AVAILABLE(); }
int Device::maxWorkItemDims() const { OCL_NOT_AVAILABLE(); }
void Device::maxWorkItemSizes(size_t*) const { OCL_NOT_AVAILABLE(); }
int Device::memBaseAddrAlign() const { OCL_NOT_AVAILABLE(); }
int Device::nativeVectorWidthChar() const { OCL_NOT_AVAILABLE(); }
int Device::nativeVectorWidthShort() const { OCL_NOT_AVAILABLE(); }
int Device::nativeVectorWidthInt() const { OCL_NOT_AVAILABLE(); }
int Device::nativeVectorWidthLong() const { OCL_NOT_AVAILABLE(); }
int Device::nativeVectorWidthFloat() const { OCL_NOT_AVAILABLE(); }
int Device::nativeVectorWidthDouble() const { OCL_NOT_AVAILABLE(); }
int Device::nativeVectorWidthHalf() const { OCL_NOT_AVAILABLE(); }
int Device::preferredVectorWidthChar() const { OCL_NOT_AVAILABLE(); }
int Device::preferredVectorWidthShort() const { OCL_NOT_AVAILABLE(); }
int Device::preferredVectorWidthInt() const { OCL_NOT_AVAILABLE(); }
int Device::preferredVectorWidthLong() const { OCL_NOT_AVAILABLE(); }
int Device::preferredVectorWidthFloat() const { OCL_NOT_AVAILABLE(); }
int Device::preferredVectorWidthDouble() const { OCL_NOT_AVAILABLE(); }
int Device::preferredVectorWidthHalf() const { OCL_NOT_AVAILABLE(); }
size_t Device::printfBufferSize() const { OCL_NOT_AVAILABLE(); }
size_t Device::profilingTimerResolution() const { OCL_NOT_AVAILABLE(); }
/* static */
const Device& Device::getDefault()
{
static Device dummy;
return dummy;
}
Context::Context() : p(NULL) { }
Context::Context(int dtype) : p(NULL) { }
Context::~Context() { }
Context::Context(const Context& c) : p(NULL) { }
Context& Context::operator=(const Context& c) { return *this; }
bool Context::create() { return false; }
bool Context::create(int dtype) { return false; }
size_t Context::ndevices() const { return 0; }
const Device& Context::device(size_t idx) const { OCL_NOT_AVAILABLE(); }
Program Context::getProg(const ProgramSource& prog, const String& buildopt, String& errmsg) { OCL_NOT_AVAILABLE(); }
void Context::unloadProg(Program& prog) { }
/* static */
Context& Context::getDefault(bool initialize)
{
static Context dummy;
return dummy;
}
void* Context::ptr() const { return NULL; }
bool Context::useSVM() const { return false; }
void Context::setUseSVM(bool enabled) { }
Platform::Platform() : p(NULL) { }
Platform::~Platform() { }
Platform::Platform(const Platform&) : p(NULL) { }
Platform& Platform::operator=(const Platform&) { return *this; }
void* Platform::ptr() const { return NULL; }
/* static */
Platform& Platform::getDefault()
{
static Platform dummy;
return dummy;
}
void attachContext(const String& platformName, void* platformID, void* context, void* deviceID) { OCL_NOT_AVAILABLE(); }
void convertFromBuffer(void* cl_mem_buffer, size_t step, int rows, int cols, int type, UMat& dst) { OCL_NOT_AVAILABLE(); }
void convertFromImage(void* cl_mem_image, UMat& dst) { OCL_NOT_AVAILABLE(); }
void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device) { OCL_NOT_AVAILABLE(); }
Queue::Queue() : p(NULL) { }
Queue::Queue(const Context& c, const Device& d) : p(NULL) { OCL_NOT_AVAILABLE(); }
Queue::~Queue() { }
Queue::Queue(const Queue& q) {}
Queue& Queue::operator=(const Queue& q) { return *this; }
bool Queue::create(const Context& c, const Device& d) { OCL_NOT_AVAILABLE(); }
void Queue::finish() {}
void* Queue::ptr() const { return NULL; }
/* static */
Queue& Queue::getDefault()
{
static Queue dummy;
return dummy;
}
/// @brief Returns OpenCL command queue with enable profiling mode support
const Queue& Queue::getProfilingQueue() const { OCL_NOT_AVAILABLE(); }
KernelArg::KernelArg()
: flags(0), m(0), obj(0), sz(0), wscale(1), iwscale(1)
{
}
KernelArg::KernelArg(int _flags, UMat* _m, int _wscale, int _iwscale, const void* _obj, size_t _sz)
: flags(_flags), m(_m), obj(_obj), sz(_sz), wscale(_wscale), iwscale(_iwscale)
{
OCL_NOT_AVAILABLE();
}
KernelArg KernelArg::Constant(const Mat& m)
{
OCL_NOT_AVAILABLE();
}
Kernel::Kernel() : p(NULL) { }
Kernel::Kernel(const char* kname, const Program& prog) : p(NULL) { OCL_NOT_AVAILABLE(); }
Kernel::Kernel(const char* kname, const ProgramSource& prog, const String& buildopts, String* errmsg) : p(NULL) { OCL_NOT_AVAILABLE(); }
Kernel::~Kernel() { }
Kernel::Kernel(const Kernel& k) : p(NULL) { }
Kernel& Kernel::operator=(const Kernel& k) { return *this; }
bool Kernel::empty() const { return true; }
bool Kernel::create(const char* kname, const Program& prog) { OCL_NOT_AVAILABLE(); }
bool Kernel::create(const char* kname, const ProgramSource& prog, const String& buildopts, String* errmsg) { OCL_NOT_AVAILABLE(); }
int Kernel::set(int i, const void* value, size_t sz) { OCL_NOT_AVAILABLE(); }
int Kernel::set(int i, const Image2D& image2D) { OCL_NOT_AVAILABLE(); }
int Kernel::set(int i, const UMat& m) { OCL_NOT_AVAILABLE(); }
int Kernel::set(int i, const KernelArg& arg) { OCL_NOT_AVAILABLE(); }
bool Kernel::run(int dims, size_t globalsize[], size_t localsize[], bool sync, const Queue& q) { OCL_NOT_AVAILABLE(); }
bool Kernel::runTask(bool sync, const Queue& q) { OCL_NOT_AVAILABLE(); }
int64 Kernel::runProfiling(int dims, size_t globalsize[], size_t localsize[], const Queue& q) { OCL_NOT_AVAILABLE(); }
size_t Kernel::workGroupSize() const { OCL_NOT_AVAILABLE(); }
size_t Kernel::preferedWorkGroupSizeMultiple() const { OCL_NOT_AVAILABLE(); }
bool Kernel::compileWorkGroupSize(size_t wsz[]) const { OCL_NOT_AVAILABLE(); }
size_t Kernel::localMemSize() const { OCL_NOT_AVAILABLE(); }
void* Kernel::ptr() const { return NULL; }
Program::Program() : p(NULL) { }
Program::Program(const ProgramSource& src, const String& buildflags, String& errmsg) : p(NULL) { OCL_NOT_AVAILABLE(); }
Program::Program(const Program& prog) : p(NULL) { }
Program& Program::operator=(const Program& prog) { return *this; }
Program::~Program() { }
bool Program::create(const ProgramSource& src, const String& buildflags, String& errmsg) { OCL_NOT_AVAILABLE(); }
void* Program::ptr() const { return NULL; }
void Program::getBinary(std::vector<char>& binary) const { OCL_NOT_AVAILABLE(); }
bool Program::read(const String& buf, const String& buildflags) { OCL_NOT_AVAILABLE(); }
bool Program::write(String& buf) const { OCL_NOT_AVAILABLE(); }
const ProgramSource& Program::source() const { OCL_NOT_AVAILABLE(); }
String Program::getPrefix() const { OCL_NOT_AVAILABLE(); }
/* static */ String Program::getPrefix(const String& buildflags) { OCL_NOT_AVAILABLE(); }
ProgramSource::ProgramSource() : p(NULL) { }
ProgramSource::ProgramSource(const String& module, const String& name, const String& codeStr, const String& codeHash) : p(NULL) { }
ProgramSource::ProgramSource(const String& prog) : p(NULL) { }
ProgramSource::ProgramSource(const char* prog) : p(NULL) { }
ProgramSource::~ProgramSource() { }
ProgramSource::ProgramSource(const ProgramSource& prog) : p(NULL) { }
ProgramSource& ProgramSource::operator=(const ProgramSource& prog) { return *this; }
const String& ProgramSource::source() const { OCL_NOT_AVAILABLE(); }
ProgramSource::hash_t ProgramSource::hash() const { OCL_NOT_AVAILABLE(); }
/* static */ ProgramSource ProgramSource::fromBinary(const String& module, const String& name, const unsigned char* binary, const size_t size, const cv::String& buildOptions) { OCL_NOT_AVAILABLE(); }
/* static */ ProgramSource ProgramSource::fromSPIR(const String& module, const String& name, const unsigned char* binary, const size_t size, const cv::String& buildOptions) { OCL_NOT_AVAILABLE(); }
PlatformInfo::PlatformInfo() : p(NULL) { }
PlatformInfo::PlatformInfo(void* id) : p(NULL) { OCL_NOT_AVAILABLE(); }
PlatformInfo::~PlatformInfo() { }
PlatformInfo::PlatformInfo(const PlatformInfo& i) : p(NULL) { }
PlatformInfo& PlatformInfo::operator=(const PlatformInfo& i) { return *this; }
String PlatformInfo::name() const { OCL_NOT_AVAILABLE(); }
String PlatformInfo::vendor() const { OCL_NOT_AVAILABLE(); }
String PlatformInfo::version() const { OCL_NOT_AVAILABLE(); }
int PlatformInfo::deviceNumber() const { OCL_NOT_AVAILABLE(); }
void PlatformInfo::getDevice(Device& device, int d) const { OCL_NOT_AVAILABLE(); }
const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf) { OCL_NOT_AVAILABLE(); }
const char* typeToStr(int t) { OCL_NOT_AVAILABLE(); }
const char* memopTypeToStr(int t) { OCL_NOT_AVAILABLE(); }
const char* vecopTypeToStr(int t) { OCL_NOT_AVAILABLE(); }
const char* getOpenCLErrorString(int errorCode) { OCL_NOT_AVAILABLE(); }
String kernelToStr(InputArray _kernel, int ddepth, const char* name) { OCL_NOT_AVAILABLE(); }
void getPlatfomsInfo(std::vector<PlatformInfo>& platform_info) { OCL_NOT_AVAILABLE(); }
int predictOptimalVectorWidth(InputArray src1, InputArray src2, InputArray src3,
InputArray src4, InputArray src5, InputArray src6,
InputArray src7, InputArray src8, InputArray src9,
OclVectorStrategy strat)
{ OCL_NOT_AVAILABLE(); }
int checkOptimalVectorWidth(const int *vectorWidths,
InputArray src1, InputArray src2, InputArray src3,
InputArray src4, InputArray src5, InputArray src6,
InputArray src7, InputArray src8, InputArray src9,
OclVectorStrategy strat)
{ OCL_NOT_AVAILABLE(); }
int predictOptimalVectorWidthMax(InputArray src1, InputArray src2, InputArray src3,
InputArray src4, InputArray src5, InputArray src6,
InputArray src7, InputArray src8, InputArray src9)
{ OCL_NOT_AVAILABLE(); }
void buildOptionsAddMatrixDescription(String& buildOptions, const String& name, InputArray _m) { OCL_NOT_AVAILABLE(); }
Image2D::Image2D() : p(NULL) { }
Image2D::Image2D(const UMat &src, bool norm, bool alias) { OCL_NOT_AVAILABLE(); }
Image2D::Image2D(const Image2D & i) : p(NULL) { OCL_NOT_AVAILABLE(); }
Image2D::~Image2D() { }
Image2D& Image2D::operator=(const Image2D & i) { return *this; }
/* static */ bool Image2D::canCreateAlias(const UMat &u) { OCL_NOT_AVAILABLE(); }
/* static */ bool Image2D::isFormatSupported(int depth, int cn, bool norm) { OCL_NOT_AVAILABLE(); }
void* Image2D::ptr() const { return NULL; }
Timer::Timer(const Queue& q) : p(NULL) {}
Timer::~Timer() {}
void Timer::start() { OCL_NOT_AVAILABLE(); }
void Timer::stop() { OCL_NOT_AVAILABLE();}
uint64 Timer::durationNS() const { OCL_NOT_AVAILABLE(); }
MatAllocator* getOpenCLAllocator() { return NULL; }
internal::ProgramEntry::operator ProgramSource&() const { OCL_NOT_AVAILABLE(); }
}}
#if defined(_MSC_VER)
#pragma warning(pop)
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

View File

@ -983,7 +983,11 @@ void ORB_Impl::detectAndCompute( InputArray _image, InputArray _mask,
int descPatchSize = cvCeil(halfPatchSize*sqrt(2.0));
int border = std::max(edgeThreshold, std::max(descPatchSize, HARRIS_BLOCK_SIZE/2))+1;
#ifdef HAVE_OPENCL
bool useOCL = ocl::isOpenCLActivated() && OCL_FORCE_CHECK(_image.isUMat() || _descriptors.isUMat());
#else
bool useOCL = false;
#endif
Mat image = _image.getMat(), mask = _mask.getMat();
if( image.type() != CV_8UC1 )