40 :
ICLKernel(), _input(nullptr), _output(nullptr)
66 std::set<std::string> build_opts;
68 if(non_max_suppression)
70 build_opts.emplace(
"-DUSE_MAXSUPPRESSION");
74 const std::string
kernel_name = std::string(
"fast_corners");
75 _kernel =
create_kernel(compile_context, kernel_name, build_opts);
79 _kernel.setArg<cl_float>(idx,
static_cast<float>(
threshold));
83 constexpr
unsigned int num_elems_read_per_iteration = 7;
84 constexpr
unsigned int num_rows_read_per_iteration = 3;
95 ICLKernel::configure_internal(win);
124 unsigned int idx = 0;
133 :
ICLKernel(), _input(nullptr), _corners(nullptr), _num_buffer(nullptr)
151 _num_buffer = num_buffers;
153 std::set<std::string> build_opts;
157 build_opts.emplace(
"-DUPDATE_NUMBER");
161 const std::string
kernel_name = std::string(
"copy_to_keypoint");
162 _kernel =
create_kernel(compile_context, kernel_name, build_opts);
170 _kernel.setArg<cl_uint>(idx++,
offset);
171 _kernel.setArg(idx++, *_num_buffer);
172 _kernel.setArg(idx++, _corners->
cl_buffer());
179 ICLKernel::configure_internal(win);
197 static const unsigned int zero_init = 0;
198 queue.enqueueWriteBuffer(*_num_buffer, CL_FALSE, 0,
sizeof(
unsigned int), &zero_init);
204 unsigned int idx = 0;
BorderMode
Methods available to handle borders.
Window first_slice_window_2D() const
First 2D slice of the window.
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
unsigned int top
top of the border
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
const Window & window() const
The maximum window the kernel can be executed on.
void enqueue(IGCKernel &kernel, const Window &window, const gles::NDRange &lws=gles::NDRange(1U, 1U, 1U))
Add the kernel to the command queue with the given window.
CLCopyToArrayKernel()
Default constructor.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
#define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t)
Container for 2D border size.
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
1 channel, 1 U8 per channel
std::string to_string(T &&value)
Convert integer and float values to string.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
std::string lower_string(const std::string &val)
Lower a given string.
Common interface for all the OpenCL kernels.
void run(const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue...
bool slide_window_slice_2D(Window &slice) const
Slide the passed 2D window slice.
Copyright (c) 2017-2021 Arm Limited.
virtual ValidRegion valid_region() const =0
Valid region of the tensor.
const std::string & string_from_border_mode(BorderMode border_mode)
Translates a given border mode policy to a string.
T x() const
Alias to access the size of the first dimension.
Implementation of a rectangular access pattern.
cl::Kernel create_kernel(const CLCompileContext &ctx, const std::string &kernel_name, const std::set< std::string > &build_opts=std::set< std::string >())
Creates an opencl kernel using a compile context.
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
Interface for OpenCL Array.
bool update_window_and_padding(Window &win, Ts &&... patterns)
Update window and padding size for each of the access patterns.
CLFastCornersKernel()
Default constructor.
Class to describe a number of elements in each dimension.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
void configure(const ICLImage *input, bool update_number, ICLKeyPointArray *corners, cl::Buffer *num_buffers)
Initialise the kernel.
Implementation of a row access pattern.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
static constexpr unsigned int num_arguments_per_2D_tensor()
Returns the number of arguments enqueued per 2D tensor object.
unsigned int left
left of the border
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void add_2D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx...
Interface for OpenCL tensor.
void configure(const ICLImage *input, ICLImage *output, float threshold, bool non_max_suppression, BorderMode border_mode)
Initialise the kernel.
Borders are left undefined.
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context...
Wrapper to configure the Khronos OpenCL C++ header.
size_t max_num_values() const
Maximum number of values which can be stored in this array.
__kernel void non_max_suppression(__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes)
This function performs Non maxima suppression over a 3x3 window on a given image. ...
unsigned int num_elems_processed_per_iteration
void run(const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue...
virtual const cl::Buffer & cl_buffer() const =0
Interface to be implemented by the child class to return a reference to the OpenCL buffer containing ...
SimpleTensor< T > threshold(const SimpleTensor< T > &src, T threshold, T false_value, T true_value, ThresholdType type, T upper)
Describe a multidimensional execution window.
Coordinates anchor
Anchor for the start of the valid region.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)
BorderSize border_size() const override
The size of the border for that kernel.