spandsp: echo.c File Reference

spandsp 0.0.6

Macros | Functions | Variables
echo.c File Reference
`#include <inttypes.h>`
`#include <stdlib.h>`
`#include "floating_fudge.h"`
`#include <string.h>`
`#include <stdio.h>`
`#include "spandsp/telephony.h"`
`#include "spandsp/fast_convert.h"`
`#include "spandsp/logging.h"`
`#include "spandsp/saturated.h"`
`#include "spandsp/dc_restore.h"`
`#include "spandsp/bit_operations.h"`
`#include "spandsp/echo.h"`
`#include "spandsp/private/echo.h"`

## Macros
#define | NULL (void *) 0
#define | NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
#define | MIN_TX_POWER_FOR_ADAPTION 64*64
#define | MIN_RX_POWER_FOR_ADAPTION 64*64

## Functions
echo_can_state_t * | echo_can_init (int len, int adaption_mode)
int | echo_can_release (echo_can_state_t *ec)
int | echo_can_free (echo_can_state_t *ec)
void | echo_can_adaption_mode (echo_can_state_t *ec, int adaption_mode)
void | echo_can_flush (echo_can_state_t *ec)
void | echo_can_snapshot (echo_can_state_t *ec)
int16_t | echo_can_update (echo_can_state_t *ec, int16_t tx, int16_t rx)
int16_t | echo_can_hpf_tx (echo_can_state_t *ec, int16_t tx)

## Variables
int | sample_no = 0

## Function Documentation

## ◆ echo_can_adaption_mode()

void echo_can_adaption_mode | ( | echo_can_state_t * | ec,
|  | int | adaption_mode
| ) |  |

Set the adaption mode of a voice echo canceller context.

Parameters

  ec | The echo canceller context.
  adaption_mode | The mode.

Referenced by echo_can_init().

## ◆ echo_can_flush()

void echo_can_flush | ( | echo_can_state_t * | ec | ) |

Flush (reinitialise) a voice echo canceller context.

Parameters

  ec | The echo canceller context.

References echo_can_state_s::fir_taps16, and echo_can_state_s::fir_taps32.

## ◆ echo_can_free()

int echo_can_free | ( | echo_can_state_t * | ec | ) |

Free a voice echo canceller context.

Parameters

  ec | The echo canceller context.

Returns
  0 for OK, else -1.

References echo_can_state_s::fir_taps16, and echo_can_state_s::fir_taps32.

## ◆ echo_can_hpf_tx()

int16_t echo_can_hpf_tx | ( | echo_can_state_t * | ec,
|  | int16_t | tx
| ) |  |

Process to high pass filter the tx signal.

Parameters

  ec | The echo canceller context.
  tx | The transmitted auio sample.

Returns
  The HP filtered transmit sample, send this to your D/A.

## ◆ echo_can_init()

echo_can_state_t * echo_can_init | ( | int | len,
|  | int | adaption_mode
| ) |  |

Create a voice echo canceller context.

Parameters

  len | The length of the canceller, in samples.

Returns
  The new canceller context, or NULL if the canceller could not be created.

References echo_can_adaption_mode(), echo_can_state_s::fir_taps16, and echo_can_state_s::fir_taps32.

## ◆ echo_can_release()

int echo_can_release | ( | echo_can_state_t * | ec | ) |

Release a voice echo canceller context.

Parameters

  ec | The echo canceller context.

Returns
  0 for OK, else -1.

## ◆ echo_can_update()

int16_t echo_can_update | ( | echo_can_state_t * | ec,
|  | int16_t | tx,
|  | int16_t | rx
| ) |  |

Process a sample through a voice echo canceller.

Parameters

  ec | The echo canceller context.
  tx | The transmitted audio sample.
  rx | The received audio sample.

Returns
  The clean (echo cancelled) received sample.

References echo_can_state_s::fir_taps16, and echo_can_state_s::fir_taps32.