Merge remote-tracking branch 'upstream/2.4' into merge-2.4

* #1538 from StevenPuttemans:bugfix_3283
* #1545 from alalek:ocl_test_fix_rng
* #1551 from alalek:cmake_install_win
* #1570 from ilya-lavrenov:ipp_warn_fix
* #1573 from alalek:perf_simple_strategy
* #1574 from alalek:svm_workaround
* #1576 from alalek:ocl_fix_cl_double
* #1577 from ilya-lavrenov:ocl_setto_opencl12
* #1578 from asmorkalov:android_fd_cp_fix
* #1579 from ilya-lavrenov:ocl_norm
* #1582 from sperrholz:ocl-arithm-additions
* #1586 from ilya-lavrenov:ocl_setto_win_fix
* #1589 from ilya-lavrenov:pr1582_fix
* #1591 from alalek:ocl_remove_cl_hpp_h
* #1592 from alalek:ocl_program_cache_update
* #1593 from ilya-lavrenov:ocl_war_on_double
* #1594 from ilya-lavrenov:ocl_perf
* #1595 from alalek:cl_code_cleanup
* #1596 from alalek:test_fix_run_py
* #1597 from alalek:ocl_fix_cleanup
* #1598 from alalek:ocl_fix_build_mac
* #1599 from ilya-lavrenov:ocl_mac_kernel_warnings
* #1601 from ilya-lavrenov:ocl_fix_tvl1_and_sparse
* #1602 from alalek:ocl_test_dump_info
* #1603 from ilya-lavrenov:ocl_disable_svm_noblas
* #1605 from alalek:ocl_fixes
* #1606 from ilya-lavrenov:ocl_imgproc
* #1607 from ilya-lavrenov:ocl_fft_cleanup
* #1608 from alalek:fix_warn_upd_haar
* #1609 from ilya-lavrenov:ocl_some_optimization
* #1610 from alalek:ocl_fix_perf_kalman
* #1612 from alalek:ocl_fix_string_info
* #1614 from ilya-lavrenov:ocl_svm_misprint
* #1616 from ilya-lavrenov:ocl_cvtColor
* #1617 from ilya-lavrenov:ocl_info
* #1622 from a0byte:2.4
* #1625 from ilya-lavrenov:to_string

Conflicts:
	cmake/OpenCVConfig.cmake
	cmake/OpenCVDetectPython.cmake
	cmake/OpenCVGenConfig.cmake
	modules/core/CMakeLists.txt
	modules/nonfree/src/surf.ocl.cpp
	modules/ocl/include/opencv2/ocl/ocl.hpp
	modules/ocl/include/opencv2/ocl/private/util.hpp
	modules/ocl/perf/main.cpp
	modules/ocl/src/arithm.cpp
	modules/ocl/src/cl_operations.cpp
	modules/ocl/src/cl_programcache.cpp
	modules/ocl/src/color.cpp
	modules/ocl/src/fft.cpp
	modules/ocl/src/filtering.cpp
	modules/ocl/src/gemm.cpp
	modules/ocl/src/haar.cpp
	modules/ocl/src/imgproc.cpp
	modules/ocl/src/matrix_operations.cpp
	modules/ocl/src/pyrlk.cpp
	modules/ocl/src/split_merge.cpp
	modules/ocl/src/svm.cpp
	modules/ocl/test/main.cpp
	modules/ocl/test/test_fft.cpp
	modules/ocl/test/test_moments.cpp
	modules/ocl/test/test_objdetect.cpp
	modules/ocl/test/test_optflow.cpp
	modules/ocl/test/utility.hpp
	modules/python/CMakeLists.txt
	modules/ts/include/opencv2/ts.hpp
	modules/ts/src/ts_perf.cpp
	samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp
This commit is contained in:
Alexander Alekhin
2013-10-15 18:43:37 +04:00
124 changed files with 3144 additions and 3195 deletions

View File

