1 /* codec_g726.c - translate between signed linear and ITU G.726-32kbps
3 * Asterisk -- A telephony toolkit for Linux.
5 * Based on frompcm.c and topcm.c from the Emiliano MIPL browser/
6 * interpreter. See http://www.bsdtelephony.com.mx
8 * Copyright (c) 2004 - 2005, Digium, Inc.
10 * Mark Spencer <markster@digium.com>
12 * This program is free software, distributed under the terms of
13 * the GNU General Public License
16 #include <asterisk/lock.h>
17 #include <asterisk/logger.h>
18 #include <asterisk/module.h>
19 #include <asterisk/config.h>
20 #include <asterisk/options.h>
21 #include <asterisk/translate.h>
22 #include <asterisk/channel.h>
24 #include <netinet/in.h>
33 /* define NOT_BLI to use a faster but not bit-level identical version */
37 # if defined(_MSC_VER)
38 typedef __int64 sint64;
39 # elif defined(__GNUC__)
40 typedef long long sint64;
42 # error 64-bit integer type is not defined for your compiler/platform
46 #define BUFFER_SIZE 8096 /* size for the translation buffers */
49 AST_MUTEX_DEFINE_STATIC(localuser_lock);
50 static int localusecnt = 0;
52 static char *tdesc = "ITU G.726-32kbps G726 Transcoder";
54 static int useplc = 0;
56 /* Sample frame data */
58 #include "slin_g726_ex.h"
59 #include "g726_slin_ex.h"
62 * The following is the definition of the state structure
63 * used by the G.721/G.723 encoder and decoder to preserve their internal
64 * state between successive calls. The meanings of the majority
65 * of the state structure fields are explained in detail in the
66 * CCITT Recommendation G.721. The field names are essentially indentical
67 * to variable names in the bit level description of the coding algorithm
68 * included in this Recommendation.
71 long yl; /* Locked or steady state step size multiplier. */
72 int yu; /* Unlocked or non-steady state step size multiplier. */
73 int dms; /* Short term energy estimate. */
74 int dml; /* Long term energy estimate. */
75 int ap; /* Linear weighting coefficient of 'yl' and 'yu'. */
77 int a[2]; /* Coefficients of pole portion of prediction filter.
78 * stored as fixed-point 1==2^14 */
79 int b[6]; /* Coefficients of zero portion of prediction filter.
80 * stored as fixed-point 1==2^14 */
81 int pk[2]; /* Signs of previous two samples of a partially
82 * reconstructed signal.
84 int dq[6]; /* Previous 6 samples of the quantized difference signal
85 * stored as fixed point 1==2^12,
86 * or in internal floating point format */
87 int sr[2]; /* Previous 2 samples of the quantized difference signal
88 * stored as fixed point 1==2^12,
89 * or in internal floating point format */
90 int td; /* delayed tone detect, new in 1988 version */
95 static int qtab_721[7] = {-124, 80, 178, 246, 300, 349, 400};
97 * Maps G.721 code word to reconstructed scale factor normalized log
100 static int _dqlntab[16] = {-2048, 4, 135, 213, 273, 323, 373, 425,
101 425, 373, 323, 273, 213, 135, 4, -2048};
103 /* Maps G.721 code word to log of scale factor multiplier. */
104 static int _witab[16] = {-12, 18, 41, 64, 112, 198, 355, 1122,
105 1122, 355, 198, 112, 64, 41, 18, -12};
107 * Maps G.721 code words to a set of values whose long and short
108 * term averages are computed and then compared to give an indication
109 * how stationary (steady state) the signal is.
111 static int _fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00,
112 0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0};
115 static int power2[15] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80,
116 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000};
122 * This routine initializes and/or resets the g726_state structure
123 * pointed to by 'state_ptr'.
124 * All the initial state values are specified in the CCITT G.721 document.
126 static void g726_init_state(struct g726_state *state_ptr)
130 state_ptr->yl = 34816;
135 for (cnta = 0; cnta < 2; cnta++)
137 state_ptr->a[cnta] = 0;
138 state_ptr->pk[cnta] = 0;
140 state_ptr->sr[cnta] = 1;
142 state_ptr->sr[cnta] = 32;
145 for (cnta = 0; cnta < 6; cnta++)
147 state_ptr->b[cnta] = 0;
149 state_ptr->dq[cnta] = 1;
151 state_ptr->dq[cnta] = 32;
160 * quantizes the input val against the table of integers.
161 * It returns i if table[i - 1] <= val < table[i].
163 * Using linear search for simple coding.
165 static int quan(int val, int *table, int size)
169 for (i = 0; i < size && val >= *table; ++i, ++table)
174 #ifdef NOT_BLI /* faster non-identical version */
179 * computes the estimated signal from 6-zero predictor.
182 static int predictor_zero(struct g726_state *state_ptr)
183 { /* divide by 2 is necessary here to handle negative numbers correctly */
186 for (sezi = 0, i = 0; i < 6; i++) /* ACCUM */
187 sezi += (sint64)state_ptr->b[i] * state_ptr->dq[i];
188 return (int)(sezi >> 13) / 2 /* 2^14 */;
194 * computes the estimated signal from 2-pole predictor.
197 static int predictor_pole(struct g726_state *state_ptr)
198 { /* divide by 2 is necessary here to handle negative numbers correctly */
199 return (int)(((sint64)state_ptr->a[1] * state_ptr->sr[1] +
200 (sint64)state_ptr->a[0] * state_ptr->sr[0]) >> 13) / 2 /* 2^14 */;
203 #else /* NOT_BLI - identical version */
207 * returns the integer product of the fixed-point number "an" (1==2^12) and
208 * "floating point" representation (4-bit exponent, 6-bit mantessa) "srn".
210 static int fmult(int an, int srn)
212 int anmag, anexp, anmant;
216 anmag = (an > 0) ? an : ((-an) & 0x1FFF);
217 anexp = log2(anmag) - 5;
218 anmant = (anmag == 0) ? 32 :
219 (anexp >= 0) ? anmag >> anexp : anmag << -anexp;
220 wanexp = anexp + ((srn >> 6) & 0xF) - 13;
222 wanmant = (anmant * (srn & 077) + 0x30) >> 4;
223 retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) :
224 (wanmant >> -wanexp);
226 return (((an ^ srn) < 0) ? -retval : retval);
229 static int predictor_zero(struct g726_state *state_ptr)
233 for (sezi = 0, i = 0; i < 6; i++) /* ACCUM */
234 sezi += fmult(state_ptr->b[i] >> 2, state_ptr->dq[i]);
238 static int predictor_pole(struct g726_state *state_ptr)
240 return (fmult(state_ptr->a[1] >> 2, state_ptr->sr[1]) +
241 fmult(state_ptr->a[0] >> 2, state_ptr->sr[0]));
249 * computes the quantization step size of the adaptive quantizer.
252 static int step_size(struct g726_state *state_ptr)
258 if (state_ptr->ap >= 256)
259 return (state_ptr->yu);
261 y = state_ptr->yl >> 6;
262 dif = state_ptr->yu - y;
263 al = state_ptr->ap >> 2;
265 y += (dif * al) >> 6;
267 y += (dif * al + 0x3F) >> 6;
275 * Given a raw sample, 'd', of the difference signal and a
276 * quantization step size scale factor, 'y', this routine returns the
277 * ADPCM codeword to which that sample gets quantized. The step
278 * size scale factor division operation is done in the log base 2 domain
282 int d, /* Raw difference signal sample */
283 int y, /* Step size multiplier */
284 int *table, /* quantization table */
285 int size) /* table size of integers */
287 int dqm; /* Magnitude of 'd' */
288 int exp; /* Integer part of base 2 log of 'd' */
289 int mant; /* Fractional part of base 2 log */
290 int dl; /* Log of magnitude of 'd' */
291 int dln; /* Step size scale factor normalized log */
297 * Compute base 2 log of 'd', and store in 'dl'.
303 mant = ((dqm << 7) >> exp) & 0x7F; /* Fractional portion. */
304 dl = (exp << 7) | mant;
309 * "Divide" by step size multiplier.
316 * Obtain codword i for 'd'.
318 i = quan(dln, table, size);
319 if (d < 0) /* take 1's complement of i */
320 return ((size << 1) + 1 - i);
321 else if (i == 0) /* take 1's complement of 0 */
322 return ((size << 1) + 1); /* new in 1988 */
330 * Returns reconstructed difference signal 'dq' obtained from
331 * codeword 'i' and quantization step size scale factor 'y'.
332 * Multiplication is performed in log base 2 domain as addition.
334 static int reconstruct(
335 int sign, /* 0 for non-negative value */
336 int dqln, /* G.72x codeword */
337 int y) /* Step size multiplier */
339 int dql; /* Log of 'dq' magnitude */
340 int dex; /* Integer part of log */
342 int dq; /* Reconstructed difference signal sample */
344 dql = dqln + (y >> 2); /* ADDA */
348 return (sign) ? -1 : 1;
350 return (sign) ? -0x8000 : 0;
352 } else { /* ANTILOG */
353 dex = (dql >> 7) & 15;
354 dqt = 128 + (dql & 127);
356 dq = ((dqt << 19) >> (14 - dex));
357 return (sign) ? -dq : dq;
359 dq = (dqt << 7) >> (14 - dex);
360 return (sign) ? (dq - 0x8000) : dq;
368 * updates the state variables for each output code
371 int code_size, /* distinguish 723_40 with others */
372 int y, /* quantizer step size */
373 int wi, /* scale factor multiplier */
374 int fi, /* for long/short term energies */
375 int dq, /* quantized prediction difference */
376 int sr, /* reconstructed signal */
377 int dqsez, /* difference from 2-pole predictor */
378 struct g726_state *state_ptr) /* coder state pointer */
381 int mag; /* Adaptive predictor, FLOAT A */
385 int a2p=0; /* LIMC */
389 int tr; /* tone/transition detector */
390 int ylint, thr2, dqthr;
394 pk0 = (dqsez < 0) ? 1 : 0; /* needed in updating predictor poles */
397 mag = abs(dq / 0x1000); /* prediction difference magnitude */
399 mag = dq & 0x7FFF; /* prediction difference magnitude */
402 ylint = state_ptr->yl >> 15; /* exponent part of yl */
403 ylfrac = (state_ptr->yl >> 10) & 0x1F; /* fractional part of yl */
404 thr1 = (32 + ylfrac) << ylint; /* threshold */
405 thr2 = (ylint > 9) ? 31 << 10 : thr1; /* limit thr2 to 31 << 10 */
406 dqthr = (thr2 + (thr2 >> 1)) >> 1; /* dqthr = 0.75 * thr2 */
407 if (state_ptr->td == 0) /* signal supposed voice */
409 else if (mag <= dqthr) /* supposed data, but small mag */
410 tr = 0; /* treated as voice */
411 else /* signal is data (modem) */
415 * Quantizer scale factor adaptation.
418 /* FUNCTW & FILTD & DELAY */
419 /* update non-steady state step size multiplier */
420 state_ptr->yu = y + ((wi - y) >> 5);
423 if (state_ptr->yu < 544) /* 544 <= yu <= 5120 */
425 else if (state_ptr->yu > 5120)
426 state_ptr->yu = 5120;
429 /* update steady state step size multiplier */
430 state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6);
433 * Adaptive predictor coefficients.
435 if (tr == 1) { /* reset a's and b's for modem signal */
444 } else { /* update a's and b's */
445 pks1 = pk0 ^ state_ptr->pk[0]; /* UPA2 */
447 /* update predictor pole a[1] */
448 a2p = state_ptr->a[1] - (state_ptr->a[1] >> 7);
450 fa1 = (pks1) ? state_ptr->a[0] : -state_ptr->a[0];
451 if (fa1 < -8191) /* a2p = function of fa1 */
458 if (pk0 ^ state_ptr->pk[1])
462 else if (a2p >= 12416)
466 else if (a2p <= -12416)
468 else if (a2p >= 12160)
475 state_ptr->a[1] = a2p;
478 /* update predictor pole a[0] */
479 state_ptr->a[0] -= state_ptr->a[0] >> 8;
482 state_ptr->a[0] += 192;
484 state_ptr->a[0] -= 192;
488 if (state_ptr->a[0] < -a1ul)
489 state_ptr->a[0] = -a1ul;
490 else if (state_ptr->a[0] > a1ul)
491 state_ptr->a[0] = a1ul;
493 /* UPB : update predictor zeros b[6] */
494 for (cnt = 0; cnt < 6; cnt++) {
495 if (code_size == 5) /* for 40Kbps G.723 */
496 state_ptr->b[cnt] -= state_ptr->b[cnt] >> 9;
497 else /* for G.721 and 24Kbps G.723 */
498 state_ptr->b[cnt] -= state_ptr->b[cnt] >> 8;
501 if ((dq ^ state_ptr->dq[cnt]) >= 0)
502 state_ptr->b[cnt] += 128;
504 state_ptr->b[cnt] -= 128;
509 for (cnt = 5; cnt > 0; cnt--)
510 state_ptr->dq[cnt] = state_ptr->dq[cnt-1];
512 state_ptr->dq[0] = dq;
514 /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */
516 state_ptr->dq[0] = (dq >= 0) ? 0x20 : 0x20 - 0x400;
519 state_ptr->dq[0] = (dq >= 0) ?
520 (exp << 6) + ((mag << 6) >> exp) :
521 (exp << 6) + ((mag << 6) >> exp) - 0x400;
525 state_ptr->sr[1] = state_ptr->sr[0];
527 state_ptr->sr[0] = sr;
529 /* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */
531 state_ptr->sr[0] = 0x20;
534 state_ptr->sr[0] = (exp << 6) + ((sr << 6) >> exp);
535 } else if (sr > -0x8000) {
538 state_ptr->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400;
540 state_ptr->sr[0] = 0x20 - 0x400;
544 state_ptr->pk[1] = state_ptr->pk[0];
545 state_ptr->pk[0] = pk0;
548 if (tr == 1) /* this sample has been treated as data */
549 state_ptr->td = 0; /* next one will be treated as voice */
550 else if (a2p < -11776) /* small sample-to-sample correlation */
551 state_ptr->td = 1; /* signal may be data */
552 else /* signal is voice */
556 * Adaptation speed control.
558 state_ptr->dms += (fi - state_ptr->dms) >> 5; /* FILTA */
559 state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7); /* FILTB */
563 else if (y < 1536) /* SUBTC */
564 state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
565 else if (state_ptr->td == 1)
566 state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
567 else if (abs((state_ptr->dms << 2) - state_ptr->dml) >=
568 (state_ptr->dml >> 3))
569 state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
571 state_ptr->ap += (-state_ptr->ap) >> 4;
579 * Decodes a 4-bit code of G.726-32 encoded data of i and
580 * returns the resulting linear PCM, A-law or u-law value.
581 * return -1 for unknown out_coding value.
583 static int g726_decode(int i, struct g726_state *state_ptr)
585 int sezi, sez, se; /* ACCUM */
591 i &= 0x0f; /* mask to get proper bits */
593 sezi = predictor_zero(state_ptr);
595 se = sezi + predictor_pole(state_ptr); /* estimated signal */
597 sezi = predictor_zero(state_ptr);
599 se = (sezi + predictor_pole(state_ptr)) >> 1; /* estimated signal */
602 y = step_size(state_ptr); /* dynamic quantizer step size */
604 dq = reconstruct(i & 8, _dqlntab[i], y); /* quantized diff. */
607 sr = se + dq; /* reconst. signal */
608 dqsez = dq + sez; /* pole prediction diff. */
610 sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconst. signal */
611 dqsez = sr - se + sez; /* pole prediction diff. */
614 update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr);
617 return (sr >> 10); /* sr was 26-bit dynamic range */
619 return (sr << 2); /* sr was 14-bit dynamic range */
626 * Encodes the input vale of linear PCM, A-law or u-law data sl and returns
627 * the resulting code. -1 is returned for unknown input coding value.
629 static int g726_encode(int sl, struct g726_state *state_ptr)
631 int sezi, se, sez; /* ACCUM */
635 int dqsez; /* ADDC */
639 sl <<= 10; /* 26-bit dynamic range */
641 sezi = predictor_zero(state_ptr);
643 se = sezi + predictor_pole(state_ptr); /* estimated signal */
645 sl >>= 2; /* 14-bit dynamic range */
647 sezi = predictor_zero(state_ptr);
649 se = (sezi + predictor_pole(state_ptr)) >> 1; /* estimated signal */
652 d = sl - se; /* estimation difference */
654 /* quantize the prediction difference */
655 y = step_size(state_ptr); /* quantizer step size */
659 i = quantize(d, y, qtab_721, 7); /* i = G726 code */
661 dq = reconstruct(i & 8, _dqlntab[i], y); /* quantized est diff */
664 sr = se + dq; /* reconst. signal */
665 dqsez = dq + sez; /* pole prediction diff. */
667 sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconst. signal */
668 dqsez = sr - se + sez; /* pole prediction diff. */
671 update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr);
677 * Private workspace for translating signed linear signals to G726.
680 struct g726_encoder_pvt
683 char offset[AST_FRIENDLY_OFFSET]; /* Space to build offset */
684 unsigned char outbuf[BUFFER_SIZE]; /* Encoded G726, two nibbles to a word */
685 unsigned char next_flag;
686 struct g726_state g726;
691 * Private workspace for translating G726 signals to signed linear.
694 struct g726_decoder_pvt
697 char offset[AST_FRIENDLY_OFFSET]; /* Space to build offset */
698 short outbuf[BUFFER_SIZE]; /* Decoded signed linear values */
699 struct g726_state g726;
706 * Create a new instance of g726_decoder_pvt.
709 * Returns a pointer to the new instance.
715 static struct ast_translator_pvt *
718 struct g726_decoder_pvt *tmp;
719 tmp = malloc (sizeof (struct g726_decoder_pvt));
722 memset(tmp, 0, sizeof(*tmp));
726 g726_init_state(&tmp->g726);
727 ast_update_use_count ();
729 return (struct ast_translator_pvt *) tmp;
734 * Create a new instance of g726_encoder_pvt.
737 * Returns a pointer to the new instance.
743 static struct ast_translator_pvt *
746 struct g726_encoder_pvt *tmp;
747 tmp = malloc (sizeof (struct g726_encoder_pvt));
750 memset(tmp, 0, sizeof(*tmp));
753 g726_init_state(&tmp->g726);
754 ast_update_use_count ();
756 return (struct ast_translator_pvt *) tmp;
761 * Fill an input buffer with packed 4-bit G726 values if there is room
768 * tmp->tail is the number of packed values in the buffer.
772 g726tolin_framein (struct ast_translator_pvt *pvt, struct ast_frame *f)
774 struct g726_decoder_pvt *tmp = (struct g726_decoder_pvt *) pvt;
778 if(f->datalen == 0) { /* perform PLC with nominal framesize of 20ms/160 samples */
779 if((tmp->tail + 160) > BUFFER_SIZE) {
780 ast_log(LOG_WARNING, "Out of buffer space\n");
784 plc_fillin(&tmp->plc, tmp->outbuf+tmp->tail, 160);
791 for (x=0;x<f->datalen;x++) {
792 if (tmp->tail >= BUFFER_SIZE) {
793 ast_log(LOG_WARNING, "Out of buffer space!\n");
796 tmp->outbuf[tmp->tail++] = g726_decode((b[x] >> 4) & 0xf, &tmp->g726);
797 if (tmp->tail >= BUFFER_SIZE) {
798 ast_log(LOG_WARNING, "Out of buffer space!\n");
801 tmp->outbuf[tmp->tail++] = g726_decode(b[x] & 0x0f, &tmp->g726);
804 if(useplc) plc_rx(&tmp->plc, tmp->outbuf+tmp->tail-f->datalen*2, f->datalen*2);
811 * Convert 4-bit G726 encoded signals to 16-bit signed linear.
814 * Converted signals are placed in tmp->f.data, tmp->f.datalen
815 * and tmp->f.samples are calculated.
821 static struct ast_frame *
822 g726tolin_frameout (struct ast_translator_pvt *pvt)
824 struct g726_decoder_pvt *tmp = (struct g726_decoder_pvt *) pvt;
829 tmp->f.frametype = AST_FRAME_VOICE;
830 tmp->f.subclass = AST_FORMAT_SLINEAR;
831 tmp->f.datalen = tmp->tail * 2;
832 tmp->f.samples = tmp->tail;
834 tmp->f.offset = AST_FRIENDLY_OFFSET;
835 tmp->f.src = __PRETTY_FUNCTION__;
836 tmp->f.data = tmp->outbuf;
843 * Fill an input buffer with 16-bit signed linear PCM values.
849 * tmp->tail is number of signal values in the input buffer.
853 lintog726_framein (struct ast_translator_pvt *pvt, struct ast_frame *f)
855 struct g726_encoder_pvt *tmp = (struct g726_encoder_pvt *) pvt;
857 int samples = f->datalen / 2;
859 for (x=0;x<samples;x++) {
860 if (tmp->next_flag & 0x80) {
861 if (tmp->tail >= BUFFER_SIZE) {
862 ast_log(LOG_WARNING, "Out of buffer space\n");
865 tmp->outbuf[tmp->tail++] = ((tmp->next_flag & 0xf)<< 4) | g726_encode(s[x], &tmp->g726);
868 tmp->next_flag = 0x80 | g726_encode(s[x], &tmp->g726);
876 * Convert a buffer of raw 16-bit signed linear PCM to a buffer
877 * of 4-bit G726 packed two to a byte (Big Endian).
883 * Leftover inbuf data gets packed, tail gets updated.
886 static struct ast_frame *
887 lintog726_frameout (struct ast_translator_pvt *pvt)
889 struct g726_encoder_pvt *tmp = (struct g726_encoder_pvt *) pvt;
893 tmp->f.frametype = AST_FRAME_VOICE;
894 tmp->f.subclass = AST_FORMAT_G726;
895 tmp->f.samples = tmp->tail * 2;
897 tmp->f.offset = AST_FRIENDLY_OFFSET;
898 tmp->f.src = __PRETTY_FUNCTION__;
899 tmp->f.data = tmp->outbuf;
900 tmp->f.datalen = tmp->tail;
911 static struct ast_frame *
912 g726tolin_sample (void)
914 static struct ast_frame f;
915 f.frametype = AST_FRAME_VOICE;
916 f.subclass = AST_FORMAT_G726;
917 f.datalen = sizeof (g726_slin_ex);
918 f.samples = sizeof(g726_slin_ex) * 2;
921 f.src = __PRETTY_FUNCTION__;
922 f.data = g726_slin_ex;
930 static struct ast_frame *
931 lintog726_sample (void)
933 static struct ast_frame f;
934 f.frametype = AST_FRAME_VOICE;
935 f.subclass = AST_FORMAT_SLINEAR;
936 f.datalen = sizeof (slin_g726_ex);
938 f.samples = sizeof (slin_g726_ex) / 2;
941 f.src = __PRETTY_FUNCTION__;
942 f.data = slin_g726_ex;
948 * Destroys a private workspace.
958 g726_destroy (struct ast_translator_pvt *pvt)
962 ast_update_use_count ();
966 * The complete translator for G726ToLin.
969 static struct ast_translator g726tolin = {
982 * The complete translator for LinToG726.
985 static struct ast_translator lintog726 = {
1000 struct ast_config *cfg;
1001 struct ast_variable *var;
1002 if ((cfg = ast_config_load("codecs.conf"))) {
1003 if ((var = ast_variable_browse(cfg, "plc"))) {
1005 if (!strcasecmp(var->name, "genericplc")) {
1006 useplc = ast_true(var->value) ? 1 : 0;
1007 if (option_verbose > 2)
1008 ast_verbose(VERBOSE_PREFIX_3 "codec_g726: %susing generic PLC\n", useplc ? "" : "not ");
1024 unload_module (void)
1027 ast_mutex_lock (&localuser_lock);
1028 res = ast_unregister_translator (&lintog726);
1030 res = ast_unregister_translator (&g726tolin);
1033 ast_mutex_unlock (&localuser_lock);
1042 res = ast_register_translator (&g726tolin);
1044 res = ast_register_translator (&lintog726);
1046 ast_unregister_translator (&g726tolin);
1051 * Return a description of this module.
1064 STANDARD_USECOUNT (res);
1071 return ASTERISK_GPL_KEY;