blob: ca8bfc0a7d79a8cba53ddc674350b5705ba2d5ec [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2016, 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_IDISTRIBUTION1D_H__
25#define __ARM_COMPUTE_IDISTRIBUTION1D_H__
26
27#include "arm_compute/core/IDistribution.h"
28
29#include <cstddef>
30#include <cstdint>
31
32namespace arm_compute
33{
34/** 1D Distribution interface */
35class IDistribution1D : public IDistribution
36{
37public:
38 /** Constructor: Creates a 1D Distribution of a consecutive interval [offset, offset + range - 1]
39 * defined by a start offset and valid range, divided equally into num_bins parts.
40 *
41 * @param[in] num_bins The number of bins the distribution is divided in.
42 * @param[in] offset The start of the values to use.
43 * @param[in] range The total number of the consecutive values of the distribution interval.
44 */
45 IDistribution1D(size_t num_bins, int32_t offset, uint32_t range);
46 /** Returns the number of bins that the distribution has.
47 *
48 * @return Number of bins of the distribution.
49 */
50 size_t num_bins() const;
51 /** Returns the offset of the distribution.
52 *
53 * @return Offset of the distribution.
54 */
55 int32_t offset() const;
56 /** Returns the range of the distribution.
57 *
58 * @return Range of the distribution.
59 */
60 uint32_t range() const;
61 /** Returns the window of the distribution, which is the range divided by the number of bins.
62 *
63 * @note If range is not divided by the number of bins then it is invalid.
64 *
65 * @return Window of the distribution.
66 */
67 uint32_t window() const;
68 /** Sets the range of the distribution.
69 *
70 * @param[in] range New range of the distribution to be set.
71 */
72 void set_range(uint32_t range);
73
74 // Inherited methods overridden:
75 size_t size() const override;
76 size_t dimensions() const override;
77
78private:
79 size_t _num_bins; /**< Number of bins. */
80 int32_t _offset; /**< Offset, which indicate the start of the usable values. */
81 uint32_t _range; /**< The total number of consecutive values of the distribution interval */
82};
83}
84#endif /* __ARM_COMPUTE_IDISTRIBUTION1D_H__ */