spandsp  0.0.6
g726.h File Reference

Go to the source code of this file.

Typedefs

typedef struct g726_state_s g726_state_t
 
typedef int16_t(* g726_decoder_func_t) (g726_state_t *s, uint8_t code)
 
typedef uint8_t(* g726_encoder_func_t) (g726_state_t *s, int16_t amp)
 

Enumerations

enum  { G726_ENCODING_LINEAR = 0, G726_ENCODING_ULAW, G726_ENCODING_ALAW }
 
enum  { G726_PACKING_NONE = 0, G726_PACKING_LEFT = 1, G726_PACKING_RIGHT = 2 }
 

Functions

g726_state_tg726_init (g726_state_t *s, int bit_rate, int ext_coding, int packing)
 
int g726_release (g726_state_t *s)
 
int g726_free (g726_state_t *s)
 
int g726_decode (g726_state_t *s, int16_t amp[], const uint8_t g726_data[], int g726_bytes)
 
int g726_encode (g726_state_t *s, uint8_t g726_data[], const int16_t amp[], int len)
 

Typedef Documentation

◆ g726_state_t

typedef struct g726_state_s g726_state_t

G.726 state

Function Documentation

◆ g726_decode()

int g726_decode ( g726_state_t s,
int16_t  amp[],
const uint8_t  g726_data[],
int  g726_bytes 
)

Decode a buffer of G.726 ADPCM data to linear PCM, a-law or u-law.

Parameters
sThe G.726 context.
ampThe audio sample buffer.
g726_data
g726_bytes
Returns
The number of samples returned.

◆ g726_encode()

int g726_encode ( g726_state_t s,
uint8_t  g726_data[],
const int16_t  amp[],
int  len 
)

Encode a buffer of linear PCM data to G.726 ADPCM.

Parameters
sThe G.726 context.
g726_dataThe G.726 data produced.
ampThe audio sample buffer.
lenThe number of samples in the buffer.
Returns
The number of bytes of G.726 data produced.

◆ g726_free()

int g726_free ( g726_state_t s)

Free a G.726 encode or decode context.

Parameters
sThe G.726 context.
Returns
0 for OK.

◆ g726_init()

g726_state_t* g726_init ( g726_state_t s,
int  bit_rate,
int  ext_coding,
int  packing 
)

Initialise a G.726 encode or decode context.

Parameters
sThe G.726 context.
bit_rateThe required bit rate for the ADPCM data. The valid rates are 16000, 24000, 32000 and 40000.
ext_codingThe coding used outside G.726.
packingOne of the G.726_PACKING_xxx options.
Returns
A pointer to the G.726 context, or NULL for error.

◆ g726_release()

int g726_release ( g726_state_t s)

Release a G.726 encode or decode context.

Parameters
sThe G.726 context.
Returns
0 for OK.