47 : _func(nullptr), _lut(nullptr)
52 void NETableLookupKernel::tableLookup(
const Window &
window)
56 const auto lut =
reinterpret_cast<const T *
>(_lut->
buffer());
66 auto input_ptr =
reinterpret_cast<const T *
>(input.
ptr());
67 auto output_ptr =
reinterpret_cast<T *
>(output.
ptr());
69 for(
unsigned int i = 0; i <
step; ++i, ++input_ptr, ++output_ptr)
71 const int32_t index = offset + *input_ptr;
73 if(0 <= index && index < static_cast<int32_t>(count))
75 *output_ptr = lut[index];
85 void NETableLookupKernel::tableLookup<uint8_t>(
const Window &
window)
87 const uint8_t *
const lut = _lut->buffer();
97 const uint8_t *input_ptr = input.
ptr();
98 uint8_t *output_ptr = output.
ptr();
100 for(
unsigned int i = 0; i <
step; ++i)
102 *output_ptr++ = lut[*input_ptr++];
122 _func = &NETableLookupKernel::tableLookup<uint8_t>;
126 _func = &NETableLookupKernel::tableLookup<int16_t>;
142 (this->*_func)(window);
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
const Window & window() const
The maximum window the kernel can be executed on.
constexpr unsigned int num_num_elems_processed_per_iteration
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
1 channel, 1 U8 per channel
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.
Interface for Neon tensor.
NETableLookupKernel()
Default constructor.
virtual size_t num_elements() const =0
Returns the total number of elements in the LUT.
Copyright (c) 2017-2021 Arm Limited.
void run(const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
void configure(const ITensor *input, const ILut *lut, ITensor *output)
Initialise the kernel's input, lut and output.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Lookup Table object interface.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
1 channel, 1 S16 per channel
virtual uint32_t index_offset() const =0
Indicates the offset that needs to be applied to the raw index before performing a lookup in the LUT...
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Information about executing thread and CPU.
virtual uint8_t * buffer() const =0
Returns a pointer to the start of the LUT.
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Iterator updated by execute_window_loop for each window element.
Describe a multidimensional execution window.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)