51 const int window_step_x = 8;
52 const auto window_start_x =
static_cast<int>(window.
x().
start());
53 const auto window_end_x =
static_cast<int>(window.
x().
end());
57 const auto input1_ptr =
reinterpret_cast<const uint8_t *
>(input1.
ptr());
58 const auto input2_ptr =
reinterpret_cast<const uint8_t *
>(input2.
ptr());
59 const auto output_ptr =
reinterpret_cast<int16_t *
>(output.
ptr());
64 int x = window_start_x;
65 for(; x <= (window_end_x - window_step_x); x += window_step_x)
73 for(; x < window_end_x; ++x)
75 *(output_ptr + x) = static_cast<int16_t>(*(input1_ptr + x)) + static_cast<int16_t>(*(input2_ptr + x));
81 int x = window_start_x;
82 for(; x <= (window_end_x - window_step_x); x += window_step_x)
90 for(; x < window_end_x; ++x)
92 *(output_ptr + x) =
wrapper::add_sat(static_cast<int16_t>(*(input1_ptr + x)),
93 static_cast<int16_t
>(*(input2_ptr + x)));
97 input1, input2, output);
116 const int window_step_x = 8;
117 const auto window_start_x =
static_cast<int>(window.
x().
start());
118 const auto window_end_x =
static_cast<int>(window.
x().
end());
122 const auto input1_ptr =
reinterpret_cast<const int16_t *
>(input1.
ptr());
123 const auto input2_ptr =
reinterpret_cast<const uint8_t *
>(input2.
ptr());
124 const auto output_ptr =
reinterpret_cast<int16_t *
>(output.
ptr());
129 int x = window_start_x;
130 for(; x <= (window_end_x - window_step_x); x += window_step_x)
138 for(; x < window_end_x; ++x)
140 *(output_ptr + x) = *(input1_ptr + x) +
static_cast<int16_t
>(*(input2_ptr + x));
146 int x = window_start_x;
147 for(; x <= (window_end_x - window_step_x); x += window_step_x)
155 for(; x < window_end_x; ++x)
157 *(output_ptr + x) =
wrapper::add_sat(*(input1_ptr + x),
static_cast<int16_t
>(*(input2_ptr + x)));
161 input1, input2, output);
void add_s16_u8_s16_neon(const ITensor *src0, const ITensor *src1, ITensor *dst, const ConvertPolicy &policy, const Window &window)
uint8x16_t vloadq(const uint8_t *ptr)
uint8x8_t vadd(const uint8x8_t &a, const uint8x8_t &b)
Describe one of the image's dimensions with a start, end and step.
Interface for Neon tensor.
Copyright (c) 2017-2021 Arm Limited.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
void add_u8_u8_s16_neon(const ITensor *src0, const ITensor *src1, ITensor *dst, const ConvertPolicy &policy, const Window &window)
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
uint8_t add_sat(const uint8_t &a, const uint8_t &b)
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.
uint8x8_t vqadd(const uint8x8_t &a, const uint8x8_t &b)
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
Window broadcast_if_dimension_le_one(const TensorShape &shape) const
Don't advance in the dimension where shape is less equal to 1.
uint8x8_t vload(const uint8_t *ptr)
void vstore(uint8_t *ptr, uint8x8_t val)
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...
Includes all wrapper headers at once.
constexpr int end() const
Return the end of the dimension.
Iterator updated by execute_window_loop for each window element.
uint16x8_t vmovl(const uint8x8_t &a)
constexpr int start() const
Return the start of the dimension.
Describe a multidimensional execution window.
ConvertPolicy
Policy to handle overflow.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
void add_u8_s16_s16_neon(const ITensor *src0, const ITensor *src1, ITensor *dst, const ConvertPolicy &policy, const Window &window)