38 #include "asterisk/lock.h"
48 #define BUFFER_SAMPLES 8096
58 static int indsft[8] = { -1, -1, -1, -1, 2, 4, 6, 8 };
65 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73,
66 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279,
67 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963,
68 1060, 1166, 1282, 1411, 1552
101 sign = encoded & 0x08;
104 diff = (((encoded << 1) + 1) * step) >> 3;
113 if ((encoded >> 1) & step & 0x1)
128 else if (state->
signal < -2047)
140 else if (state->
signal < 0)
145 state->
ssindex += indsft[encoded];
151 return state->
signal << 4;
178 diff = csig - state->
signal;
182 encoded = (-diff << 2) / step;
187 encoded = (diff << 2) / step;
235 unsigned char *src = f->
data.
ptr;
270 for (i = 0; i < pvt->
samples; i += 2) {
292 .
name =
"adpcmtolin",
303 .
name =
"lintoadpcm",
struct ast_frame * ast_trans_frameout(struct ast_trans_pvt *pvt, int datalen, int samples)
generic frameout function
int datalen
actual space used in outbuf
Asterisk main include file. File version handling, generic pbx functions.
static struct ast_frame * adpcm_sample(void)
union ast_trans_pvt::@213 outbuf
Workspace for translating ADPCM signals to signed linear.
static int load_module(void)
Descriptor of a translator.
static struct ast_translator lintoadpcm
Support for translation of data formats. translate.c.
static int adpcm(short csig, struct adpcm_state *state)
static int reload(void)
standard module glue
Configuration File Parser.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
static struct ast_frame * slin8_sample(void)
static int lintoadpcm_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
fill input buffer with 16-bit signed linear PCM values.
static struct ast_frame * lintoadpcm_frameout(struct ast_trans_pvt *pvt)
convert inbuf and store into frame
#define ast_register_translator(t)
See __ast_register_translator()
int ast_unregister_translator(struct ast_translator *t)
Unregister a translator Unregisters the given tranlator.
A set of macros to manage forward-linked lists.
static struct ast_translator adpcmtolin
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
static int adpcmtolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
decode 4-bit adpcm frame data and store in output buffer
#define AST_FORMAT_SLINEAR
Data structure associated with a single frame of data.
Workspace for translating signed linear signals to ADPCM.
int16_t inbuf[BUFFER_SAMPLES]
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
union ast_frame::@172 data
static int unload_module(void)
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
static short decode(int encoded, struct adpcm_state *state)