50 : _func(nullptr), _lut_index(0)
72 unsigned int subsampling = 1;
98 _func = &NEChannelExtractKernel::extract_1C_from_2C_img;
102 num_elems_processed_per_iteration = 32;
103 _func = &NEChannelExtractKernel::extract_YUYV_uv;
108 _func = &NEChannelExtractKernel::extract_1C_from_3C_img;
112 _func = &NEChannelExtractKernel::extract_1C_from_4C_img;
125 INEKernel::configure(win);
158 _input = input_plane;
168 num_elems_processed_per_iteration = 16;
169 _func = &NEChannelExtractKernel::extract_1C_from_2C_img;
177 output_access.set_valid_region(win, _input->info()->valid_region());
179 INEKernel::configure(win);
189 (this->*_func)(window);
192 void NEChannelExtractKernel::extract_1C_from_2C_img(
const Window &win)
199 const auto in_ptr =
static_cast<uint8_t *
>(in.
ptr());
200 const auto out_ptr =
static_cast<uint8_t *
>(out.
ptr());
201 const auto pixels = vld2q_u8(in_ptr);
202 vst1q_u8(out_ptr, pixels.val[_lut_index]);
207 void NEChannelExtractKernel::extract_1C_from_3C_img(
const Window &win)
214 const auto in_ptr =
static_cast<uint8_t *
>(in.
ptr());
215 const auto out_ptr =
static_cast<uint8_t *
>(out.
ptr());
216 const auto pixels = vld3q_u8(in_ptr);
217 vst1q_u8(out_ptr, pixels.val[_lut_index]);
222 void NEChannelExtractKernel::extract_1C_from_4C_img(
const Window &win)
229 const auto in_ptr =
static_cast<uint8_t *
>(in.
ptr());
230 const auto out_ptr =
static_cast<uint8_t *
>(out.
ptr());
231 const auto pixels = vld4q_u8(in_ptr);
232 vst1q_u8(out_ptr, pixels.val[_lut_index]);
237 void NEChannelExtractKernel::extract_YUYV_uv(
const Window &win)
249 const auto in_ptr =
static_cast<uint8_t *
>(in.
ptr());
250 const auto out_ptr =
static_cast<uint8_t *
>(out.
ptr());
251 const auto pixels = vld4q_u8(in_ptr);
252 vst1q_u8(out_ptr, pixels.val[_lut_index]);
264 const auto in_ptr =
static_cast<uint8_t *
>(in.
ptr());
265 const auto out_ptr =
static_cast<uint8_t *
>(out.
ptr());
266 vst4_u8(out_ptr, vld4_u8(in_ptr));
bool set_format_if_unknown(ITensorInfo &info, Format format)
Set the format, data type and number of channels to the specified value if the current data type is u...
A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte.
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.
int plane_idx_from_channel(Format format, Channel channel)
Return the plane index of a given channel given an input format.
TensorShape calculate_subsampled_shape(const TensorShape &shape, Format format, Channel channel=Channel::UNKNOWN)
Calculate subsampled shape for a given format and channel.
#define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t)
constexpr int step() const
Return the step of the dimension.
1 channel, 1 U8 per channel
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling.
#define ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(t,...)
Interface for Neon tensor.
A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling.
Copyright (c) 2017-2021 Arm Limited.
virtual ValidRegion valid_region() const =0
Valid region of the tensor.
3 channels, 1 U8 per channel
#define ARM_COMPUTE_ERROR_ON_TENSORS_NOT_EVEN(...)
Implementation of a rectangular access pattern.
virtual Format format() const =0
Colour format of the image.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
bool update_window_and_padding(Window &win, Ts &&... patterns)
Update window and padding size for each of the access patterns.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Interface for multi-planar images.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
Channel
Available channels.
Format
Image colour formats.
Class to describe a number of elements in each dimension.
Implementation of a row access pattern.
A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
bool set_shape_if_empty(ITensorInfo &info, const TensorShape &shape)
Set the shape to the specified value if the current assignment is empty.
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
virtual const MultiImageInfo * info() const =0
Interface to be implemented by the child class to return the multi-planar image's metadata...
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes.
4 channels, 1 U8 per channel
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Information about executing thread and CPU.
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_DIMENSIONS(...)
virtual IImage * plane(unsigned int index)=0
Return a pointer to the requested plane of the image.
unsigned int num_elems_processed_per_iteration
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
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...
Container for valid region of a window.
A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes.
Iterator updated by execute_window_loop for each window element.
Format format() const
Colour format of the image.
Describe a multidimensional execution window.
Coordinates anchor
Anchor for the start of the valid region.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
int channel_idx_from_format(Format format, Channel channel)
Return the channel index of a given channel given an input format.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
#define ARM_COMPUTE_ERROR_ON_CHANNEL_NOT_IN_KNOWN_FORMAT(f, c)