g722.h File Reference

Go to the source code of this file.

## Typedefs

typedef struct g722_encode_state_s | g722_encode_state_t
typedef struct g722_decode_state_s | g722_decode_state_t

## Enumerations

enum | { G722_SAMPLE_RATE_8000 = 0x0001 , G722_PACKED = 0x0002 }

## Functions

g722_encode_state_t * | g722_encode_init (g722_encode_state_t *s, int rate, int options)
int | g722_encode_release (g722_encode_state_t *s)
int | g722_encode_free (g722_encode_state_t *s)
int | g722_encode (g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len)
g722_decode_state_t * | g722_decode_init (g722_decode_state_t *s, int rate, int options)
int | g722_decode_release (g722_decode_state_t *s)
int | g722_decode_free (g722_decode_state_t *s)
int | g722_decode (g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len)

## Typedef Documentation

## g722_decode_state_t

typedef struct g722_decode_state_s g722_decode_state_t

G.722 decode state

## g722_encode_state_t

typedef struct g722_encode_state_s g722_encode_state_t

G.722 encode state

## Function Documentation

## g722_decode()

int g722_decode | ( | g722_decode_state_t * | s,
|  | int16_t | amp[],
|  | const uint8_t | g722_data[],
|  | int | len )

Decode a buffer of G.722 data to linear PCM.

Parameters

  s | The G.722 context.
  amp | The audio sample buffer.
  g722_data |
  len |

Returns
  The number of samples returned.

References g722_decode_state_s::bits_per_sample, g722_decode_state_s::eight_k, g722_decode_state_s::itu_test_mode, g722_decode_state_s::packed, and g722_decode_state_s::x.

## g722_decode_free()

int g722_decode_free | ( | g722_decode_state_t * | s | ) |

Free a G.722 decode context.

Parameters

  s | The G.722 decode context.

Returns
  0 for OK.

## g722_decode_init()

g722_decode_state_t * g722_decode_init | ( | g722_decode_state_t * | s,
|  | int | rate,
|  | int | options )

Initialise an G.722 decode context.

Parameters

  s | The G.722 decode context.
  rate | The bit rate of the G.722 data. The valid rates are 64000, 56000 and 48000.
  options |

Returns
  A pointer to the G.722 decode context, or NULL for error.

References g722_decode_state_s::bits_per_sample, g722_decode_state_s::eight_k, and g722_decode_state_s::packed.

## g722_decode_release()

int g722_decode_release | ( | g722_decode_state_t * | s | ) |

Release a G.722 decode context.

Parameters

  s | The G.722 decode context.

Returns
  0 for OK.

## g722_encode()

int g722_encode | ( | g722_encode_state_t * | s,
|  | uint8_t | g722_data[],
|  | const int16_t | amp[],
|  | int | len )

Encode a buffer of linear PCM data to G.722

Parameters

  s | The G.722 context.
  g722_data | The G.722 data produced.
  amp | The audio sample buffer.
  len | The number of samples in the buffer.

Returns
  The number of bytes of G.722 data produced.

References g722_encode_state_s::bits_per_sample, g722_encode_state_s::eight_k, g722_encode_state_s::itu_test_mode, g722_encode_state_s::packed, and g722_encode_state_s::x.

## g722_encode_free()

int g722_encode_free | ( | g722_encode_state_t * | s | ) |

Free a G.722 encode context.

Parameters

  s | The G.722 encode context.

Returns
  0 for OK.

## g722_encode_init()

g722_encode_state_t * g722_encode_init | ( | g722_encode_state_t * | s,
|  | int | rate,
|  | int | options )

Initialise an G.722 encode context.

Parameters

  s | The G.722 encode context.
  rate | The required bit rate for the G.722 data. The valid rates are 64000, 56000 and 48000.
  options |

Returns
  A pointer to the G.722 encode context, or NULL for error.

References g722_encode_state_s::bits_per_sample, g722_encode_state_s::eight_k, and g722_encode_state_s::packed.

## g722_encode_release()

int g722_encode_release | ( | g722_encode_state_t * | s | ) |

Release a G.722 encode context.

Parameters

  s | The G.722 encode context.

Returns
  0 for OK.