@@ -82,15 +82,6 @@ namespace cv
DEVICE_MEM_PM //persistent memory
};
//Get the global device memory and read/write type
//return 1 if unified memory system supported, otherwise return 0
CV_EXPORTS int getDevMemType(DevMemRW& rw_type, DevMemType& mem_type);
//Set the global device memory and read/write type,
//the newly generated oclMat will all use this type
//return -1 if the target type is unsupported, otherwise return 0
CV_EXPORTS int setDevMemType(DevMemRW rw_type = DEVICE_MEM_R_W, DevMemType mem_type = DEVICE_MEM_DEFAULT);
// these classes contain OpenCL runtime information
struct PlatformInfo;
@@ -113,6 +104,7 @@ namespace cv
std::vector<size_t> maxWorkItemSizes;
int maxComputeUnits;
size_t localMemorySize;
size_t maxMemAllocSize;
int deviceVersionMajor;
int deviceVersionMinor;
@@ -126,7 +118,6 @@ namespace cv
DeviceInfo();
};
//////////////////////////////// Initialization & Info ////////////////////////
struct PlatformInfo
{
@@ -193,32 +184,55 @@ namespace cv
return Context::getContext()->getOpenCLCommandQueuePtr();
}
bool CV_EXPORTS supportsFeature(FEATURE_TYPE featureType);
CV_EXPORTS bool supportsFeature(FEATURE_TYPE featureType);
void CV_EXPORTS finish();
CV_EXPORTS void finish();
enum BINARY_CACHE_MODE
{
CACHE_NONE = 0, // do not cache OpenCL binary
CACHE_DEBUG = 0x1 << 0, // cache OpenCL binary when built in debug mode
CACHE_RELEASE = 0x1 << 1, // default behavior, only cache when built in release mode
CACHE_ALL = CACHE_DEBUG | CACHE_RELEASE, // cache opencl binary
};
//! Enable or disable OpenCL program binary caching onto local disk
// After a program (*.cl files in opencl/ folder) is built at runtime, we allow the
// compiled OpenCL program to be cached to the path automatically as "path/*.clb"
// binary file, which will be reused when the OpenCV executable is started again.
//
// Caching mode is controlled by the following enums
// Notes
// 1. the feature is by default enabled when OpenCV is built in release mode.
// 2. the CACHE_DEBUG / CACHE_RELEASE flags only effectively work with MSVC compiler;
// for GNU compilers, the function always treats the build as release mode (enabled by default).
enum
{
CACHE_NONE = 0, // do not cache OpenCL binary
CACHE_DEBUG = 0x1 << 0, // cache OpenCL binary when built in debug mode (only work with MSVC)
CACHE_RELEASE = 0x1 << 1, // default behavior, only cache when built in release mode (only work with MSVC)
CACHE_ALL = CACHE_DEBUG | CACHE_RELEASE, // always cache opencl binary
};
// This feature is enabled by default.
CV_EXPORTS void setBinaryDiskCache(int mode = CACHE_RELEASE, cv::String path = "./");
//! set where binary cache to be saved to
CV_EXPORTS void setBinaryPath(const char *path);
struct ProgramSource
{
const char* name;
const char* programStr;
const char* programHash;
// Cache in memory by name (should be unique). Caching on disk disabled.
inline ProgramSource(const char* _name, const char* _programStr)
: name(_name), programStr(_programStr), programHash(NULL)
{
}
// Cache in memory by name (should be unique). Caching on disk uses programHash mark.
inline ProgramSource(const char* _name, const char* _programStr, const char* _programHash)
: name(_name), programStr(_programStr), programHash(_programHash)
{
}
};
//! Calls OpenCL kernel. Pass globalThreads = NULL, and cleanUp = true, to finally clean-up without executing.
//! Deprecated, will be replaced
CV_EXPORTS void openCLExecuteKernelInterop(Context *clCxt,
const cv::ocl::ProgramSource& source, String kernelName,
size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args,
int channels, int depth, const char *build_options);
class CV_EXPORTS oclMatExpr;
//////////////////////////////// oclMat ////////////////////////////////
class CV_EXPORTS oclMat
@@ -311,9 +325,9 @@ namespace cv
//! allocates new oclMatrix with specified device memory type.
void createEx(int rows, int cols, int type,
DevMemRW rw_type, DevMemType mem_type, void* hptr = 0);
DevMemRW rw_type, DevMemType mem_type);
void createEx(Size size, int type, DevMemRW rw_type,
DevMemType mem_type, void* hptr = 0);
DevMemType mem_type);
//! decreases reference counter;
// deallocate the data when reference counter reaches 0.
@@ -457,6 +471,14 @@ namespace cv
// supports all data types
CV_EXPORTS void divide(double scale, const oclMat &src1, oclMat &dst);
//! computes element-wise minimum of the two arrays (dst = min(src1, src2))
// supports all data types
CV_EXPORTS void min(const oclMat &src1, const oclMat &src2, oclMat &dst);
//! computes element-wise maximum of the two arrays (dst = max(src1, src2))
// supports all data types
CV_EXPORTS void max(const oclMat &src1, const oclMat &src2, oclMat &dst);
//! compares elements of two arrays (dst = src1 <cmpop> src2)
// supports all data types
CV_EXPORTS void compare(const oclMat &src1, const oclMat &src2, oclMat &dst, int cmpop);
@@ -465,6 +487,10 @@ namespace cv
// supports all data types
CV_EXPORTS void transpose(const oclMat &src, oclMat &dst);
//! computes element-wise absolute values of an array (dst = abs(src))
// supports all data types
CV_EXPORTS void abs(const oclMat &src, oclMat &dst);
//! computes element-wise absolute difference of two arrays (dst = abs(src1 - src2))
// supports all data types
CV_EXPORTS void absdiff(const oclMat &src1, const oclMat &src2, oclMat &dst);
@@ -1812,7 +1838,7 @@ namespace cv
// output -
// keys = {1, 2, 3} (CV_8UC1)
// values = {6,2, 10,5, 4,3} (CV_8UC2)
void CV_EXPORTS sortByKey(oclMat& keys, oclMat& values, int method, bool isGreaterThan = false);
CV_EXPORTS void sortByKey(oclMat& keys, oclMat& values, int method, bool isGreaterThan = false);
/*!Base class for MOG and MOG2!*/
class CV_EXPORTS BackgroundSubtractor
{
@@ -2011,6 +2037,7 @@ namespace cv
private:
oclMat samples_ocl;
};
/*!*************** SVM *************!*/
class CV_EXPORTS CvSVM_OCL : public CvSVM
{
@@ -2030,6 +2057,7 @@ namespace cv
void create_kernel();
void create_solver();
};
/*!*************** END *************!*/
}
}

