blob: 580264ec904d5a3bdcc96243e02cda12a436f2dc [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2017 ARM Limited.
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 */
24#ifndef __ARM_COMPUTE_CPPCORNERCANDIDATESKERNEL_H__
25#define __ARM_COMPUTE_CPPCORNERCANDIDATESKERNEL_H__
26
27#include "arm_compute/core/IArray.h"
28#include "arm_compute/core/NEON/INEKernel.h"
Michalis Spyrou07781ac2017-08-31 15:11:41 +010029#include "support/Mutex.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010030
31#include <cstdint>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010032
33namespace arm_compute
34{
35class ITensor;
36using IImage = ITensor;
37
38/** CPP kernel to perform corner candidates
39 */
40class CPPCornerCandidatesKernel : public INEKernel
41{
42public:
43 /** Default constructor */
44 CPPCornerCandidatesKernel();
45 /** Prevent instances of this class from being copied (As this class contains pointers) */
46 CPPCornerCandidatesKernel(const CPPCornerCandidatesKernel &) = delete;
47 /** Prevent instances of this class from being copied (As this class contains pointers) */
48 CPPCornerCandidatesKernel &operator=(const CPPCornerCandidatesKernel &) = delete;
49 /** Allow instances of this class to be moved */
50 CPPCornerCandidatesKernel(CPPCornerCandidatesKernel &&) = default;
51 /** Allow instances of this class to be moved */
52 CPPCornerCandidatesKernel &operator=(CPPCornerCandidatesKernel &&) = default;
53 /** Default destructor */
54 ~CPPCornerCandidatesKernel() = default;
55
56 /** Setup the kernel parameters
57 *
58 * @param[in] input Source image (harris score). Format supported F32
59 * @param[out] output Destination array of InternalKeypoint
60 * @param[out] num_corner_candidates Number of corner candidates
61 */
62 void configure(const IImage *input, InternalKeypoint *output, int32_t *num_corner_candidates);
63
64 // Inherited methods overridden:
Moritz Pflanzerc186b572017-09-07 09:48:04 +010065 void run(const Window &window, const ThreadInfo &info) override;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010066
67private:
Michalis Spyrou07781ac2017-08-31 15:11:41 +010068 int32_t *_num_corner_candidates; /**< Number of corner candidates */
69 arm_compute::Mutex _corner_candidates_mutex; /**< Mutex to preventing race conditions */
70 const IImage *_input; /**< Source image - Harris score */
71 InternalKeypoint *_output; /**< Array of NEInternalKeypoint */
Anthony Barbier6ff3b192017-09-04 18:44:23 +010072};
Gian Marco Iodicef670a0a2017-09-18 12:20:45 +010073} // namespace arm_compute
Anthony Barbier6ff3b192017-09-04 18:44:23 +010074#endif /* __ARM_COMPUTE_CPPCORNERCANDIDATESKERNEL_H__ */