spandsp: plc.h File Reference

spandsp 0.0.6

plc.h File Reference

Go to the source code of this file.

## Classes
struct | plc_state_t

## Macros
#define | PLC_PITCH_MIN 120
#define | PLC_PITCH_MAX 40
#define | PLC_PITCH_OVERLAP_MAX (PLC_PITCH_MIN >> 2)
#define | CORRELATION_SPAN 160
#define | PLC_HISTORY_LEN (CORRELATION_SPAN + PLC_PITCH_MIN)

## Functions
int | plc_rx (plc_state_t *s, int16_t amp[], int len)
| Process a block of received audio samples for PLC.
int | plc_fillin (plc_state_t *s, int16_t amp[], int len)
| Fill-in a block of missing audio samples.
plc_state_t * | plc_init (plc_state_t *s)
| Initialise a PLC context.
int | plc_release (plc_state_t *s)
int | plc_free (plc_state_t *s)

## Macro Definition Documentation

## ◆ CORRELATION_SPAN

#define CORRELATION_SPAN 160

The length over which the AMDF function looks for similarity (20 ms)

Referenced by plc_fillin().

## ◆ PLC_HISTORY_LEN

#define PLC_HISTORY_LEN (CORRELATION_SPAN + PLC_PITCH_MIN)

History buffer length. The buffer much also be at leat 1.25 times PLC_PITCH_MIN, but that is much smaller than the buffer needs to be for the pitch assessment.

Referenced by plc_fillin().

## ◆ PLC_PITCH_MAX

#define PLC_PITCH_MAX 40

Maximum allowed pitch (200 Hz)

Referenced by plc_fillin().

## ◆ PLC_PITCH_MIN

#define PLC_PITCH_MIN 120

Minimum allowed pitch (66 Hz)

Referenced by plc_fillin().

## ◆ PLC_PITCH_OVERLAP_MAX

#define PLC_PITCH_OVERLAP_MAX (PLC_PITCH_MIN >> 2)

Maximum pitch OLA window

## Function Documentation

## ◆ plc_fillin()

int plc_fillin | ( | plc_state_t * | s,
|  | int16_t | amp[],
|  | int | len )

Fill-in a block of missing audio samples.

Fill-in a block of missing audio samples.

Parameters

  s | The packet loss concealer context.
  amp | The audio sample buffer.
  len | The number of samples to be synthesised.

Returns
  The number of samples synthesized.

References CORRELATION_SPAN, plc_state_t::history, plc_state_t::missing_samples, plc_state_t::pitch, plc_state_t::pitch_offset, plc_state_t::pitchbuf, PLC_HISTORY_LEN, PLC_PITCH_MAX, and PLC_PITCH_MIN.

## ◆ plc_free()

int plc_free | ( | plc_state_t * | s | ) |

Free a packet loss concealer context.

Parameters

  s | The packet loss concealer context.

Returns
  0 for OK.

## ◆ plc_init()

plc_state_t * plc_init | ( | plc_state_t * | s | ) |

Initialise a PLC context.

Initialise a packet loss concealer context.

Parameters

  s | The packet loss concealer context.

Returns
  A pointer to the the packet loss concealer context.

## ◆ plc_release()

int plc_release | ( | plc_state_t * | s | ) |

Release a packet loss concealer context.

Parameters

  s | The packet loss concealer context.

Returns
  0 for OK.

## ◆ plc_rx()

int plc_rx | ( | plc_state_t * | s,
|  | int16_t | amp[],
|  | int | len )

Process a block of received audio samples for PLC.

Process a block of received audio samples for PLC.

Parameters

  s | The packet loss concealer context.
  amp | The audio sample buffer.
  len | The number of samples in the buffer.

Returns
  The number of samples in the buffer.

References plc_state_t::missing_samples, plc_state_t::pitch, plc_state_t::pitch_offset, and plc_state_t::pitchbuf.