View File

@@ -0,0 +1,135 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other oclMaterials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#if !defined(DUMP_INFO_STDOUT) && !defined(DUMP_INFO_XML)
#error Invalid usage
#endif
#if !defined(DUMP_INFO_STDOUT)
#define DUMP_INFO_STDOUT(...)
#endif
#if !defined(DUMP_INFO_XML)
#define DUMP_INFO_XML(...)
#endif
#include <sstream>
static std::string bytesToStringRepr(size_t value)
{
size_t b = value % 1024;
value /= 1024;
size_t kb = value % 1024;
value /= 1024;
size_t mb = value % 1024;
value /= 1024;
size_t gb = value;
std::ostringstream stream;
if (gb > 0)
stream << gb << " GB ";
if (mb > 0)
stream << mb << " MB ";
if (kb > 0)
stream << kb << " kB ";
if (b > 0)
stream << b << " B";
return stream.str();
}
static void dumpOpenCLDevice()
{
using namespace cv::ocl;
try
{
const cv::ocl::DeviceInfo& deviceInfo = cv::ocl::Context::getContext()->getDeviceInfo();
const char* deviceTypeStr = deviceInfo.deviceType == CVCL_DEVICE_TYPE_CPU
? "CPU" :
(deviceInfo.deviceType == CVCL_DEVICE_TYPE_GPU ? "GPU" : "unknown");
DUMP_INFO_STDOUT("Device type", deviceTypeStr);
DUMP_INFO_XML("cv_ocl_deviceType", deviceTypeStr);
DUMP_INFO_STDOUT("Platform name", deviceInfo.platform->platformName);
DUMP_INFO_XML("cv_ocl_platformName", deviceInfo.platform->platformName);
DUMP_INFO_STDOUT("Device name", deviceInfo.deviceName);
DUMP_INFO_XML("cv_ocl_deviceName", deviceInfo.deviceName);
DUMP_INFO_STDOUT("Device version", deviceInfo.deviceVersion);
DUMP_INFO_XML("cv_ocl_deviceVersion", deviceInfo.deviceVersion);
DUMP_INFO_STDOUT("Compute units", deviceInfo.maxComputeUnits);
DUMP_INFO_XML("cv_ocl_maxComputeUnits", deviceInfo.maxComputeUnits);
DUMP_INFO_STDOUT("Max work group size", deviceInfo.maxWorkGroupSize);
DUMP_INFO_XML("cv_ocl_maxWorkGroupSize", deviceInfo.maxWorkGroupSize);
std::string localMemorySizeStr = bytesToStringRepr(deviceInfo.localMemorySize);
DUMP_INFO_STDOUT("Local memory size", localMemorySizeStr.c_str());
DUMP_INFO_XML("cv_ocl_localMemorySize", deviceInfo.localMemorySize);
std::string maxMemAllocSizeStr = bytesToStringRepr(deviceInfo.maxMemAllocSize);
DUMP_INFO_STDOUT("Max memory allocation size", maxMemAllocSizeStr.c_str());
DUMP_INFO_XML("cv_ocl_maxMemAllocSize", deviceInfo.maxMemAllocSize);
const char* doubleSupportStr = deviceInfo.haveDoubleSupport ? "Yes" : "No";
DUMP_INFO_STDOUT("Double support", doubleSupportStr);
DUMP_INFO_XML("cv_ocl_haveDoubleSupport", deviceInfo.haveDoubleSupport);
const char* isUnifiedMemoryStr = deviceInfo.isUnifiedMemory ? "Yes" : "No";
DUMP_INFO_STDOUT("Unified memory", isUnifiedMemoryStr);
DUMP_INFO_XML("cv_ocl_isUnifiedMemory", deviceInfo.isUnifiedMemory);
}
catch (...)
{
DUMP_INFO_STDOUT("OpenCL device", "not available");
DUMP_INFO_XML("cv_ocl", "not available");
}
}
#undef DUMP_INFO_STDOUT
#undef DUMP_INFO_XML

