OpenCV-OpenCL interop (PR #4072):

Commits:
added new function, cv::ocl::attachContext(String& platformName, void* platformID, void* context, void* deviceID) which allow to attach externally created OpenCL context to OpenCV.
add definitions of clRetainDevice, clRetainContext funcs
removed definitions for clRetainContext, clRetainDevice
fixed build issue under Linux
fixed uninitialized vars, replace dbgassert in error handling
remove function which is not ready yet
add new function, cv::ocl::convertFromBuffer(int rows, int cols, int type, void* cl_mem_obj, UMat& dst, UMatUsageFlags usageFlags = cv::USAGE_DEFAULT) which attaches user allocated OpenCL clBuffer to UMat
uncommented clGetMemObjectInfo definition (otherwise prevent opencv build)
fixed build issue on linux and android
add step parameter to cv::ocl::convertFromBuffer func
suppress compile-time warning
added sample opencl-opencv interoperability (showcase for cv::ocl::convertFromBuffer func)
CMakeLists.txt modified to not create sample build script if OpenCL SDK not found in system
fixed build issue (apple opencl include dir and spaces in CMake file)
added call to clRetainContext for attachContext func and call to clRetainMemObject for convertFromBuffer func
uncommented clRetainMemObject definition
added comments and cleanup
add local path to cmake modules search dirs (instead of replacing)
remove REQUIRED for find_package call (sample build together with opencv). need to try standalone sample build
opencl-interop sample moved to standalone build
set minimum version requirement for sample's cmake to 3.1
put cmake_minimum_required under condition, so do not check if samples not builded
remove code dups for setSize, updateContinuityFlag, and finalizeHdr
commented out cmake_minimum_required(VERSION 3.1)
add safety check for cmake version
add convertFromImage func and update opencl-interop sample
uncommented clGetImageInfo defs
uncommented clEnqueueCopyImageToBuffer defs
fixed clEnqueueCopyImageToBuffer defs
add doxygen comments
remove doxygen @fn tag
try to restart buildbot
add doxygen comments to directx interop funcs
remove internal header, use fwd declarations in affected compile units instead
This commit is contained in:
Vladimir Dudnik
2015-05-27 23:22:33 +03:00
committed by Alexander Alekhin
parent 6ab9df5208
commit 217dd63e02
7 changed files with 1423 additions and 18 deletions

View File

@@ -46,6 +46,13 @@
namespace cv {
// forward decls, implementation is below in this file
void setSize(UMat& m, int _dims, const int* _sz, const size_t* _steps,
bool autoSteps = false);
void updateContinuityFlag(UMat& m);
void finalizeHdr(UMat& m);
// it should be a prime number for the best hash function
enum { UMAT_NLOCKS = 31 };
static Mutex umatLocks[UMAT_NLOCKS];
@@ -123,8 +130,8 @@ void swap( UMat& a, UMat& b )
}
static inline void setSize( UMat& m, int _dims, const int* _sz,
const size_t* _steps, bool autoSteps=false )
void setSize( UMat& m, int _dims, const int* _sz,
const size_t* _steps, bool autoSteps )
{
CV_Assert( 0 <= _dims && _dims <= CV_MAX_DIM );
if( m.dims != _dims )
@@ -176,7 +183,8 @@ static inline void setSize( UMat& m, int _dims, const int* _sz,
}
}
static void updateContinuityFlag(UMat& m)
void updateContinuityFlag(UMat& m)
{
int i, j;
for( i = 0; i < m.dims; i++ )
@@ -199,7 +207,7 @@ static void updateContinuityFlag(UMat& m)
}
static void finalizeHdr(UMat& m)
void finalizeHdr(UMat& m)
{
updateContinuityFlag(m);
int d = m.dims;
@@ -207,6 +215,7 @@ static void finalizeHdr(UMat& m)
m.rows = m.cols = -1;
}
UMat Mat::getUMat(int accessFlags, UMatUsageFlags usageFlags) const
{
UMat hdr;