52 #if !defined(INT16_MAX) 53 #define INT16_MAX (32767) 54 #define INT16_MIN (-32767-1) 58 #define ATTENUATION_INCREMENT 0.0025 60 #define ms_to_samples(t) (((t)*DEFAULT_SAMPLE_RATE)/1000) 118 for (i = max_pitch; i <= min_pitch; i++) {
120 for (j = 0; j <
len; j++)
121 acc +=
abs(amp[i + j] - amp[j]);
148 pitch_overlap = s->
pitch >> 2;
149 if (pitch_overlap > len)
154 new_step = 1.0/pitch_overlap;
155 old_step = new_step*gain;
156 new_weight = new_step;
157 old_weight = (1.0 - new_step)*gain;
158 for (i = 0; i < pitch_overlap; i++) {
162 new_weight += new_step;
163 old_weight -= old_step;
164 if (old_weight < 0.0)
193 pitch_overlap = s->
pitch >> 2;
197 for (i = 0; i < s->
pitch - pitch_overlap; i++)
200 new_step = 1.0/pitch_overlap;
201 new_weight = new_step;
202 for ( ; i < s->
pitch; i++) {
204 new_weight += new_step;
213 new_step = 1.0 / pitch_overlap;
215 new_weight = new_step;
216 old_weight = 1.0 - new_step;
217 for (i = 0; i < pitch_overlap; i++) {
219 new_weight += new_step;
220 old_weight -= old_step;
221 if (old_weight < 0.0)
229 for ( ; gain > 0.0 && i <
len; i++) {
235 for ( ; i <
len; i++)
246 memset(s, 0,
sizeof(*s));
263 if (!strcasecmp(var->
name,
"genericplc")) {
265 }
else if (!strcasecmp(var->
name,
"genericplc_on_equal_codecs")) {
299 .requires =
"extconfig",
struct ast_variable * next
#define ATTENUATION_INCREMENT
Asterisk main include file. File version handling, generic pbx functions.
#define ast_set2_flag(p, value, flag)
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
static void normalise_history(plc_state_t *s)
#define CONFIG_STATUS_FILEINVALID
int16_t history[PLC_HISTORY_LEN]
Structure for variables, used for configurations and for channel variables.
static int load_module(void)
int plc_rx(plc_state_t *s, int16_t amp[], int len)
Process a block of received audio samples.
int plc_fillin(plc_state_t *s, int16_t amp[], int len)
Fill-in a block of missing audio samples.
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
plc_state_t * plc_init(plc_state_t *s)
Process a block of received V.29 modem audio samples.
#define ast_opt_generic_plc
#define CONFIG_STATUS_FILEUNCHANGED
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
static int16_t fsaturate(double damp)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static void save_history(plc_state_t *s, int16_t *buf, int len)
static int reload_module(void)
static int unload_module(void)
Structure used to handle boolean flags.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
#define CONFIG_STATUS_FILEMISSING
struct ast_flags ast_options
SpanDSP - a series of DSP components for telephony.
static int __inline__ amdf_pitch(int min_pitch, int max_pitch, int16_t amp[], int len)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
float pitchbuf[PLC_PITCH_MIN]