acl/math/scalar_packing.h¶
#include "acl/math/scalar_packing.h"
The functions that quantize and pack scalar values.
pack_scalar_unsigned¶
uint32_t pack_scalar_unsigned(float input, uint32_t num_bits)
Quantizes a value in the range [0.0, 1.0] to an unsigned integer with the given number of bits. The number of bits must be less than 31.
unpack_scalar_unsigned¶
float unpack_scalar_unsigned(uint32_t input, uint32_t num_bits)
Converts an unsigned integer that pack_scalar_unsigned wrote back to a value in the range [0.0, 1.0].
pack_scalar_signed¶
uint32_t pack_scalar_signed(float input, uint32_t num_bits)
Quantizes a value in the range [-1.0, 1.0] to an unsigned integer with the given number of bits. The number of bits must be less than 31.
unpack_scalar_signed¶
float unpack_scalar_signed(uint32_t input, uint32_t num_bits)
Converts an unsigned integer that pack_scalar_signed wrote back to a value in the range [-1.0, 1.0].
unpack_scalarf_32_unsafe¶
rtm::scalarf unpack_scalarf_32_unsafe(const uint8_t* vector_data, uint32_t bit_offset)
Assumes the vector_data is in big-endian order and is padded in order to load up to 8 bytes from it.
unpack_scalarf_uXX_unsafe¶
rtm::scalarf unpack_scalarf_uXX_unsafe(
uint32_t num_bits,
const uint8_t* vector_data,
uint32_t bit_offset)
Assumes the vector_data is in big-endian order and padded in order to load up to 8 bytes from it.