Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1 | /* |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2019 ARM Limited. |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 24 | #ifndef ARM_COMPUTE_CPPCORNERCANDIDATESKERNEL_H |
| 25 | #define ARM_COMPUTE_CPPCORNERCANDIDATESKERNEL_H |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 26 | |
| 27 | #include "arm_compute/core/IArray.h" |
| 28 | #include "arm_compute/core/NEON/INEKernel.h" |
Michalis Spyrou | 07781ac | 2017-08-31 15:11:41 +0100 | [diff] [blame] | 29 | #include "support/Mutex.h" |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 30 | |
| 31 | #include <cstdint> |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 32 | |
| 33 | namespace arm_compute |
| 34 | { |
| 35 | class ITensor; |
Alex Gilday | c357c47 | 2018-03-21 13:54:09 +0000 | [diff] [blame] | 36 | /** Interface for CPP Images. */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 37 | using IImage = ITensor; |
| 38 | |
| 39 | /** CPP kernel to perform corner candidates |
| 40 | */ |
| 41 | class CPPCornerCandidatesKernel : public INEKernel |
| 42 | { |
| 43 | public: |
Anthony Barbier | e8a4983 | 2018-01-18 10:04:05 +0000 | [diff] [blame] | 44 | const char *name() const override |
| 45 | { |
| 46 | return "CPPCornerCandidatesKernel"; |
| 47 | } |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 48 | /** Default constructor */ |
| 49 | CPPCornerCandidatesKernel(); |
| 50 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 51 | CPPCornerCandidatesKernel(const CPPCornerCandidatesKernel &) = delete; |
| 52 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 53 | CPPCornerCandidatesKernel &operator=(const CPPCornerCandidatesKernel &) = delete; |
| 54 | /** Allow instances of this class to be moved */ |
| 55 | CPPCornerCandidatesKernel(CPPCornerCandidatesKernel &&) = default; |
| 56 | /** Allow instances of this class to be moved */ |
| 57 | CPPCornerCandidatesKernel &operator=(CPPCornerCandidatesKernel &&) = default; |
| 58 | /** Default destructor */ |
| 59 | ~CPPCornerCandidatesKernel() = default; |
| 60 | |
| 61 | /** Setup the kernel parameters |
| 62 | * |
| 63 | * @param[in] input Source image (harris score). Format supported F32 |
| 64 | * @param[out] output Destination array of InternalKeypoint |
| 65 | * @param[out] num_corner_candidates Number of corner candidates |
| 66 | */ |
| 67 | void configure(const IImage *input, InternalKeypoint *output, int32_t *num_corner_candidates); |
| 68 | |
| 69 | // Inherited methods overridden: |
Moritz Pflanzer | c186b57 | 2017-09-07 09:48:04 +0100 | [diff] [blame] | 70 | void run(const Window &window, const ThreadInfo &info) override; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 71 | |
| 72 | private: |
Michalis Spyrou | 07781ac | 2017-08-31 15:11:41 +0100 | [diff] [blame] | 73 | int32_t *_num_corner_candidates; /**< Number of corner candidates */ |
| 74 | arm_compute::Mutex _corner_candidates_mutex; /**< Mutex to preventing race conditions */ |
| 75 | const IImage *_input; /**< Source image - Harris score */ |
| 76 | InternalKeypoint *_output; /**< Array of NEInternalKeypoint */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 77 | }; |
Gian Marco Iodice | f670a0a | 2017-09-18 12:20:45 +0100 | [diff] [blame] | 78 | } // namespace arm_compute |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 79 | #endif /* ARM_COMPUTE_CPPCORNERCANDIDATESKERNEL_H */ |