From ef4b4ae784f7533ed6d9e7b51827a894c32ed48e Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Tue, 4 Jul 2017 17:19:43 +0100 Subject: COMPMID-438: Add support for floating point Min-Max Location layer. Change-Id: I84ae564a40fc7320a6f94a84d53906ba51404f51 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79797 Reviewed-by: Anthony Barbier Tested-by: Kaizen --- .../core/CL/kernels/CLMinMaxLocationKernel.h | 8 ++--- .../core/NEON/kernels/NEMinMaxLocationKernel.h | 35 ++++++++++++---------- .../runtime/CL/functions/CLMinMaxLocation.h | 12 ++++---- .../runtime/NEON/functions/NEMinMaxLocation.h | 8 ++--- 4 files changed, 33 insertions(+), 30 deletions(-) (limited to 'arm_compute') diff --git a/arm_compute/core/CL/kernels/CLMinMaxLocationKernel.h b/arm_compute/core/CL/kernels/CLMinMaxLocationKernel.h index 6a31f3cf18..03ae3c1b1f 100644 --- a/arm_compute/core/CL/kernels/CLMinMaxLocationKernel.h +++ b/arm_compute/core/CL/kernels/CLMinMaxLocationKernel.h @@ -51,8 +51,8 @@ public: CLMinMaxKernel &operator=(CLMinMaxKernel &&) = default; /** Initialise the kernel's input and output. * - * @param[in] input Input Image. Data types supported: U8 or S16. - * @param[out] min_max Buffer of 2 elements to store the min value at position 0 and the max value at position 1. Data type supported: S32. + * @param[in] input Input Image. Data types supported: U8/S16/F32. + * @param[out] min_max Buffer of 2 elements to store the min value at position 0 and the max value at position 1. Data type supported: S32 if input type is U8/S16, F32 if input type is F32. */ void configure(const ICLImage *input, cl::Buffer *min_max); @@ -84,8 +84,8 @@ public: * * @note When locations of min and max occurrences are requested, the reported number of locations is limited to the given array size. * - * @param[in] input Input image. Data types supported: U8 or S16. - * @param[in] min_max Buffer of 2 elements which contains the min value at position 0 and the max value at position 1. Data type supported: S32 + * @param[in] input Input image. Data types supported: U8/S16/F32. + * @param[out] min_max Buffer of 2 elements to store the min value at position 0 and the max value at position 1. Data type supported: S32 if input type is U8/S16, F32 if input type is F32. * @param[out] min_max_count Buffer of 2 elements to store the min value occurrences at position 0 and the max value occurrences at position 1. Data type supported: S32 * @param[out] min_loc (Optional) Array of Coordinates2D used to store minimum value locations. * @param[out] max_loc (Optional) Array of Coordinates2D used to store maximum value locations. diff --git a/arm_compute/core/NEON/kernels/NEMinMaxLocationKernel.h b/arm_compute/core/NEON/kernels/NEMinMaxLocationKernel.h index b5375f613b..7b2748deee 100644 --- a/arm_compute/core/NEON/kernels/NEMinMaxLocationKernel.h +++ b/arm_compute/core/NEON/kernels/NEMinMaxLocationKernel.h @@ -54,11 +54,11 @@ public: /** Initialise the kernel's input and outputs. * - * @param[in] input Input Image. Data types supported: U8/S16. - * @param[out] min Minimum value of image. - * @param[out] max Maximum value of image. + * @param[in] input Input Image. Data types supported: U8/S16/F32. + * @param[out] min Minimum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32. + * @param[out] max Maximum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32. */ - void configure(const IImage *input, int32_t *min, int32_t *max); + void configure(const IImage *input, void *min, void *max); /** Resets global minimum and maximum. */ void reset(); @@ -76,6 +76,11 @@ private: * @param win The window to run the algorithm on. */ void minmax_S16(Window win); + /** Performs the min/max algorithm on F32 images on a given window. + * + * @param win The window to run the algorithm on. + */ + void minmax_F32(Window win); /** Common signature for all the specialised MinMax functions * * @param[in] window Region on which to execute the kernel. @@ -87,12 +92,10 @@ private: template void update_min_max(T min, T max); - const IImage *_input; /**< Input image. */ - int32_t *_min; /**< Minimum value. */ - int32_t *_max; /**< Maximum value. */ - int32_t _min_init; /**< Value to initialise global minimum value. */ - int32_t _max_init; /**< Value to initialise global maximum value. */ - std::mutex _mtx; /**< Mutex used for result reduction. */ + const IImage *_input; /**< Input image. */ + void *_min; /**< Minimum value. */ + void *_max; /**< Maximum value. */ + std::mutex _mtx; /**< Mutex used for result reduction. */ }; /** Interface for the kernel to find min max locations of an image. */ @@ -114,15 +117,15 @@ public: /** Initialise the kernel's input and outputs. * - * @param[in] input Input Image. Data types supported: U8 or S16. - * @param[out] min Minimum value of image. - * @param[out] max Maximum value of image. + * @param[in] input Input Image. Data types supported: U8/S16/F32. + * @param[out] min Minimum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32. + * @param[out] max Maximum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32. * @param[out] min_loc Array of minimum value locations. * @param[out] max_loc Array of maximum value locations. * @param[out] min_count Number of minimum value encounters. * @param[out] max_count Number of maximum value encounters. */ - void configure(const IImage *input, int32_t *min, int32_t *max, + void configure(const IImage *input, void *min, void *max, ICoordinates2DArray *min_loc = nullptr, ICoordinates2DArray *max_loc = nullptr, uint32_t *min_count = nullptr, uint32_t *max_count = nullptr); @@ -149,8 +152,8 @@ private: struct create_func_table; const IImage *_input; /**< Input image. */ - int32_t *_min; /**< Minimum value. */ - int32_t *_max; /**< Maximum value. */ + void *_min; /**< Minimum value. */ + void *_max; /**< Maximum value. */ uint32_t *_min_count; /**< Count of minimum value encounters. */ uint32_t *_max_count; /**< Count of maximum value encounters. */ ICoordinates2DArray *_min_loc; /**< Locations of minimum values. */ diff --git a/arm_compute/runtime/CL/functions/CLMinMaxLocation.h b/arm_compute/runtime/CL/functions/CLMinMaxLocation.h index 84fd67515b..52a2857d0b 100644 --- a/arm_compute/runtime/CL/functions/CLMinMaxLocation.h +++ b/arm_compute/runtime/CL/functions/CLMinMaxLocation.h @@ -55,15 +55,15 @@ public: * * @note When locations of min and max occurrences are requested, the reported number of locations is limited to the given array size. * - * @param[in] input Input image. Data types supported: U8 or S16. - * @param[out] min Minimum value of image. - * @param[out] max Maximum value of image. + * @param[in] input Input image. Data types supported: U8/S16/F32. + * @param[out] min Minimum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32. + * @param[out] max Maximum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32. * @param[out] min_loc (Optional) Array of Coordinates2D used to store minimum value locations. * @param[out] max_loc (Optional) Array of Coordinates2D used to store maximum value locations. * @param[out] min_count (Optional) Number of minimum value encounters. * @param[out] max_count (Optional) Number of maximum value encounters. */ - void configure(const ICLImage *input, int32_t *min, int32_t *max, + void configure(const ICLImage *input, void *min, void *max, CLCoordinates2DArray *min_loc = nullptr, CLCoordinates2DArray *max_loc = nullptr, uint32_t *min_count = nullptr, uint32_t *max_count = nullptr); @@ -75,8 +75,8 @@ private: CLMinMaxLocationKernel _min_max_loc_kernel; /**< Kernel that counts min/max occurrences and identifies their positions */ cl::Buffer _min_max_vals; /**< Buffer to collect min, max values */ cl::Buffer _min_max_count_vals; /**< Buffer to collect min, max values */ - int32_t *_min; /**< Minimum value. */ - int32_t *_max; /**< Maximum value. */ + void *_min; /**< Minimum value. */ + void *_max; /**< Maximum value. */ uint32_t *_min_count; /**< Minimum value occurrences. */ uint32_t *_max_count; /**< Maximum value occurrences. */ CLCoordinates2DArray *_min_loc; /**< Minimum value occurrences coordinates. */ diff --git a/arm_compute/runtime/NEON/functions/NEMinMaxLocation.h b/arm_compute/runtime/NEON/functions/NEMinMaxLocation.h index 82e75ee48b..e658d22a66 100644 --- a/arm_compute/runtime/NEON/functions/NEMinMaxLocation.h +++ b/arm_compute/runtime/NEON/functions/NEMinMaxLocation.h @@ -48,15 +48,15 @@ public: NEMinMaxLocation(); /** Initialise the kernel's inputs and outputs. * - * @param[in] input Input image. Data types supported: U8/S16. - * @param[out] min Minimum value of image. - * @param[out] max Maximum value of image. + * @param[in] input Input image. Data types supported: U8/S16/F32. + * @param[out] min Minimum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32. + * @param[out] max Maximum value of image. Data types supported: S32 if input type is U8/S16, F32 if input type is F32. * @param[out] min_loc (Optional) Array of minimum value locations. * @param[out] max_loc (Optional) Array of maximum value locations. * @param[out] min_count (Optional) Number of minimum value encounters. * @param[out] max_count (Optional) Number of maximum value encounters. */ - void configure(const IImage *input, int32_t *min, int32_t *max, + void configure(const IImage *input, void *min, void *max, ICoordinates2DArray *min_loc = nullptr, ICoordinates2DArray *max_loc = nullptr, uint32_t *min_count = nullptr, uint32_t *max_count = nullptr); -- cgit v1.2.1