From 1710133b05a9ed1fcc1cc68624c2ce0e09eae495 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Mon, 1 Jun 2020 12:07:50 +0100 Subject: COMPMID-2395: Add support for U8 datatype to CropResize on NEON Change-Id: Ia356b3545e01ccc98056951f3a20ed2712240dac Signed-off-by: Michele Di Giorgio Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3283 Tested-by: Arm Jenkins Reviewed-by: Sang-Hoon Park Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- src/core/NEON/kernels/NECropKernel.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/core/NEON/kernels/NECropKernel.cpp') diff --git a/src/core/NEON/kernels/NECropKernel.cpp b/src/core/NEON/kernels/NECropKernel.cpp index 4257611f0e..21a8436289 100644 --- a/src/core/NEON/kernels/NECropKernel.cpp +++ b/src/core/NEON/kernels/NECropKernel.cpp @@ -76,6 +76,12 @@ inline float32x4_t load_as_f32(uint16_t *ptr) return vcvtq_f32_u32(vmovl_u16(wrapper::vload(ptr))); } +template <> +inline float32x4_t load_as_f32(uint8_t *ptr) +{ + return vcvtq_f32_u32(vmovl_u16(vget_low_u16(vmovl_u8(wrapper::vload(ptr))))); +} + #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC template <> inline float32x4_t load_as_f32(float16_t *ptr) @@ -267,6 +273,9 @@ void NECropKernel::configure(const ITensor *input, const ITensor *crop_boxes, co case DataType::S16: _in_bounds_crop_function = &in_bounds_crop_window; break; + case DataType::U8: + _in_bounds_crop_function = &in_bounds_crop_window; + break; default: ARM_COMPUTE_ERROR("Datatype not supported"); } @@ -276,7 +285,7 @@ Status NECropKernel::validate(const ITensorInfo *input, const ITensorInfo *crop_ { ARM_COMPUTE_UNUSED(extrapolation_value); ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(input); - ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U16, DataType::S16, DataType::F16, DataType::U32, DataType::S32, DataType::F32); + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8, DataType::U16, DataType::S16, DataType::F16, DataType::U32, DataType::S32, DataType::F32); ARM_COMPUTE_RETURN_ERROR_ON_DATA_LAYOUT_NOT_IN(input, DataLayout::NHWC); ARM_COMPUTE_RETURN_ERROR_ON(input->tensor_shape().num_dimensions() > 4); ARM_COMPUTE_RETURN_ERROR_ON(crop_boxes->tensor_shape()[0] != 4); -- cgit v1.2.1