2
|
1 /*
|
|
2 ============================================================================
|
|
3 File: G726.H 28-Feb-1991 (18:00:00)
|
|
4 ============================================================================
|
|
5
|
|
6 UGST/ITU-T G726 MODULE
|
|
7
|
|
8 GLOBAL FUNCTION PROTOTYPES
|
|
9
|
|
10 History:
|
|
11 28.Feb.92 v1.0 First version <simao@cpqd.br>
|
|
12 06.May.94 v2.0 Smart prototypes that work with many compilers <simao>
|
|
13 ============================================================================
|
|
14 */
|
|
15 #ifndef G726_defined
|
|
16 #define G726_defined 200
|
|
17
|
|
18 /* Smart function prototypes: for [ag]cc, VaxC, and [tb]cc */
|
|
19 #if !defined(ARGS)
|
|
20 #if (defined(__STDC__) || defined(VMS) || defined(__DECC) || defined(MSDOS) || defined(__MSDOS__)) || defined (__CYGWIN__) || defined (_MSC_VER)
|
|
21 #define ARGS(s) s
|
|
22 #else
|
|
23 #define ARGS(s) ()
|
|
24 #endif
|
|
25 #endif
|
|
26
|
|
27
|
|
28 /* State for G726 encoder and decoder */
|
|
29 typedef struct {
|
|
30 short sr0, sr1; /* Reconstructed signal with delays 0 and 1 */
|
|
31 short a1r, a2r; /* Triggered 2nd order predictor coeffs. */
|
|
32 short b1r; /* Triggered 6nd order predictor coeffs */
|
|
33 short b2r;
|
|
34 short b3r;
|
|
35 short b4r;
|
|
36 short b5r;
|
|
37 short b6r;
|
|
38 short dq5; /* Quantized difference signal with delays 5
|
|
39 * to 0 */
|
|
40 short dq4;
|
|
41 short dq3;
|
|
42 short dq2;
|
|
43 short dq1;
|
|
44 short dq0;
|
|
45 short dmsp; /* Short term average of the F(I) sequence */
|
|
46 short dmlp; /* Long term average of the F(I) sequence */
|
|
47 short apr; /* Triggered unlimited speed control
|
|
48 * parameter */
|
|
49 short yup; /* Fast quantizer scale factor */
|
|
50 short tdr; /* Triggered tone detector */
|
|
51 short pk0, pk1; /* sign of dq+sez with delays 0 and 1 */
|
|
52 long ylp; /* Slow quantizer scale factor */
|
|
53 } G726_state;
|
|
54
|
|
55 #ifdef VAXC
|
|
56 # define SHORT short
|
|
57 #else
|
|
58 # define SHORT int
|
|
59 #endif
|
|
60
|
|
61 /* Function prototypes */
|
|
62 void G726_encode ARGS((unsigned char *inp_buf, short *out_buf, long smpno,
|
|
63 char *law, SHORT rate, SHORT r, G726_state * state));
|
|
64 void G726_decode ARGS((short *inp_buf, unsigned char *out_buf, long smpno,
|
|
65 char *law, SHORT rate, SHORT r, G726_state * state));
|
|
66 void G726_expand ARGS((short *s, char *law, short *sl));
|
|
67 void G726_subta ARGS((short *sl, short *se, short *d));
|
|
68 void G726_log ARGS((short *d, short *dl, short *ds));
|
|
69 void G726_quan ARGS((SHORT rate, short *dln, short *ds, short *i));
|
|
70 void G726_subtb ARGS((short *dl, short *y, short *dln));
|
|
71 void G726_adda ARGS((short *dqln, short *y, short *dql));
|
|
72 void G726_antilog ARGS((short *dql, short *dqs, short *dq));
|
|
73 void G726_reconst ARGS((SHORT rate, short *i, short *dqln, short *dqs));
|
|
74 void G726_delaya ARGS((short *r, short *x, short *y));
|
|
75 void G726_delayb ARGS((short *r, short *x, short *y));
|
|
76 void G726_delayc ARGS((short *r, long *x, long *y));
|
|
77 void G726_delayd ARGS((short *r, short *x, short *y));
|
|
78 void G726_filtd ARGS((short *wi, short *y, short *yut));
|
|
79 void G726_filte ARGS((short *yup, long *yl, long *ylp));
|
|
80 void G726_functw ARGS((SHORT rate, short *i, short *wi));
|
|
81 void G726_limb ARGS((short *yut, short *yup));
|
|
82 void G726_mix ARGS((short *al, short *yu, long *yl, short *y));
|
|
83 void G726_filta ARGS((short *fi, short *dms, short *dmsp));
|
|
84 void G726_filtb ARGS((short *fi, short *dml, short *dmlp));
|
|
85 void G726_filtc ARGS((short *ax, short *ap, short *app));
|
|
86 void G726_functf ARGS((SHORT rate, short *i, short *fi));
|
|
87 void G726_lima ARGS((short *ap, short *al));
|
|
88 void G726_subtc ARGS((short *dmsp, short *dmlp, short *tdp, short *y,
|
|
89 short *ax));
|
|
90 void G726_triga ARGS((short *tr, short *app, short *apr));
|
|
91 void G726_accum ARGS((short *wa1, short *wa2, short *wb1, short *wb2,
|
|
92 short *wb3, short *wb4, short *wb5, short *wb6, short *se,
|
|
93 short *sez));
|
|
94 void G726_addb ARGS((short *dq, short *se, short *sr));
|
|
95 void G726_addc ARGS((short *dq, short *sez, short *pk0, short *sigpk));
|
|
96 void G726_floata ARGS((short *dq, short *dq0));
|
|
97 void G726_floatb ARGS((short *sr, short *sr0));
|
|
98 void G726_fmult ARGS((short *An, short *SRn, short *WAn));
|
|
99 void G726_limc ARGS((short *a2t, short *a2p));
|
|
100 void G726_limd ARGS((short *a1t, short *a2p, short *a1p));
|
|
101 void G726_trigb ARGS((short *tr, short *ap, short *ar));
|
|
102 void G726_upa1 ARGS((short *pk0, short *pk1, short *a1, short *sigpk,
|
|
103 short *a1t));
|
|
104 void G726_upa2 ARGS((short *pk0, short *pk1, short *pk2, short *a2,
|
|
105 short *a1, short *sigpk, short *a2t));
|
|
106 void G726_upb ARGS((SHORT rate, short *u, short *b, short *dq,
|
|
107 short *bp));
|
|
108 void G726_xor ARGS((short *dqn, short *dq, short *u));
|
|
109 void G726_tone ARGS((short *a2p, short *tdp));
|
|
110 void G726_trans ARGS((short *td, long *yl, short *dq, short *tr));
|
|
111 void G726_compress ARGS((short *sr, char *law, short *sp));
|
|
112 void G726_sync ARGS((SHORT rate, short *i, short *sp, short *dlnx,
|
|
113 short *dsx, char *law, short *sd));
|
|
114
|
|
115 /* Definitions for better user interface (?!) */
|
|
116 #ifndef IS_LOG
|
|
117 # define IS_LOG 0
|
|
118 #endif
|
|
119
|
|
120 #ifndef IS_LIN
|
|
121 # define IS_LIN 1
|
|
122 #endif
|
|
123
|
|
124 #ifndef IS_ADPCM
|
|
125 # define IS_ADPCM 2
|
|
126 #endif
|
|
127
|
|
128 #endif
|
|
129 /* .......................... End of G726.H ........................... */
|