blob: a0efe120f2b39f7e72c9bd1f56145d697d5fa81f [file] [log] [blame]
Chunosovd621bca2017-11-03 17:33:15 +07001/*
Michele Di Giorgiod87a7b22019-09-10 10:42:27 +01002 * Copyright (c) 2017-2019 ARM Limited.
Chunosovd621bca2017-11-03 17:33:15 +07003 *
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_QUANTIZATION_ASYMM_HELPERS_H__
25#define __ARM_COMPUTE_QUANTIZATION_ASYMM_HELPERS_H__
26
27#include "arm_compute/core/Error.h"
Michele Di Giorgiod87a7b22019-09-10 10:42:27 +010028#include "arm_compute/core/Types.h"
Chunosovd621bca2017-11-03 17:33:15 +070029
30namespace arm_compute
31{
32namespace quantization
33{
34/** Calculate quantized representation of multiplier with value less than one.
35 *
36 * @param[in] multiplier Real multiplier.
37 * @param[out] quant_multiplier Integer multiplier.
38 * @param[out] right_shift Right bit shift.
Georgios Pinitas631c41a2017-12-06 11:53:03 +000039 *
40 * @return a status
Chunosovd621bca2017-11-03 17:33:15 +070041 */
Gian Marco Iodice3139f032018-11-05 14:26:32 +000042arm_compute::Status calculate_quantized_multiplier_less_than_one(float multiplier, int *quant_multiplier, int *right_shift);
Chunosovf450caa2017-11-08 16:09:35 +070043/** Calculate quantized representation of multiplier having value greater than one.
44 *
45 * @param[in] multiplier Real multiplier.
46 * @param[out] quantized_multiplier Integer multiplier.
47 * @param[out] left_shift Left bit shift.
Georgios Pinitas631c41a2017-12-06 11:53:03 +000048 *
49 * @return a status
Chunosovf450caa2017-11-08 16:09:35 +070050 */
Gian Marco Iodice3139f032018-11-05 14:26:32 +000051arm_compute::Status calculate_quantized_multiplier_greater_than_one(float multiplier, int *quantized_multiplier, int *left_shift);
Michele Di Giorgiod87a7b22019-09-10 10:42:27 +010052/** Get minimum and maximum values for the input quantized data type
53 *
54 * @ return min and max values for the quantized data type
55 */
56std::pair<int, int> get_min_max_values_from_quantized_data_type(DataType data_type);
Chunosovd621bca2017-11-03 17:33:15 +070057} // namespace quantization
58} // namespace arm_compute
59#endif /* __ARM_COMPUTE_IO_FILE_HANDLER_H__ */