Compute Library
 20.11
PyramidInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2019 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_PYRAMIDINFO_H
25 #define ARM_COMPUTE_PYRAMIDINFO_H
26 
28 #include "arm_compute/core/Types.h"
29 
30 #include <cstddef>
31 
32 namespace arm_compute
33 {
34 /** Store the Pyramid's metadata */
36 {
37 public:
38  /** Default constructor */
39  PyramidInfo();
40  /** Default destructor */
41  virtual ~PyramidInfo() = default;
42  /** Allow instances of this class to be copy constructed */
43  PyramidInfo(const PyramidInfo &) = default;
44  /** Allow instances of this class to be copied */
45  PyramidInfo &operator=(const PyramidInfo &) = default;
46  /** Allow instances of this class to be move constructed */
47  PyramidInfo(PyramidInfo &&) = default;
48  /** Allow instances of this class to be moved */
49  PyramidInfo &operator=(PyramidInfo &&) = default;
50 
51  /** Create pyramid info for 2D tensors
52  *
53  * @param[in] num_levels The number of pyramid levels. This is required to be a non-zero value
54  * @param[in] scale Used to indicate the scale between the pyramid levels.
55  * This is required to be a non-zero positive value.
56  * @param[in] width The width of the 2D tensor at 0th pyramid level
57  * @param[in] height The height of the 2D tensor at 0th pyramid level
58  * @param[in] format The format of all 2D tensors in the pyramid
59  * NV12, NV21, IYUV, UYVY and YUYV formats are not supported.
60  */
61  PyramidInfo(size_t num_levels, float scale, size_t width, size_t height, Format format);
62 
63  /** Create pyramid info using TensorShape
64  *
65  * @param[in] num_levels The number of pyramid levels. This is required to be a non-zero value
66  * @param[in] scale Used to indicate the scale between the pyramid levels.
67  * This is required to be a non-zero positive value.
68  * @param[in] tensor_shape It specifies the size for each dimension of the tensor 0th pyramid level in number of elements
69  * @param[in] format The format of all tensors in the pyramid
70  */
72 
73  /** Initialize pyramid's metadata for 2D tensors
74  *
75  * @param[in] num_levels The number of pyramid levels. This is required to be a non-zero value
76  * @param[in] scale Used to indicate the scale between the pyramid levels.
77  * This is required to be a non-zero positive value.
78  * @param[in] width The width of the 2D tensor at 0th pyramid level
79  * @param[in] height The height of the 2D tensor at 0th pyramid level
80  * @param[in] format The format of all 2D tensors in the pyramid
81  * NV12, NV21, IYUV, UYVY and YUYV formats are not supported.
82  */
83  void init(size_t num_levels, float scale, size_t width, size_t height, Format format);
84  /** Initialize pyramid's metadata using TensorShape
85  *
86  * @param[in] num_levels The number of pyramid levels. This is required to be a non-zero value
87  * @param[in] scale Used to indicate the scale between the pyramid levels.
88  * This is required to be a non-zero positive value.
89  * @param[in] tensor_shape It specifies the size for each dimension of the tensor 0th pyramid level in number of elements
90  * @param[in] format The format of all tensors in the pyramid
91  */
92  void init(size_t num_levels, float scale, const TensorShape &tensor_shape, Format format);
93  /** Return the number of the pyramid levels
94  *
95  * @return The number of the pyramid levels
96  */
97  size_t num_levels() const;
98  /** Return the width of the 0th level tensor
99  *
100  * @return The width of the 0th level tensor
101  */
102  size_t width() const;
103  /** Return the height of the 0th level tensor
104  *
105  * @return The height of the 0th level tensor
106  */
107  size_t height() const;
108  /** Return the TensorShape of the o-th level tensor
109  *
110  * @return
111  */
112  const TensorShape &tensor_shape() const;
113  /** Return the image format of all tensor in the pyramid
114  *
115  * @return The image format
116  */
117  Format format() const;
118  /** Return the scale factor of the pyramid
119  *
120  * @return Return the scale factor
121  */
122  float scale() const;
123 
124 private:
125  size_t _num_levels;
126  TensorShape _tensor_shape;
127  Format _format;
128  float _scale;
129 };
130 }
131 #endif /*ARM_COMPUTE_PYRAMIDINFO_H */
const TensorShape & tensor_shape() const
Return the TensorShape of the o-th level tensor.
Definition: PyramidInfo.cpp:92
Shape of a tensor.
Definition: TensorShape.h:39
virtual ~PyramidInfo()=default
Default destructor.
void init(size_t num_levels, float scale, size_t width, size_t height, Format format)
Initialize pyramid's metadata for 2D tensors.
Definition: PyramidInfo.cpp:50
Format format() const
Return the image format of all tensor in the pyramid.
Definition: PyramidInfo.cpp:97
Copyright (c) 2017-2020 Arm Limited.
Format
Image colour formats.
Definition: Types.h:54
float scale() const
Return the scale factor of the pyramid.
PyramidInfo & operator=(const PyramidInfo &)=default
Allow instances of this class to be copied.
Store the Pyramid's metadata.
Definition: PyramidInfo.h:35
size_t width() const
Return the width of the 0th level tensor.
Definition: PyramidInfo.cpp:82
size_t num_levels() const
Return the number of the pyramid levels.
Definition: PyramidInfo.cpp:77
PyramidInfo()
Default constructor.
Definition: PyramidInfo.cpp:33
size_t height() const
Return the height of the 0th level tensor.
Definition: PyramidInfo.cpp:87