Translate between signed linear and Internet Low Bitrate Codec.
Definition in file codec_ilbc.c.
decode a frame and store in outbuf
Definition at line 94 of file codec_ilbc.c.
References ast_debug, ast_format_get_attribute_data(), ast_log, BUFFER_SAMPLES, ast_frame::data, ast_frame::datalen, ast_trans_pvt::datalen, ilbc_coder_pvt::dec, ast_translator::dst_codec, ast_frame_subclass::format, ast_trans_pvt::i16, iLBC_decode(), initDecode(), ilbc_coder_pvt::inited, LOG_WARNING, ilbc_attr::mode, NULL, ast_trans_pvt::outbuf, ast_frame::ptr, ast_trans_pvt::pvt, ast_codec::sample_rate, ast_frame::samples, ast_trans_pvt::samples, ast_frame::src, ast_frame::subclass, ast_trans_pvt::t, tmp(), and USE_ILBC_ENHANCER.
98 const unsigned int mode = attr ? attr->
mode : 30;
100 const unsigned int samples_per_frame = mode * sample_rate / 1000;
101 const unsigned int octets_per_frame = (mode == 20) ? 38 : 50;
112 ast_debug(1,
"issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", datalen, f->
src ? f->
src :
"no src set");
118 datalen = octets_per_frame;
119 f->
samples = samples_per_frame;
121 pvt->
samples += samples_per_frame;
124 if (datalen % octets_per_frame) {
125 ast_log(
LOG_WARNING,
"Huh? An ilbc frame that isn't a multiple of %u bytes long from %s (%d)?\n", octets_per_frame, f->
src, datalen);
134 for (x = 0; x < datalen; x += octets_per_frame) {
140 for (i = 0; i < samples_per_frame; i++)
141 dst[pvt->
samples + i] = tmpf[i];
142 pvt->
samples += samples_per_frame;
143 pvt->
datalen += samples_per_frame * 2;
int datalen
actual space used in outbuf
void iLBC_decode(float *decblock, unsigned char *bytes, iLBC_Dec_Inst_t *iLBCdec_inst, int mode)
struct ast_frame_subclass subclass
short initDecode(iLBC_Dec_Inst_t *iLBCdec_inst, int mode, int use_enhancer)
#define ast_debug(level,...)
Log a DEBUG message.
union ast_trans_pvt::@327 outbuf
struct ast_codec dst_codec
unsigned int sample_rate
Sample rate (number of samples carried in a second)
#define USE_ILBC_ENHANCER
struct ast_translator * t
union ast_frame::@263 data
struct ast_format * format
encode the temporary buffer and generate a frame
Definition at line 163 of file codec_ilbc.c.
References ast_format_get_attribute_data(), AST_LIST_NEXT, ast_trans_frameout(), ilbc_coder_pvt::buf, ast_translator::dst_codec, ilbc_coder_pvt::enc, ast_trans_pvt::f, ast_frame_subclass::format, iLBC_encode(), last, ilbc_attr::mode, NULL, ast_trans_pvt::outbuf, ast_trans_pvt::pvt, result, ast_codec::sample_rate, ast_frame::samples, ast_trans_pvt::samples, ast_frame::subclass, ast_trans_pvt::t, and tmp().
171 const unsigned int mode = attr ? attr->
mode : 30;
173 const unsigned int samples_per_frame = mode * sample_rate / 1000;
174 const unsigned int octets_per_frame = (mode == 20) ? 38 : 50;
176 while (pvt->
samples >= samples_per_frame) {
182 for (i = 0; i < samples_per_frame; i++)
183 tmpf[i] = tmp->
buf[samples + i];
186 samples += samples_per_frame;
187 pvt->
samples -= samples_per_frame;
struct ast_frame * ast_trans_frameout(struct ast_trans_pvt *pvt, int datalen, int samples)
generic frameout function
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
void iLBC_encode(unsigned char *bytes, float *block, iLBC_Enc_Inst_t *iLBCenc_inst)
struct ast_frame_subclass subclass
struct sla_ringing_trunk * last
int16_t buf[BUFFER_SAMPLES]
union ast_trans_pvt::@327 outbuf
struct ast_codec dst_codec
unsigned int sample_rate
Sample rate (number of samples carried in a second)
Data structure associated with a single frame of data.
struct ast_translator * t
struct ast_format * format