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

Go to the source code of this file.

Functions

uint8_t sofm_a_law_encode (int16_t sample)
 sofm_a_law_encode() - Encode sample with A-law coding
int16_t sofm_a_law_decode (int8_t byte)
 sofm_a_law_decode() - Decode A-law encoded code word

Function Documentation

◆ sofm_a_law_decode()

int16_t sofm_a_law_decode ( int8_t byte)

sofm_a_law_decode() - Decode A-law encoded code word

Parameters
byteEncoded code word

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

Returns
: Sample value in s16 format

◆ sofm_a_law_encode()

uint8_t sofm_a_law_encode ( int16_t sample)

sofm_a_law_encode() - Encode sample with A-law coding

Parameters
sampleA s16 sample value

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

Returns
: Compressed 8 bit code value