OpenCV 4.12.0
开源计算机视觉
加载中...
搜索中...
无匹配项
cv::ocl::Kernel 类参考

#include <opencv2/core/ocl.hpp>

cv::ocl::Kernel 的协作图

公共成员函数

 Kernel () CV_NOEXCEPT
 
 Kernel (const char *kname, const Program &prog)
 
 Kernel (const char *kname, const ProgramSource &prog, const String &buildopts=String(), String *errmsg=0)
 
 Kernel (const Kernel &k)
 
 Kernel (Kernel &&k) CV_NOEXCEPT
 
 ~Kernel ()
 
template<typename... _Tps>
Kernelargs (const _Tps &... kernel_args)
 设置 OpenCL Kernel 参数。 避免直接使用 set(i, ...) 方法。
 
bool compileWorkGroupSize (size_t wsz[]) const
 
bool create (const char *kname, const Program &prog)
 
bool create (const char *kname, const ProgramSource &prog, const String &buildopts, String *errmsg=0)
 
bool empty () const
 
size_t localMemSize () const
 
Kerneloperator= (const Kernel &k)
 
Kerneloperator= (Kernel &&k) CV_NOEXCEPT
 
size_t preferedWorkGroupSizeMultiple () const
 
void * ptr () const
 
bool run (int dims, size_t globalsize[], size_t localsize[], bool sync, const Queue &q=Queue())
 运行 OpenCL kernel(globalsize 值可能会被调整)
 
bool run_ (int dims, size_t globalsize[], size_t localsize[], bool sync, const Queue &q=Queue())
 运行 OpenCL kernel。
 
int64 runProfiling (int dims, size_t globalsize[], size_t localsize[], const Queue &q=Queue())
 类似于同步的 run_() 调用,并返回 kernel 执行时间。
 
bool runTask (bool sync, const Queue &q=Queue())
 
template<typename _Tp >
int set (int i, const _Tp &value)
 
int set (int i, const Image2D &image2D)
 
int set (int i, const KernelArg &arg)
 
int set (int i, const UMat &m)
 
int set (int i, const void *value, size_t sz)
 
size_t workGroupSize () const
 

保护成员函数

template<typename _Tp0 >
int set_args_ (int i, const _Tp0 &a0)
 
template<typename _Tp0 , typename... _Tps>
int set_args_ (int i, const _Tp0 &a0, const _Tps &... rest_args)
 

保护属性

Impl * p
 

构造函数 & 析构函数文档

◆ Kernel() [1/5]

cv::ocl::Kernel::Kernel ( )

◆ Kernel() [2/5]

cv::ocl::Kernel::Kernel ( const char * kname,
const Program & prog )

◆ Kernel() [3/5]

cv::ocl::Kernel::Kernel ( const char * kname,
const ProgramSource & prog,
const String & buildopts = String(),
String * errmsg = 0 )

◆ ~Kernel()

cv::ocl::Kernel::~Kernel ( )

◆ Kernel() [4/5]

cv::ocl::Kernel::Kernel ( const Kernel & k)

◆ Kernel() [5/5]

cv::ocl::Kernel::Kernel ( Kernel(内核) && k)

成员函数文档

◆ args()

template<typename... _Tps>
Kernel & cv::ocl::Kernel::args ( const _Tps &... kernel_args)
inline

设置 OpenCL Kernel 参数。 避免直接使用 set(i, ...) 方法。

bool ok = kernel
.args(
srcUMat, dstUMat,
(float)some_float_param
).run(ndims, globalSize, localSize);
if (!ok) return false;

◆ compileWorkGroupSize()

bool cv::ocl::Kernel::compileWorkGroupSize ( size_t wsz[]) const

◆ create() [1/2]

bool cv::ocl::Kernel::create ( const char * kname,
const Program & prog )

◆ create() [2/2]

bool cv::ocl::Kernel::create ( const char * kname,
const ProgramSource & prog,
const String & buildopts,
String * errmsg = 0 )

◆ empty()

bool cv::ocl::Kernel::empty ( ) const

◆ localMemSize()

size_t cv::ocl::Kernel::localMemSize ( ) const

◆ operator=() [1/2]

Kernel & cv::ocl::Kernel::operator= ( const Kernel & k)

◆ operator=() [2/2]

Kernel & cv::ocl::Kernel::operator= ( Kernel(内核) && k)

◆ preferedWorkGroupSizeMultiple()

size_t cv::ocl::Kernel::preferedWorkGroupSizeMultiple ( ) const

◆ ptr()

void * cv::ocl::Kernel::ptr ( ) const

◆ run()

bool cv::ocl::Kernel::run ( int dims,
size_t globalsize[],
size_t localsize[],
bool sync,
const Queue & q = Queue() )

运行 OpenCL kernel(globalsize 值可能会被调整)

参数
dims工作问题维度。 它是 globalsize 和 localsize 的长度。 它可以是 1、2 或 3。
globalsize每个维度的工作项。 它不是传递给 OpenCL 的最终 globalsize。 每个维度都将调整为最接近的可被 localsize 中对应值整除的整数。 如果 localsize 为 NULL,它仍将根据 dims 进行调整。 调整后的值大于或等于原始值。
localsize每个维度的工作组大小。
sync指定是否等待 OpenCL 计算完成后再返回。
q命令队列
注意
如果您的 kernel 代码不支持调整后的 globalsize,请使用 run_()

◆ run_()

bool cv::ocl::Kernel::run_ ( int dims,
size_t globalsize[],
size_t localsize[],
bool sync,
const Queue & q = Queue() )

运行 OpenCL kernel。

参数
dims工作问题维度。 它是 globalsize 和 localsize 的长度。 它可以是 1、2 或 3。
globalsize每个维度的工作项。 此值将传递给 OpenCL 而不会更改。
localsize每个维度的工作组大小。
sync指定是否等待 OpenCL 计算完成后再返回。
q命令队列

◆ runProfiling()

int64 cv::ocl::Kernel::runProfiling ( int dims,
size_t globalsize[],
size_t localsize[],
const Queue & q = Queue() )

类似于同步的 run_() 调用,并返回 kernel 执行时间。

可以单独使用 OpenCL 命令队列(带有 CL_QUEUE_PROFILING_ENABLE)

返回
以纳秒为单位的执行时间,如果出错则为负数

◆ runTask()

bool cv::ocl::Kernel::runTask ( bool sync,
const Queue & q = Queue() )

◆ set() [1/5]

template<typename _Tp >
int cv::ocl::Kernel::set ( int i,
const _Tp &  )
inline

◆ set() [2/5]

int cv::ocl::Kernel::set ( int i,
const Image2D & image2D )

◆ set() [3/5]

int cv::ocl::Kernel::set ( int i,
const KernelArg & arg )

◆ set() [4/5]

int cv::ocl::Kernel::set ( int i,
const UMat & m )

◆ set() [5/5]

int cv::ocl::Kernel::set ( int i,
const void * ,
size_t sz )

◆ set_args_() [1/2]

template<typename _Tp0 >
int cv::ocl::Kernel::set_args_ ( int i,
const _Tp0 & a0 )
inlineprotected

◆ set_args_() [2/2]

template<typename _Tp0 , typename... _Tps>
int cv::ocl::Kernel::set_args_ ( int i,
const _Tp0 & a0,
const _Tps &... rest_args )
inlineprotected
此函数的调用图如下

◆ workGroupSize()

size_t cv::ocl::Kernel::workGroupSize ( ) const

成员数据文档

◆ p

Impl* cv::ocl::Kernel::p
保护

此类的文档是从以下文件生成的