eDSP  0.0.1
A cross-platform DSP library written in C++.
Functions
edsp::quantizer Namespace Reference

Functions

template<typename InputIt , typename OutputIt >
constexpr void mu_law_compression (InputIt first, InputIt last, OutputIt d_first, meta::value_type_t< InputIt > absolute_max_value, meta::diff_type_t< InputIt > compression_factor)
 The \( \mu \) law converts data in 16-bit linear formats to a 8-bit µ-law format. More...
 
template<typename InputIt , typename OutputIt >
constexpr void inverse_mu_law_compression (InputIt first, InputIt last, OutputIt d_first, meta::value_type_t< InputIt > absolute_max_value, meta::diff_type_t< InputIt > compression_factor)
 The \( \mu \) law converts data in 8-bit µ-law format to 16-bit linear formats. More...
 

Function Documentation

◆ inverse_mu_law_compression()

template<typename InputIt , typename OutputIt >
constexpr void edsp::quantizer::inverse_mu_law_compression ( InputIt  first,
InputIt  last,
OutputIt  d_first,
meta::value_type_t< InputIt >  absolute_max_value,
meta::diff_type_t< InputIt >  compression_factor 
)

The \( \mu \) law converts data in 8-bit µ-law format to 16-bit linear formats.

The de-compression process is performed as follows:

\[ {\displaystyle F^{-1}(y)=\operatorname {sgn}(y){1 \over \mu }{\Bigl (}(1+\mu )^{|y|}-1{\Bigr )}~~~~-1\leq y\leq 1} \]

Parameters
firstInput iterator defining the beginning of the input range.
lastInput iterator defining the ending of the input range.
d_firstOutput iterator defining the beginning of the destination range.
absolute_max_valueMaximum value of the input
compression_factorCompression ratio
Returns

◆ mu_law_compression()

template<typename InputIt , typename OutputIt >
constexpr void edsp::quantizer::mu_law_compression ( InputIt  first,
InputIt  last,
OutputIt  d_first,
meta::value_type_t< InputIt >  absolute_max_value,
meta::diff_type_t< InputIt >  compression_factor 
)

The \( \mu \) law converts data in 16-bit linear formats to a 8-bit µ-law format.

The compression process is performed as follows:

\[ {\displaystyle y=F(x)=\operatorname {sgn}(x){\frac {\ln(1+\mu |x|)}{\ln(1+\mu )}}~~~~-1\leq x\leq 1} \]

Parameters
firstInput iterator defining the beginning of the input range.
lastInput iterator defining the ending of the input range.
d_firstOutput iterator defining the beginning of the destination range.
absolute_max_valueMaximum value of the input
compression_factorCompression ratio