spandsp
3.0.0
|
#include <inttypes.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/math_fixed.h"
#include "spandsp/agc_float.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/agc_float.h"
Macros | |
#define | DC_BLOCK_COEFF 0.9921875 |
#define | power_threshold_dbm0(len, thresh) (float) (((len)*32768.0f*32768.0f/2.0f)*powf(10.0f, ((thresh) - DBM0_MAX_SINE_POWER)/10.0f)) |
Functions | |
agcf_descriptor_t * | agcf_make_descriptor (agcf_descriptor_t *s, float signal_target_power, float signal_on_power_threshold, float signal_off_power_threshold, int signal_on_persistence_check, int signal_off_persistence_check) |
Create an AGC descriptor. More... | |
int | agcf_free_descriptor (agcf_descriptor_t *s) |
bool | agcf_from_int16_rx (agcf_state_t *s, float out[], const int16_t in[], int len) |
Process a block of received samples. More... | |
bool | agcf_rx (agcf_state_t *s, float out[], const float in[], int len) |
Process a block of received samples. More... | |
float | agcf_get_scaling (agcf_state_t *s) |
void | agcf_set_scaling (agcf_state_t *s, float scaling) |
float | agcf_current_power_dbm0 (agcf_state_t *s) |
void | agcf_set_adaption (agcf_state_t *s, bool adapt) |
logging_state_t * | agcf_get_logging_state (agcf_state_t *s) |
Get the logging context associated with an AGC context. More... | |
agcf_state_t * | agcf_init (agcf_state_t *s, const agcf_descriptor_t *desc) |
Initialise an AGC context. More... | |
int | agcf_release (agcf_state_t *s) |
Release an AGC receive context. More... | |
int | agcf_free (agcf_state_t *s) |
Free the resources of an ADSI receive context. More... | |
int agcf_free | ( | agcf_state_t * | s | ) |
Free the resources of an ADSI receive context.
s | The ADSI receive context. |
bool agcf_from_int16_rx | ( | agcf_state_t * | s, |
float | out[], | ||
const int16_t | in[], | ||
int | len | ||
) |
Process a block of received samples.
Process a block of received samples.
out | The output buffer for the scaled samples. |
in | The input buffer for the samples. |
len | The length of the in and out buffers. |
logging_state_t* agcf_get_logging_state | ( | agcf_state_t * | s | ) |
Get the logging context associated with an AGC context.
Get the logging context associated with an AGC context.
s | The AGC context. |
float agcf_get_scaling | ( | agcf_state_t * | s | ) |
Get the current scaling.
agcf_state_t* agcf_init | ( | agcf_state_t * | s, |
const agcf_descriptor_t * | desc | ||
) |
Initialise an AGC context.
s | The AGC context. |
desc |
agcf_descriptor_t* agcf_make_descriptor | ( | agcf_descriptor_t * | s, |
float | signal_target_power, | ||
float | signal_on_power_threshold, | ||
float | signal_off_power_threshold, | ||
int | signal_on_persistence_check, | ||
int | signal_off_persistence_check | ||
) |
Create an AGC descriptor.
s | The AGC context. |
signal_target_power | The power to normalize to, in dBm0. |
signal_on_power_threshold | The minimum power to declare signal on, in dBm0. |
signal_off_power_threshold | The maximum power to declare signal off, in dBm0. |
signal_on_persistence_check | Persistence check count for signal on. |
signal_off_persistence_check | Persistence check count for signal off. |
int agcf_release | ( | agcf_state_t * | s | ) |
Release an AGC receive context.
s | The ADSI receive context. |
bool agcf_rx | ( | agcf_state_t * | s, |
float | out[], | ||
const float | in[], | ||
int | len | ||
) |
Process a block of received samples.
Process a block of received samples.
out | The output buffer for the scaled samples. |
in | The input buffer for the samples. |
len | The length of the in and out buffers. |
void agcf_set_adaption | ( | agcf_state_t * | s, |
bool | adapt | ||
) |
Enable or disable AGC adpation.
void agcf_set_scaling | ( | agcf_state_t * | s, |
float | scaling | ||
) |
Set the scaling, instead of adapting it. This allows a known good scaling factor to be resused within a session.