hopefully, fixed compile errors on Win & Linux; fixed getMatVector() so core & imgproc tests now pass; fixed doc builder errors
This commit is contained in:
parent
d8c8339bec
commit
d3076c5014
@ -378,7 +378,7 @@ Calculates the covariance matrix of a set of vectors.
|
|||||||
|
|
||||||
.. ocv:function:: void calcCovarMatrix( const Mat* samples, int nsamples, Mat& covar, Mat& mean, int flags, int ctype=CV_64F)
|
.. ocv:function:: void calcCovarMatrix( const Mat* samples, int nsamples, Mat& covar, Mat& mean, int flags, int ctype=CV_64F)
|
||||||
|
|
||||||
.. ocv:function:: void calcCovarMatrix( InputArray samples, OutputArray covar, OutputArray mean, int flags, int ctype=CV_64F)
|
.. ocv:function:: void calcCovarMatrix( InputArray samples, OutputArray covar, InputOutputArray mean, int flags, int ctype=CV_64F)
|
||||||
|
|
||||||
.. ocv:pyfunction:: cv2.calcCovarMatrix(samples, flags[, covar[, mean[, ctype]]]) -> covar, mean
|
.. ocv:pyfunction:: cv2.calcCovarMatrix(samples, flags[, covar[, mean[, ctype]]]) -> covar, mean
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class CV_EXPORTS Kernel;
|
|||||||
class CV_EXPORTS Program;
|
class CV_EXPORTS Program;
|
||||||
class CV_EXPORTS ProgramSource;
|
class CV_EXPORTS ProgramSource;
|
||||||
class CV_EXPORTS Queue;
|
class CV_EXPORTS Queue;
|
||||||
|
|
||||||
class CV_EXPORTS Device
|
class CV_EXPORTS Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -211,10 +211,9 @@ public:
|
|||||||
bool create(int dtype);
|
bool create(int dtype);
|
||||||
size_t ndevices() const;
|
size_t ndevices() const;
|
||||||
const Device& device(size_t idx) const;
|
const Device& device(size_t idx) const;
|
||||||
int dtype() const;
|
|
||||||
Program getProg(const ProgramSource& prog,
|
Program getProg(const ProgramSource& prog,
|
||||||
const String& buildopt, String& errmsg);
|
const String& buildopt, String& errmsg);
|
||||||
|
|
||||||
static Context& getDefault();
|
static Context& getDefault();
|
||||||
void* ptr() const;
|
void* ptr() const;
|
||||||
protected:
|
protected:
|
||||||
@ -231,12 +230,12 @@ public:
|
|||||||
~Queue();
|
~Queue();
|
||||||
Queue(const Queue& q);
|
Queue(const Queue& q);
|
||||||
Queue& operator = (const Queue& q);
|
Queue& operator = (const Queue& q);
|
||||||
|
|
||||||
bool create(const Context& c=Context(), const Device& d=Device());
|
bool create(const Context& c=Context(), const Device& d=Device());
|
||||||
void finish();
|
void finish();
|
||||||
void* ptr() const;
|
void* ptr() const;
|
||||||
static Queue& getDefault();
|
static Queue& getDefault();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct Impl;
|
struct Impl;
|
||||||
Impl* p;
|
Impl* p;
|
||||||
@ -451,7 +450,7 @@ public:
|
|||||||
|
|
||||||
const String& source() const;
|
const String& source() const;
|
||||||
hash_t hash() const;
|
hash_t hash() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct Impl;
|
struct Impl;
|
||||||
Impl* p;
|
Impl* p;
|
||||||
|
@ -1276,6 +1276,17 @@ void _InputArray::getMatVector(std::vector<Mat>& mv) const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( k == STD_VECTOR_MAT )
|
||||||
|
{
|
||||||
|
const std::vector<Mat>& v = *(const std::vector<Mat>*)obj;
|
||||||
|
size_t i, n = v.size();
|
||||||
|
mv.resize(n);
|
||||||
|
|
||||||
|
for( i = 0; i < n; i++ )
|
||||||
|
mv[i] = v[i];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( k == STD_VECTOR_UMAT )
|
if( k == STD_VECTOR_UMAT )
|
||||||
{
|
{
|
||||||
const std::vector<UMat>& v = *(const std::vector<UMat>*)obj;
|
const std::vector<UMat>& v = *(const std::vector<UMat>*)obj;
|
||||||
|
@ -391,7 +391,7 @@ typedef struct _cl_buffer_region {
|
|||||||
#define CL_MEM_USE_HOST_PTR (1 << 3)
|
#define CL_MEM_USE_HOST_PTR (1 << 3)
|
||||||
#define CL_MEM_ALLOC_HOST_PTR (1 << 4)
|
#define CL_MEM_ALLOC_HOST_PTR (1 << 4)
|
||||||
#define CL_MEM_COPY_HOST_PTR (1 << 5)
|
#define CL_MEM_COPY_HOST_PTR (1 << 5)
|
||||||
// reserved (1 << 6)
|
// reserved (1 << 6)
|
||||||
#define CL_MEM_HOST_WRITE_ONLY (1 << 7)
|
#define CL_MEM_HOST_WRITE_ONLY (1 << 7)
|
||||||
#define CL_MEM_HOST_READ_ONLY (1 << 8)
|
#define CL_MEM_HOST_READ_ONLY (1 << 8)
|
||||||
#define CL_MEM_HOST_NO_ACCESS (1 << 9)
|
#define CL_MEM_HOST_NO_ACCESS (1 << 9)
|
||||||
@ -627,13 +627,13 @@ static void* initOpenCLAndLoad(const char* funcname)
|
|||||||
{
|
{
|
||||||
handle = LoadLibraryA("OpenCL.dll");
|
handle = LoadLibraryA("OpenCL.dll");
|
||||||
initialized = true;
|
initialized = true;
|
||||||
g_haveOpenCL = handle != 0 && GetProcAddressA(handle, oclFuncToCheck) != 0;
|
g_haveOpenCL = handle != 0 && GetProcAddress(handle, oclFuncToCheck) != 0;
|
||||||
}
|
}
|
||||||
if(!handle)
|
if(!handle)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return funcname ? (void*)GetProcAddressA(handle, funcname) : 0;
|
return funcname ? (void*)GetProcAddress(handle, funcname) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__linux)
|
#elif defined(__linux)
|
||||||
@ -649,16 +649,16 @@ static void* initOpenCLAndLoad(const char* funcname)
|
|||||||
{
|
{
|
||||||
if(!initialized)
|
if(!initialized)
|
||||||
{
|
{
|
||||||
handle = dlopen("libOpenCL.so");
|
handle = dlopen("libOpenCL.so", RTLD_LAZY);
|
||||||
if(!handle)
|
if(!handle)
|
||||||
handle = dlopen("libCL.so");
|
handle = dlopen("libCL.so", RTLD_LAZY);
|
||||||
initialized = true;
|
initialized = true;
|
||||||
g_haveOpenCL = handle != 0 && dlsym(handle, oclFuncToCheck) != 0;
|
g_haveOpenCL = handle != 0 && dlsym(handle, oclFuncToCheck) != 0;
|
||||||
}
|
}
|
||||||
if(!handle)
|
if(!handle)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return funcname ? (void*)dlsym(handle, funcname) : 0;
|
return funcname ? (void*)dlsym(handle, funcname) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -726,9 +726,9 @@ OCL_FUNC(cl_int, clGetDeviceInfo,
|
|||||||
|
|
||||||
OCL_FUNC(cl_int, clGetDeviceIDs,
|
OCL_FUNC(cl_int, clGetDeviceIDs,
|
||||||
(cl_platform_id platform,
|
(cl_platform_id platform,
|
||||||
cl_device_type device_type,
|
cl_device_type device_type,
|
||||||
cl_uint num_entries,
|
cl_uint num_entries,
|
||||||
cl_device_id * devices,
|
cl_device_id * devices,
|
||||||
cl_uint * num_devices),
|
cl_uint * num_devices),
|
||||||
(platform, device_type, num_entries, devices, num_devices))
|
(platform, device_type, num_entries, devices, num_devices))
|
||||||
|
|
||||||
@ -755,17 +755,17 @@ OCL_FUNC_P(cl_context, clCreateContextFromType,
|
|||||||
(properties, device_type, pfn_notify, user_data, errcode_ret))
|
(properties, device_type, pfn_notify, user_data, errcode_ret))
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clGetContextInfo,
|
OCL_FUNC(cl_int, clGetContextInfo,
|
||||||
(cl_context context,
|
(cl_context context,
|
||||||
cl_context_info param_name,
|
cl_context_info param_name,
|
||||||
size_t param_value_size,
|
size_t param_value_size,
|
||||||
void * param_value,
|
void * param_value,
|
||||||
size_t * param_value_size_ret),
|
size_t * param_value_size_ret),
|
||||||
(context, param_name, param_value_size,
|
(context, param_name, param_value_size,
|
||||||
param_value, param_value_size_ret))
|
param_value, param_value_size_ret))
|
||||||
*/
|
*/
|
||||||
OCL_FUNC_P(cl_command_queue, clCreateCommandQueue,
|
OCL_FUNC_P(cl_command_queue, clCreateCommandQueue,
|
||||||
(cl_context context,
|
(cl_context context,
|
||||||
cl_device_id device,
|
cl_device_id device,
|
||||||
cl_command_queue_properties properties,
|
cl_command_queue_properties properties,
|
||||||
cl_int * errcode_ret),
|
cl_int * errcode_ret),
|
||||||
(context, device, properties, errcode_ret))
|
(context, device, properties, errcode_ret))
|
||||||
@ -803,7 +803,7 @@ OCL_FUNC_P(cl_mem, clCreateImage,
|
|||||||
(cl_context context,
|
(cl_context context,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
const cl_image_format * image_format,
|
const cl_image_format * image_format,
|
||||||
const cl_image_desc * image_desc,
|
const cl_image_desc * image_desc,
|
||||||
void * host_ptr,
|
void * host_ptr,
|
||||||
cl_int * errcode_ret),
|
cl_int * errcode_ret),
|
||||||
(context, flags, image_format, image_desc, host_ptr, errcode_ret))
|
(context, flags, image_format, image_desc, host_ptr, errcode_ret))
|
||||||
@ -850,7 +850,7 @@ OCL_FUNC(cl_int, clGetKernelArgInfo,
|
|||||||
void * param_value,
|
void * param_value,
|
||||||
size_t * param_value_size_ret),
|
size_t * param_value_size_ret),
|
||||||
(kernel, arg_indx, param_name, param_value_size, param_value, param_value_size_ret))
|
(kernel, arg_indx, param_name, param_value_size, param_value, param_value_size_ret))
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clEnqueueReadImage,
|
OCL_FUNC(cl_int, clEnqueueReadImage,
|
||||||
(cl_command_queue command_queue,
|
(cl_command_queue command_queue,
|
||||||
cl_mem image,
|
cl_mem image,
|
||||||
@ -955,7 +955,7 @@ OCL_FUNC_P(void*, clEnqueueMapImage,
|
|||||||
event_wait_list, event, errcode_ret))
|
event_wait_list, event, errcode_ret))
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clRetainProgram, (cl_program program), (program))
|
OCL_FUNC(cl_int, clRetainProgram, (cl_program program), (program))
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clGetKernelInfo,
|
OCL_FUNC(cl_int, clGetKernelInfo,
|
||||||
(cl_kernel kernel,
|
(cl_kernel kernel,
|
||||||
cl_kernel_info param_name,
|
cl_kernel_info param_name,
|
||||||
@ -995,7 +995,7 @@ OCL_FUNC(cl_int, clBuildProgram,
|
|||||||
(cl_program program,
|
(cl_program program,
|
||||||
cl_uint num_devices,
|
cl_uint num_devices,
|
||||||
const cl_device_id * device_list,
|
const cl_device_id * device_list,
|
||||||
const char * options,
|
const char * options,
|
||||||
void (CL_CALLBACK * pfn_notify)(cl_program, void *),
|
void (CL_CALLBACK * pfn_notify)(cl_program, void *),
|
||||||
void * user_data),
|
void * user_data),
|
||||||
(program, num_devices, device_list, options, pfn_notify, user_data))
|
(program, num_devices, device_list, options, pfn_notify, user_data))
|
||||||
@ -1016,7 +1016,7 @@ OCL_FUNC(cl_int, clGetProgramBuildInfo,
|
|||||||
void * param_value,
|
void * param_value,
|
||||||
size_t * param_value_size_ret),
|
size_t * param_value_size_ret),
|
||||||
(program, device, param_name, param_value_size, param_value, param_value_size_ret))
|
(program, device, param_name, param_value_size, param_value, param_value_size_ret))
|
||||||
|
|
||||||
OCL_FUNC_P(cl_kernel, clCreateKernel,
|
OCL_FUNC_P(cl_kernel, clCreateKernel,
|
||||||
(cl_program program,
|
(cl_program program,
|
||||||
const char * kernel_name,
|
const char * kernel_name,
|
||||||
@ -1040,7 +1040,7 @@ OCL_FUNC(cl_int, clGetKernelWorkGroupInfo,
|
|||||||
void * param_value,
|
void * param_value,
|
||||||
size_t * param_value_size_ret),
|
size_t * param_value_size_ret),
|
||||||
(kernel, device, param_name, param_value_size, param_value, param_value_size_ret))
|
(kernel, device, param_name, param_value_size, param_value, param_value_size_ret))
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clFinish, (cl_command_queue command_queue), (command_queue))
|
OCL_FUNC(cl_int, clFinish, (cl_command_queue command_queue), (command_queue))
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clEnqueueReadBuffer,
|
OCL_FUNC(cl_int, clEnqueueReadBuffer,
|
||||||
@ -1048,7 +1048,7 @@ OCL_FUNC(cl_int, clEnqueueReadBuffer,
|
|||||||
cl_mem buffer,
|
cl_mem buffer,
|
||||||
cl_bool blocking_read,
|
cl_bool blocking_read,
|
||||||
size_t offset,
|
size_t offset,
|
||||||
size_t size,
|
size_t size,
|
||||||
void * ptr,
|
void * ptr,
|
||||||
cl_uint num_events_in_wait_list,
|
cl_uint num_events_in_wait_list,
|
||||||
const cl_event * event_wait_list,
|
const cl_event * event_wait_list,
|
||||||
@ -1061,12 +1061,12 @@ OCL_FUNC(cl_int, clEnqueueReadBufferRect,
|
|||||||
cl_mem buffer,
|
cl_mem buffer,
|
||||||
cl_bool blocking_read,
|
cl_bool blocking_read,
|
||||||
const size_t * buffer_offset,
|
const size_t * buffer_offset,
|
||||||
const size_t * host_offset,
|
const size_t * host_offset,
|
||||||
const size_t * region,
|
const size_t * region,
|
||||||
size_t buffer_row_pitch,
|
size_t buffer_row_pitch,
|
||||||
size_t buffer_slice_pitch,
|
size_t buffer_slice_pitch,
|
||||||
size_t host_row_pitch,
|
size_t host_row_pitch,
|
||||||
size_t host_slice_pitch,
|
size_t host_slice_pitch,
|
||||||
void * ptr,
|
void * ptr,
|
||||||
cl_uint num_events_in_wait_list,
|
cl_uint num_events_in_wait_list,
|
||||||
const cl_event * event_wait_list,
|
const cl_event * event_wait_list,
|
||||||
@ -1076,14 +1076,14 @@ OCL_FUNC(cl_int, clEnqueueReadBufferRect,
|
|||||||
event_wait_list, event))
|
event_wait_list, event))
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clEnqueueWriteBuffer,
|
OCL_FUNC(cl_int, clEnqueueWriteBuffer,
|
||||||
(cl_command_queue command_queue,
|
(cl_command_queue command_queue,
|
||||||
cl_mem buffer,
|
cl_mem buffer,
|
||||||
cl_bool blocking_write,
|
cl_bool blocking_write,
|
||||||
size_t offset,
|
size_t offset,
|
||||||
size_t size,
|
size_t size,
|
||||||
const void * ptr,
|
const void * ptr,
|
||||||
cl_uint num_events_in_wait_list,
|
cl_uint num_events_in_wait_list,
|
||||||
const cl_event * event_wait_list,
|
const cl_event * event_wait_list,
|
||||||
cl_event * event),
|
cl_event * event),
|
||||||
(command_queue, buffer, blocking_write, offset, size, ptr,
|
(command_queue, buffer, blocking_write, offset, size, ptr,
|
||||||
num_events_in_wait_list, event_wait_list, event))
|
num_events_in_wait_list, event_wait_list, event))
|
||||||
@ -1093,12 +1093,12 @@ OCL_FUNC(cl_int, clEnqueueWriteBufferRect,
|
|||||||
cl_mem buffer,
|
cl_mem buffer,
|
||||||
cl_bool blocking_write,
|
cl_bool blocking_write,
|
||||||
const size_t * buffer_offset,
|
const size_t * buffer_offset,
|
||||||
const size_t * host_offset,
|
const size_t * host_offset,
|
||||||
const size_t * region,
|
const size_t * region,
|
||||||
size_t buffer_row_pitch,
|
size_t buffer_row_pitch,
|
||||||
size_t buffer_slice_pitch,
|
size_t buffer_slice_pitch,
|
||||||
size_t host_row_pitch,
|
size_t host_row_pitch,
|
||||||
size_t host_slice_pitch,
|
size_t host_slice_pitch,
|
||||||
const void * ptr,
|
const void * ptr,
|
||||||
cl_uint num_events_in_wait_list,
|
cl_uint num_events_in_wait_list,
|
||||||
const cl_event * event_wait_list,
|
const cl_event * event_wait_list,
|
||||||
@ -1107,26 +1107,26 @@ OCL_FUNC(cl_int, clEnqueueWriteBufferRect,
|
|||||||
region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch,
|
region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch,
|
||||||
host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event))
|
host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event))
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clEnqueueFillBuffer,
|
/*OCL_FUNC(cl_int, clEnqueueFillBuffer,
|
||||||
(cl_command_queue command_queue,
|
(cl_command_queue command_queue,
|
||||||
cl_mem buffer,
|
cl_mem buffer,
|
||||||
const void * pattern,
|
const void * pattern,
|
||||||
size_t pattern_size,
|
size_t pattern_size,
|
||||||
size_t offset,
|
size_t offset,
|
||||||
size_t size,
|
size_t size,
|
||||||
cl_uint num_events_in_wait_list,
|
cl_uint num_events_in_wait_list,
|
||||||
const cl_event * event_wait_list,
|
const cl_event * event_wait_list,
|
||||||
cl_event * event),
|
cl_event * event),
|
||||||
(command_queue, buffer, pattern, pattern_size, offset, size,
|
(command_queue, buffer, pattern, pattern_size, offset, size,
|
||||||
num_events_in_wait_list, event_wait_list, event))
|
num_events_in_wait_list, event_wait_list, event))*/
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clEnqueueCopyBuffer,
|
OCL_FUNC(cl_int, clEnqueueCopyBuffer,
|
||||||
(cl_command_queue command_queue,
|
(cl_command_queue command_queue,
|
||||||
cl_mem src_buffer,
|
cl_mem src_buffer,
|
||||||
cl_mem dst_buffer,
|
cl_mem dst_buffer,
|
||||||
size_t src_offset,
|
size_t src_offset,
|
||||||
size_t dst_offset,
|
size_t dst_offset,
|
||||||
size_t size,
|
size_t size,
|
||||||
cl_uint num_events_in_wait_list,
|
cl_uint num_events_in_wait_list,
|
||||||
const cl_event * event_wait_list,
|
const cl_event * event_wait_list,
|
||||||
cl_event * event),
|
cl_event * event),
|
||||||
@ -1134,12 +1134,12 @@ OCL_FUNC(cl_int, clEnqueueCopyBuffer,
|
|||||||
size, num_events_in_wait_list, event_wait_list, event))
|
size, num_events_in_wait_list, event_wait_list, event))
|
||||||
|
|
||||||
OCL_FUNC(cl_int, clEnqueueCopyBufferRect,
|
OCL_FUNC(cl_int, clEnqueueCopyBufferRect,
|
||||||
(cl_command_queue command_queue,
|
(cl_command_queue command_queue,
|
||||||
cl_mem src_buffer,
|
cl_mem src_buffer,
|
||||||
cl_mem dst_buffer,
|
cl_mem dst_buffer,
|
||||||
const size_t * src_origin,
|
const size_t * src_origin,
|
||||||
const size_t * dst_origin,
|
const size_t * dst_origin,
|
||||||
const size_t * region,
|
const size_t * region,
|
||||||
size_t src_row_pitch,
|
size_t src_row_pitch,
|
||||||
size_t src_slice_pitch,
|
size_t src_slice_pitch,
|
||||||
size_t dst_row_pitch,
|
size_t dst_row_pitch,
|
||||||
@ -1154,7 +1154,7 @@ OCL_FUNC(cl_int, clEnqueueCopyBufferRect,
|
|||||||
OCL_FUNC_P(void*, clEnqueueMapBuffer,
|
OCL_FUNC_P(void*, clEnqueueMapBuffer,
|
||||||
(cl_command_queue command_queue,
|
(cl_command_queue command_queue,
|
||||||
cl_mem buffer,
|
cl_mem buffer,
|
||||||
cl_bool blocking_map,
|
cl_bool blocking_map,
|
||||||
cl_map_flags map_flags,
|
cl_map_flags map_flags,
|
||||||
size_t offset,
|
size_t offset,
|
||||||
size_t size,
|
size_t size,
|
||||||
@ -1737,7 +1737,6 @@ struct Context::Impl
|
|||||||
|
|
||||||
cl_context handle;
|
cl_context handle;
|
||||||
std::vector<Device> devices;
|
std::vector<Device> devices;
|
||||||
int dtype;
|
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
|
||||||
typedef ProgramSource::hash_t hash_t;
|
typedef ProgramSource::hash_t hash_t;
|
||||||
@ -1766,11 +1765,6 @@ Context::Context(int dtype)
|
|||||||
create(dtype);
|
create(dtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Context::dtype() const
|
|
||||||
{
|
|
||||||
return p ? p->dtype : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Context::create(int dtype0)
|
bool Context::create(int dtype0)
|
||||||
{
|
{
|
||||||
if( !haveOpenCL() )
|
if( !haveOpenCL() )
|
||||||
@ -2113,9 +2107,8 @@ int Kernel::set(int i, const KernelArg& arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clSetKernelArg(p->handle, (cl_uint)(i+1), sizeof(size_t), &arg.m->offset);
|
clSetKernelArg(p->handle, (cl_uint)(i+2), sizeof(size_t)*(dims-1), &arg.m->step.p[0]);
|
||||||
clSetKernelArg(p->handle, (cl_uint)(i+1), sizeof(size_t)*(dims-1), &arg.m->step.p[0]);
|
clSetKernelArg(p->handle, (cl_uint)(i+3), sizeof(cl_int)*dims, &arg.m->size.p[0]);
|
||||||
clSetKernelArg(p->handle, (cl_uint)(i+2), sizeof(cl_int)*dims, &arg.m->size.p[0]);
|
|
||||||
return i + 4;
|
return i + 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2249,13 +2242,13 @@ struct Program::Impl
|
|||||||
const Context& ctx = Context::getDefault();
|
const Context& ctx = Context::getDefault();
|
||||||
const Device& dev = Device::getDefault();
|
const Device& dev = Device::getDefault();
|
||||||
const char* pos0 = _buf.c_str();
|
const char* pos0 = _buf.c_str();
|
||||||
char* pos1 = strchr(pos0, '\n');
|
const char* pos1 = strchr(pos0, '\n');
|
||||||
if(!pos1)
|
if(!pos1)
|
||||||
return;
|
return;
|
||||||
char* pos2 = strchr(pos1+1, '\n');
|
const char* pos2 = strchr(pos1+1, '\n');
|
||||||
if(!pos2)
|
if(!pos2)
|
||||||
return;
|
return;
|
||||||
char* pos3 = strchr(pos2+1, '\n');
|
const char* pos3 = strchr(pos2+1, '\n');
|
||||||
if(!pos3)
|
if(!pos3)
|
||||||
return;
|
return;
|
||||||
size_t prefixlen = (pos3 - pos0)+1;
|
size_t prefixlen = (pos3 - pos0)+1;
|
||||||
@ -2580,6 +2573,9 @@ public:
|
|||||||
u->markHostCopyObsolete(false);
|
u->markHostCopyObsolete(false);
|
||||||
clReleaseMemObject((cl_mem)u->handle);
|
clReleaseMemObject((cl_mem)u->handle);
|
||||||
u->currAllocator = u->prevAllocator;
|
u->currAllocator = u->prevAllocator;
|
||||||
|
if(u->data && u->copyOnMap())
|
||||||
|
fastFree(u->data);
|
||||||
|
u->data = u->origdata;
|
||||||
if(u->refcount == 0)
|
if(u->refcount == 0)
|
||||||
u->currAllocator->deallocate(u);
|
u->currAllocator->deallocate(u);
|
||||||
}
|
}
|
||||||
@ -2898,4 +2894,3 @@ MatAllocator* getOpenCLAllocator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -877,14 +877,14 @@ TLSData::TLSData()
|
|||||||
{
|
{
|
||||||
if( tlsKey == TLS_OUT_OF_INDEXES )
|
if( tlsKey == TLS_OUT_OF_INDEXES )
|
||||||
{
|
{
|
||||||
tlsRNGKey = TlsAlloc();
|
tlsKey = TlsAlloc();
|
||||||
CV_Assert(tlsRNGKey != TLS_OUT_OF_INDEXES);
|
CV_Assert(tlsKey != TLS_OUT_OF_INDEXES);
|
||||||
}
|
}
|
||||||
TLSData* d = (TLSData*)TlsGetValue( tlsKey );
|
TLSData* d = (TLSData*)TlsGetValue( tlsKey );
|
||||||
if( !d )
|
if( !d )
|
||||||
{
|
{
|
||||||
d = new TLSData;
|
d = new TLSData;
|
||||||
TlsSetValue( tlsRNGKey, d );
|
TlsSetValue( tlsKey, d );
|
||||||
}
|
}
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -548,7 +548,7 @@ Mat UMat::getMat(int accessFlags) const
|
|||||||
Mat hdr(dims, size.p, type(), u->data + offset, step.p);
|
Mat hdr(dims, size.p, type(), u->data + offset, step.p);
|
||||||
hdr.refcount = &u->refcount;
|
hdr.refcount = &u->refcount;
|
||||||
hdr.u = u;
|
hdr.u = u;
|
||||||
hdr.datastart = u->data;
|
hdr.datastart = hdr.data = u->data;
|
||||||
hdr.datalimit = hdr.dataend = u->data + u->size;
|
hdr.datalimit = hdr.dataend = u->data + u->size;
|
||||||
CV_XADD(hdr.refcount, 1);
|
CV_XADD(hdr.refcount, 1);
|
||||||
return hdr;
|
return hdr;
|
||||||
@ -565,24 +565,24 @@ void* UMat::handle(int accessFlags) const
|
|||||||
CV_Assert(u->refcount == 0);
|
CV_Assert(u->refcount == 0);
|
||||||
u->currAllocator->unmap(u);
|
u->currAllocator->unmap(u);
|
||||||
}
|
}
|
||||||
else if( u->refcount > 0 && (accessFlags & ACCESS_WRITE) )
|
/*else if( u->refcount > 0 && (accessFlags & ACCESS_WRITE) )
|
||||||
{
|
{
|
||||||
CV_Error(Error::StsError,
|
CV_Error(Error::StsError,
|
||||||
"it's not allowed to access UMat handle for writing "
|
"it's not allowed to access UMat handle for writing "
|
||||||
"while it's mapped; call Mat::release() first for all its mappings");
|
"while it's mapped; call Mat::release() first for all its mappings");
|
||||||
}
|
}*/
|
||||||
return u->handle;
|
return u->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMat::ndoffset(size_t* ofs) const
|
void UMat::ndoffset(size_t* ofs) const
|
||||||
{
|
{
|
||||||
// offset = step[0]*ofs[0] + step[1]*ofs[1] + step[2]*ofs[2] + ...;
|
// offset = step[0]*ofs[0] + step[1]*ofs[1] + step[2]*ofs[2] + ...;
|
||||||
size_t t = offset;
|
size_t val = offset;
|
||||||
for( int i = 0; i < dims; i++ )
|
for( int i = 0; i < dims; i++ )
|
||||||
{
|
{
|
||||||
size_t s = step.p[i];
|
size_t s = step.p[i];
|
||||||
ofs[i] = t / s;
|
ofs[i] = val / s;
|
||||||
t -= ofs[i]*s;
|
val -= ofs[i]*s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user