iulaw

Functions

int main(int argc, char *argv[])

iulaw [ option ] [ infile ]

  • -v int

    • absolute maximum value of input \((0 < V)\)

  • -u double

    • compression factor \((0 < \mu)\)

  • infile str

    • double-type compressed data sequence

  • stdout

    • double-type output data sequence

In the below example, 8-bit compressed and quantized data read from data.ulaw is transformed into raw waveform.

dequantize data.ulaw | iulaw > data.raw

Parameters
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns

0 on success, 1 on failure.

See also

ulaw

class sptk::MuLawExpansion

Nonlinearly decompress data based on \(\mu\)-law algorithm.

Given the input data \(y(n)\), the expansion is performed as follows:

\[ x(n) = V \, \mathrm{sgn}(y(n)) \frac{(1 + \mu)^{|y(n)|/V} - 1}{\mu} \]
where \(V\) is the absolute maximum value of the input data and \(\mu\) is the compression factor, which is typically set to 255.

Public Functions

MuLawExpansion(double abs_max_value, double compression_factor)
Parameters
  • abs_max_value[in] Absolute maximum value.

  • compression_factor[in] Compression factor, \(\mu\).

inline double GetAbsMaxValue() const
Returns

Absolute maximum value.

inline double GetCompressionFactor() const
Returns

Compression factor.

inline bool IsValid() const
Returns

True if this object is valid.

bool Run(double input, double *output) const
Parameters
  • input[in] Input data.

  • output[out] Output data.

Returns

True on success, false on failure.

bool Run(double *input_and_output) const
Parameters

input_and_output[inout] Input/output data.

Returns

True on success, false on failure.