View File

@@ -0,0 +1,115 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other oclMaterials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors as is and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_OCL_PRIVATE_OPENCL_UTILS_HPP__
#define __OPENCV_OCL_PRIVATE_OPENCL_UTILS_HPP__
#include "opencv2/ocl/cl_runtime/cl_runtime.hpp"
#include <vector>
#include <string>
namespace cl_utils {
inline cl_int getPlatforms(std::vector<cl_platform_id>& platforms)
{
cl_uint n = 0;
cl_int err = ::clGetPlatformIDs(0, NULL, &n);
if (err != CL_SUCCESS)
return err;
platforms.clear(); platforms.resize(n);
err = ::clGetPlatformIDs(n, &platforms[0], NULL);
if (err != CL_SUCCESS)
return err;
return CL_SUCCESS;
}
inline cl_int getDevices(cl_platform_id platform, cl_device_type type, std::vector<cl_device_id>& devices)
{
cl_uint n = 0;
cl_int err = ::clGetDeviceIDs(platform, type, 0, NULL, &n);
if (err != CL_SUCCESS)
return err;
devices.clear(); devices.resize(n);
err = ::clGetDeviceIDs(platform, type, n, &devices[0], NULL);
if (err != CL_SUCCESS)
return err;
return CL_SUCCESS;
}
template <typename Functor, typename ObjectType, typename T>
inline cl_int getScalarInfo(Functor f, ObjectType obj, cl_uint name, T& param)
{
return f(obj, name, sizeof(T), &param, NULL);
}
template <typename Functor, typename ObjectType>
inline cl_int getStringInfo(Functor f, ObjectType obj, cl_uint name, std::string& param)
{
::size_t required;
cl_int err = f(obj, name, 0, NULL, &required);
if (err != CL_SUCCESS)
return err;
param.clear();
if (required > 0)
{
std::vector<char> buf(required + 1, char(0));
err = f(obj, name, required, &buf[0], NULL);
if (err != CL_SUCCESS)
return err;
param = &buf[0];
}
return CL_SUCCESS;
};
} // namespace cl_utils
#endif // __OPENCV_OCL_PRIVATE_OPENCL_UTILS_HPP__

