src/spandsp/g726.h File Reference
Go to the source code of this file.
|
Classes |
struct | g726_state_s |
Typedefs |
typedef int16_t(* | g726_decoder_func_t )(struct g726_state_s *s, uint8_t code) |
typedef uint8_t(* | g726_encoder_func_t )(struct g726_state_s *s, int16_t amp) |
typedef struct g726_state_s | g726_state_t |
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_t * | g726_init (g726_state_t *s, int bit_rate, int ext_coding, int packing) |
int | g726_release (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) |
Detailed Description
Typedef Documentation
The following is the definition of the state structure used by the G.726 encoder and decoder to preserve their internal state between successive calls. The meanings of the majority of the state structure fields are explained in detail in the CCITT Recommendation G.721. The field names are essentially indentical to variable names in the bit level description of the coding algorithm included in this Recommendation.
Function Documentation
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:
-
| s | The G.726 context. |
| amp | The audio sample buffer. |
| g726_data | |
| g726_bytes | |
- Returns:
- The number of samples returned.
Decode a buffer of G.726 ADPCM data to linear PCM, a-law or u-law.
- Parameters:
-
| s | The G.726 context. |
| amp | |
| g726_data | |
| g726_bytes | |
- Returns:
- The number of samples returned.
References g726_state_s::bits_per_sample, bitstream_state_t::bitstream, g726_state_s::bs, g726_state_s::dec_func, g726_state_s::ext_coding, g726_state_s::in_bits, g726_state_s::in_buffer, g726_state_s::packing, and bitstream_state_t::residue.
int g726_encode |
( |
g726_state_t * |
s, |
|
|
uint8_t |
g726_data[], |
|
|
const int16_t |
amp[], |
|
|
int |
len | |
|
) |
| | |
Initialise a G.726 encode or decode context.
- Parameters:
-
| s | The G.726 context. |
| bit_rate | The required bit rate for the ADPCM data. The valid rates are 16000, 24000, 32000 and 40000. |
| ext_coding | The coding used outside G.726. |
| packing | One of the G.726_PACKING_xxx options. |
- Returns:
- A pointer to the G.726 context, or NULL for error.
References g726_state_s::a, g726_state_s::ap, g726_state_s::b, g726_state_s::bits_per_sample, bitstream_init(), g726_state_s::bs, g726_state_s::dec_func, g726_state_s::dml, g726_state_s::dms, g726_state_s::dq, g726_state_s::enc_func, g726_state_s::ext_coding, g726_state_s::in_bits, g726_state_s::in_buffer, g726_state_s::out_bits, g726_state_s::out_buffer, g726_state_s::packing, g726_state_s::pk, g726_state_s::rate, g726_state_s::sr, g726_state_s::td, g726_state_s::yl, and g726_state_s::yu.
Free a G.726 encode or decode context.
- Parameters:
-
- Returns:
- 0 for OK.