blob: 60d0bd4a459c839b351a0aa39d050d3bbdd80623 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Manuel Bottini4c6bd512020-04-08 10:15:51 +01002 * Copyright (c) 2016-2020 ARM Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
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 Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_CLCHANNELCOMBINEKERNEL_H
25#define ARM_COMPUTE_CLCHANNELCOMBINEKERNEL_H
Anthony Barbier6ff3b192017-09-04 18:44:23 +010026
27#include "arm_compute/core/CL/ICLKernel.h"
28
29#include <array>
30#include <cstdint>
31
32namespace arm_compute
33{
34class ICLMultiImage;
35class ICLTensor;
36using ICLImage = ICLTensor;
37
38/** Interface for the channel combine kernel */
39class CLChannelCombineKernel : public ICLKernel
40{
41public:
42 /** Default constructor */
43 CLChannelCombineKernel();
44 /** Prevent instances of this class from being copied (As this class contains pointers) */
45 CLChannelCombineKernel(const CLChannelCombineKernel &) = delete;
46 /** Prevent instances of this class from being copied (As this class contains pointers) */
47 CLChannelCombineKernel &operator=(const CLChannelCombineKernel &) = delete;
48 /** Allow instances of this class to be moved */
49 CLChannelCombineKernel(CLChannelCombineKernel &&) = default;
50 /** Allow instances of this class to be moved */
51 CLChannelCombineKernel &operator=(CLChannelCombineKernel &&) = default;
52 /** Default destructor */
53 ~CLChannelCombineKernel() = default;
54 /** Configure function's inputs and outputs.
55 *
56 * @param[in] plane0 The 2D plane that forms channel 0. Must be of U8 format.
57 * @param[in] plane1 The 2D plane that forms channel 1. Must be of U8 format.
58 * @param[in] plane2 The 2D plane that forms channel 2. Must be of U8 format.
59 * @param[in] plane3 The 2D plane that forms channel 3. Must be of U8 format.
60 * @param[out] output The single planar output tensor.
61 */
62 void configure(const ICLTensor *plane0, const ICLTensor *plane1, const ICLTensor *plane2, const ICLTensor *plane3, ICLTensor *output);
63 /** Configure function's inputs and outputs.
64 *
Manuel Bottini4c6bd512020-04-08 10:15:51 +010065 * @param[in] compile_context The compile context to be used.
66 * @param[in] plane0 The 2D plane that forms channel 0. Must be of U8 format.
67 * @param[in] plane1 The 2D plane that forms channel 1. Must be of U8 format.
68 * @param[in] plane2 The 2D plane that forms channel 2. Must be of U8 format.
69 * @param[in] plane3 The 2D plane that forms channel 3. Must be of U8 format.
70 * @param[out] output The single planar output tensor.
71 */
72 void configure(CLCompileContext &compile_context, const ICLTensor *plane0, const ICLTensor *plane1, const ICLTensor *plane2, const ICLTensor *plane3, ICLTensor *output);
73 /** Configure function's inputs and outputs.
74 *
Anthony Barbier6ff3b192017-09-04 18:44:23 +010075 * @param[in] plane0 The 2D plane that forms channel 0. Must be of U8 format.
76 * @param[in] plane1 The 2D plane that forms channel 1. Must be of U8 format.
77 * @param[in] plane2 The 2D plane that forms channel 2. Must be of U8 format.
78 * @param[out] output The multi planar output tensor.
79 */
80 void configure(const ICLImage *plane0, const ICLImage *plane1, const ICLImage *plane2, ICLMultiImage *output);
Manuel Bottini4c6bd512020-04-08 10:15:51 +010081 /** Configure function's inputs and outputs.
82 *
83 * @param[in] compile_context The compile context to be used.
84 * @param[in] plane0 The 2D plane that forms channel 0. Must be of U8 format.
85 * @param[in] plane1 The 2D plane that forms channel 1. Must be of U8 format.
86 * @param[in] plane2 The 2D plane that forms channel 2. Must be of U8 format.
87 * @param[out] output The multi planar output tensor.
88 */
89 void configure(CLCompileContext &compile_context, const ICLImage *plane0, const ICLImage *plane1, const ICLImage *plane2, ICLMultiImage *output);
Anthony Barbier6ff3b192017-09-04 18:44:23 +010090
91 // Inherited methods overridden:
92 void run(const Window &window, cl::CommandQueue &queue) override;
93
94private:
95 std::array<const ICLTensor *, 4> _planes;
96 ICLTensor *_output;
97 ICLMultiImage *_output_multi;
98 std::array<uint32_t, 3> _x_subsampling;
99 std::array<uint32_t, 3> _y_subsampling;
100};
Gian Marco Iodicef670a0a2017-09-18 12:20:45 +0100101} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000102#endif /* ARM_COMPUTE_CLCHANNELCOMBINEKERNEL_H */