40 : _input(nullptr), _output_x(nullptr), _output_y(nullptr), _run_sobel_x(false), _run_sobel_y(false), _border_size(0)
59 _run_sobel_x = output_x !=
nullptr;
60 _run_sobel_y = output_y !=
nullptr;
75 _border_size =
BorderSize(border_undefined ? 0 : 2, 2);
78 std::set<std::string> build_opts;
82 build_opts.insert(
"-DGRAD_X");
87 build_opts.insert(
"-DGRAD_Y");
91 const std::string
kernel_name = std::string(
"sobel_separable1x5");
92 _kernel =
create_kernel(compile_context, kernel_name, build_opts);
96 constexpr
unsigned int num_elems_read_per_iteration = 16;
97 constexpr
unsigned int num_elems_written_per_iteration = 8;
110 ICLKernel::configure_internal(win);
132 unsigned int idx = 0;
143 : _input_x(nullptr), _input_y(nullptr), _output_x(nullptr), _output_y(nullptr), _run_sobel_x(false), _run_sobel_y(false)
161 _run_sobel_x = output_x !=
nullptr;
162 _run_sobel_y = output_y !=
nullptr;
178 _output_x = output_x;
179 _output_y = output_y;
182 std::set<std::string> build_opts;
186 build_opts.insert(
"-DGRAD_X");
191 build_opts.insert(
"-DGRAD_Y");
195 const std::string
kernel_name = std::string(
"sobel_separable5x1");
196 _kernel =
create_kernel(compile_context, kernel_name, build_opts);
202 constexpr
unsigned int num_elems_written_per_iteration = 8;
203 constexpr
unsigned int num_elems_read_per_iteration = 8;
204 constexpr
unsigned int num_rows_read_per_iteration = 5;
218 ICLKernel::configure_internal(win);
240 unsigned int idx = 0;
246 _kernel.setArg(idx++, 0 );
Window first_slice_window_2D() const
First 2D slice of the window.
unsigned int top
top of the border
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
void run(const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue...
const Window & window() const
The maximum window the kernel can be executed on.
BorderSize border_size() const override
The size of the border for that kernel.
void add_2D_tensor_argument_if(bool cond, 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 ...
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.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
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.
CLSobel5x5VertKernel()
Default constructor: initialize all the pointers to nullptr and parameters to zero.
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.
Window calculate_max_window_horizontal(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
BorderSize border_size() const override
The size of the border for that kernel.
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.
void configure(const ICLTensor *input_x, const ICLTensor *input_y, ICLTensor *output_x, ICLTensor *output_y, bool border_undefined)
Initialise the kernel's source, destination and border.
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.
bool update_window_and_padding(Window &win, Ts &&... patterns)
Update window and padding size for each of the access patterns.
Class to describe a number of elements in each dimension.
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.
unsigned int left
left of the border
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
1 channel, 1 S16 per channel
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void run(const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue...
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.
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context...
Wrapper to configure the Khronos OpenCL C++ header.
void configure(const ICLTensor *input, ICLTensor *output_x, ICLTensor *output_y, bool border_undefined)
Initialise the kernel's source, destination and border.
unsigned int num_elems_processed_per_iteration
CLSobel5x5HorKernel()
Default constructor: initialize all the pointers to nullptr and parameters to zero.
Describe a multidimensional execution window.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)