quantize
Functions
-
int main(int argc, char *argv[])
quantize [ option ] [ infile ]
-v double
absolute maximum value \((0 < V)\)
-b int
number of bits \((1 \le B)\)
-t int
quantization type
0
mid-rise1
mid-tread
-o int
output format
0
non-negative integer1
integer
infile str
double-type data sequence
stdout
int-type quantized data sequence
echo -2 -1 0 1 2 | x2x +ad | quantize -b 2 -v 2 -t 0 | x2x +ia # 0, 1, 2, 3, 3 echo -2 -1 0 1 2 | x2x +ad | quantize -b 2 -v 2 -t 1 | x2x +ia # 0, 0, 1, 2, 2
- Parameters:
argc – [in] Number of arguments.
argv – [in] Argument vector.
- Returns:
0 on success, 1 on failure.
See also
-
class UniformQuantization
Perform uniform quantization.
The input is a value and the output is the corresponding index. There are two types of quantization, i.e., mid-rise and mid-tread.
Public Types
Public Functions
-
UniformQuantization(double absolute_maximum_value, int num_bit, QuantizationType quantization_type)
- Parameters:
absolute_maximum_value – [in] Absolute maximum value.
num_bit – [in] Number of quantization bits.
quantization_type – [in] Quantization type.
-
inline double GetAbsoluteMaximumValue() const
- Returns:
Absolute maximum value.
-
inline int GetNumBit() const
- Returns:
Number of quantization bits.
-
inline QuantizationType GetQuantizationType() const
- Returns:
Quantization type.
-
inline bool IsValid() const
- Returns:
True if this object is valid.
-
inline int GetQuantizationLevels() const
- Returns:
Quantization levels.
-
bool Run(double input, int *output) const
- Parameters:
input – [in] Input value.
output – [out] Output index.
- Returns:
True on success, false on failure.
-
UniformQuantization(double absolute_maximum_value, int num_bit, QuantizationType quantization_type)