Sound Open Firmware
Loading...
Searching...
No Matches
mu_law.h File Reference
Include dependency graph for mu_law.h:

Go to the source code of this file.

Functions

uint8_t sofm_mu_law_encode (int16_t sample)
 sofm_mu_law_encode() - Encode sample with mu-law coding
int16_t sofm_mu_law_decode (int8_t byte)
 sofm_mu_law_decode() - Decode mu-law encoded code word

Function Documentation

◆ sofm_mu_law_decode()

int16_t sofm_mu_law_decode ( int8_t byte)

sofm_mu_law_decode() - Decode mu-law encoded code word

Parameters
byteEncoded code word

The mu-law decoder expands a 8 bit code word into a 14 bit sample value. In the SOF the high 14 bits are aligned to the most significant bits to be compatible with normal s16 Q1.15 samples.

Returns
: Sample value in s16 format

◆ sofm_mu_law_encode()

uint8_t sofm_mu_law_encode ( int16_t sample)

sofm_mu_law_encode() - Encode sample with mu-law coding

Parameters
sampleA s16 sample value

The mu-law codec is defined in ITU-T G.711 standard and has been used in telecommunications in USA and Japan. The mu-law coding compresses 14 bit samples to 8 bit data stream. In SOF the high 14 bits of s16 format are used for compatibility with normal audios.

Returns
: Compressed 8 bit code value