24.02.1
|
Go to the documentation of this file.
24 #ifndef ARM_COMPUTE_CORE_UTILS_DATATYPEUTILS_H
25 #define ARM_COMPUTE_CORE_UTILS_DATATYPEUTILS_H
65 return sizeof(size_t);
205 max =
PixelValue(
static_cast<int32_t
>(std::numeric_limits<uint8_t>::max()));
214 max =
PixelValue(
static_cast<int32_t
>(std::numeric_limits<int8_t>::max()));
221 max =
PixelValue(
static_cast<int32_t
>(std::numeric_limits<uint16_t>::max()));
228 max =
PixelValue(
static_cast<int32_t
>(std::numeric_limits<int16_t>::max()));
234 max =
PixelValue(std::numeric_limits<uint32_t>::max());
240 max =
PixelValue(std::numeric_limits<int32_t>::max());
252 max =
PixelValue(std::numeric_limits<half>::max());
258 max =
PixelValue(std::numeric_limits<float>::max());
264 return std::make_tuple(min, max);
420 template <
typename T>
427 const auto val_u8 =
static_cast<uint8_t
>(val);
429 val <= std::numeric_limits<uint8_t>::max());
435 return ((
double)val >= min && (double)val <= max);
439 const auto val_s8 =
static_cast<int8_t
>(val);
441 val <= std::numeric_limits<int8_t>::max());
445 const auto val_u16 =
static_cast<uint16_t
>(val);
447 val <= std::numeric_limits<uint16_t>::max());
451 const auto val_s16 =
static_cast<int16_t
>(val);
453 val <= std::numeric_limits<int16_t>::max());
457 const auto val_d64 =
static_cast<double>(val);
458 const auto val_u32 =
static_cast<uint32_t
>(val);
460 val_d64 <= std::numeric_limits<uint32_t>::max());
464 const auto val_d64 =
static_cast<double>(val);
465 const auto val_s32 =
static_cast<int32_t
>(val);
467 val_d64 <= std::numeric_limits<int32_t>::max());
489 std::string ret =
"";
@ QSYMM8_PER_CHANNEL
quantized, symmetric per channel fixed-point 8-bit number
@ QASYMM16
quantized, asymmetric fixed-point 16-bit number
@ RGB888
3 channels, 1 U8 per channel
@ U64
unsigned 64-bit number
float dequantize_qasymm8(uint8_t value, const INFO_TYPE &qinfo)
Dequantize a value given an unsigned 8-bit asymmetric quantization scheme.
@ BFLOAT16
16-bit brain floating-point number
Quantization information.
Class describing the value of a pixel for any image format.
@ F64
64-bit floating-point number
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
@ U16
unsigned 16-bit number
@ QSYMM8
quantized, symmetric fixed-point 8-bit number
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
size_t element_size_from_data_type(DataType dt)
The size in bytes of the data type.
bool is_data_type_quantized_symmetric(DataType dt)
Check if a given data type is of symmetric quantized type.
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
@ QSYMM16
quantized, symmetric fixed-point 16-bit number
@ UV88
2 channel, 1 U8 per channel
DataType get_promoted_data_type(DataType dt)
Return the promoted data type of a given data type.
size_t data_size_from_type(DataType data_type)
The size in bytes of the data type.
static bfloat16 max()
Largest representative value.
@ U32
unsigned 32-bit number
bool check_value_range(T val, DataType dt, QuantizationInfo qinfo=QuantizationInfo())
Returns true if the value can be represented by the given data type.
bool is_data_type_quantized_asymmetric_signed(DataType dt)
Check if a given data type is of asymmetric quantized signed type.
@ U8
unsigned 8-bit number
std::string cpu_impl_dt(const DataType &data_type)
Returns the suffix string of CPU kernel implementation names based on the given data type.
@ S16
signed 16-bit number
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
DataType data_type_from_format(Format format)
Return the data type used by a given single-planar pixel format.
bool is_data_type_quantized_per_channel(DataType dt)
Check if a given data type is of per channel type.
@ IYUV
A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes.
@ RGBA8888
4 channels, 1 U8 per channel
@ U8
1 channel, 1 U8 per channel
Format
Image colour formats.
@ S32
1 channel, 1 S32 per channel
@ YUYV422
A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes.
@ YUV444
A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes.
@ UYVY422
A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte.
@ F32
1 channel, 1 F32 per channel
@ S64
signed 64-bit number
Copyright (c) 2017-2024 Arm Limited.
@ NV12
A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling.
@ F16
16-bit floating-point number
bool is_data_type_float(DataType dt)
Check if a given data type is of floating point type.
@ S32
signed 32-bit number
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
@ F16
1 channel, 1 F16 per channel
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
DataType data_type_from_name(const std::string &name)
Convert a string to DataType.
@ S16
1 channel, 1 S16 per channel
@ F32
32-bit floating-point number
static bfloat16 lowest()
Lowest representative value.
std::tuple< PixelValue, PixelValue > get_min_max(DataType dt)
Compute the mininum and maximum values a data type can take.
@ BFLOAT16
16-bit brain floating-point number
@ UNKNOWN
Unknown data type.
inline ::std::istream & operator>>(::std::istream &stream, DataType &data_type)
Input Stream operator for DataType.
DataType
Available data types.
@ NV21
A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling.
const QuantizationInfo qinfo
@ U32
1 channel, 1 U32 per channel
@ U16
1 channel, 1 U16 per channel