View File

@@ -77,6 +77,8 @@ inline cl_command_queue getClCommandQueue(const Context *ctx)
return *(cl_command_queue*)(ctx->getOpenCLCommandQueuePtr());
}
CV_EXPORTS cv::Mutex& getInitializationMutex();
enum openCLMemcpyKind
{
clMemcpyHostToDevice = 0,
@@ -84,39 +86,39 @@ enum openCLMemcpyKind
clMemcpyDeviceToDevice
};
///////////////////////////OpenCL call wrappers////////////////////////////
void CV_EXPORTS openCLMallocPitch(Context *clCxt, void **dev_ptr, size_t *pitch,
CV_EXPORTS void openCLMallocPitch(Context *clCxt, void **dev_ptr, size_t *pitch,
size_t widthInBytes, size_t height);
void CV_EXPORTS openCLMallocPitchEx(Context *clCxt, void **dev_ptr, size_t *pitch,
CV_EXPORTS void openCLMallocPitchEx(Context *clCxt, void **dev_ptr, size_t *pitch,
size_t widthInBytes, size_t height, DevMemRW rw_type, DevMemType mem_type);
void CV_EXPORTS openCLMemcpy2D(Context *clCxt, void *dst, size_t dpitch,
CV_EXPORTS void openCLMemcpy2D(Context *clCxt, void *dst, size_t dpitch,
const void *src, size_t spitch,
size_t width, size_t height, openCLMemcpyKind kind, int channels = -1);
void CV_EXPORTS openCLCopyBuffer2D(Context *clCxt, void *dst, size_t dpitch, int dst_offset,
CV_EXPORTS void openCLCopyBuffer2D(Context *clCxt, void *dst, size_t dpitch, int dst_offset,
const void *src, size_t spitch,
size_t width, size_t height, int src_offset);
void CV_EXPORTS openCLFree(void *devPtr);
cl_mem CV_EXPORTS openCLCreateBuffer(Context *clCxt, size_t flag, size_t size);
void CV_EXPORTS openCLReadBuffer(Context *clCxt, cl_mem dst_buffer, void *host_buffer, size_t size);
cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt,
CV_EXPORTS void openCLFree(void *devPtr);
CV_EXPORTS cl_mem openCLCreateBuffer(Context *clCxt, size_t flag, size_t size);
CV_EXPORTS void openCLReadBuffer(Context *clCxt, cl_mem dst_buffer, void *host_buffer, size_t size);
CV_EXPORTS cl_kernel openCLGetKernelFromSource(const Context *clCxt,
const cv::ocl::ProgramEntry* source, String kernelName);
cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt,
CV_EXPORTS cl_kernel openCLGetKernelFromSource(const Context *clCxt,
const cv::ocl::ProgramEntry* source, String kernelName, const char *build_options);
void CV_EXPORTS openCLVerifyKernel(const Context *clCxt, cl_kernel kernel, size_t *localThreads);
void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const cv::ocl::ProgramEntry* source, String kernelName, std::vector< std::pair<size_t, const void *> > &args,
CV_EXPORTS void openCLVerifyKernel(const Context *clCxt, cl_kernel kernel, size_t *localThreads);
CV_EXPORTS void openCLExecuteKernel(Context *clCxt , const cv::ocl::ProgramEntry* source, String kernelName, std::vector< std::pair<size_t, const void *> > &args,
int globalcols , int globalrows, size_t blockSize = 16, int kernel_expand_depth = -1, int kernel_expand_channel = -1);
void CV_EXPORTS openCLExecuteKernel_(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName,
CV_EXPORTS void openCLExecuteKernel_(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName,
size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options);
void CV_EXPORTS openCLExecuteKernel(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName, size_t globalThreads[3],
CV_EXPORTS void openCLExecuteKernel(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth);
void CV_EXPORTS openCLExecuteKernel(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName, size_t globalThreads[3],
CV_EXPORTS void openCLExecuteKernel(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels,
int depth, const char *build_options);
cl_mem CV_EXPORTS load_constant(cl_context context, cl_command_queue command_queue, const void *value,
CV_EXPORTS cl_mem load_constant(cl_context context, cl_command_queue command_queue, const void *value,
const size_t size);
cl_mem CV_EXPORTS openCLMalloc(cl_context clCxt, size_t size, cl_mem_flags flags, void *host_ptr);
CV_EXPORTS cl_mem openCLMalloc(cl_context clCxt, size_t size, cl_mem_flags flags, void *host_ptr);
enum FLUSH_MODE
{
@@ -125,9 +127,9 @@ enum FLUSH_MODE
DISABLE
};
void CV_EXPORTS openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName, size_t globalThreads[3],
CV_EXPORTS void openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, FLUSH_MODE finish_mode = DISABLE);
void CV_EXPORTS openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName, size_t globalThreads[3],
CV_EXPORTS void openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry* source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels,
int depth, const char *build_options, FLUSH_MODE finish_mode = DISABLE);
@@ -135,8 +137,8 @@ void CV_EXPORTS openCLExecuteKernel2(Context *clCxt, const cv::ocl::ProgramEntry
// note:
// 1. there is no memory management. User need to explicitly release the resource
// 2. for faster clamping, there is no buffer padding for the constructed texture
cl_mem CV_EXPORTS bindTexture(const oclMat &mat);
void CV_EXPORTS releaseTexture(cl_mem& texture);
CV_EXPORTS cl_mem bindTexture(const oclMat &mat);
CV_EXPORTS void releaseTexture(cl_mem& texture);
//Represents an image texture object
class CV_EXPORTS TextureCL
@@ -163,15 +165,11 @@ private:
// bind oclMat to OpenCL image textures and retunrs an TextureCL object
// note:
// for faster clamping, there is no buffer padding for the constructed texture
Ptr<TextureCL> CV_EXPORTS bindTexturePtr(const oclMat &mat);
CV_EXPORTS Ptr<TextureCL> bindTexturePtr(const oclMat &mat);
// returns whether the current context supports image2d_t format or not
bool CV_EXPORTS support_image2d(Context *clCxt = Context::getContext());
bool CV_EXPORTS isCpuDevice();
size_t CV_EXPORTS queryWaveFrontSize(cl_kernel kernel);
CV_EXPORTS bool isCpuDevice();
CV_EXPORTS size_t queryWaveFrontSize(cl_kernel kernel);
inline size_t divUp(size_t total, size_t grain)
@@ -189,24 +187,6 @@ inline size_t roundUp(size_t sz, size_t n)
return result;
}
//! Calls a kernel, by string. Pass globalThreads = NULL, and cleanUp = true, to finally clean-up without executing.
CV_EXPORTS double openCLExecuteKernelInterop(Context *clCxt,
const cv::ocl::ProgramEntry* source, String kernelName,
size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args,
int channels, int depth, const char *build_options,
bool finish = true, bool measureKernelTime = false,
bool cleanUp = true);
//! Calls a kernel, by file. Pass globalThreads = NULL, and cleanUp = true, to finally clean-up without executing.
CV_EXPORTS double openCLExecuteKernelInterop(Context *clCxt,
const cv::ocl::ProgramEntry* source, const int numFiles, String kernelName,
size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args,
int channels, int depth, const char *build_options,
bool finish = true, bool measureKernelTime = false,
bool cleanUp = true);
}//namespace ocl
}//namespace cv