1 /* This source code is a product of Sun Microsystems, Inc. and is provided
2 * for unrestricted use. Users may copy or modify this source code without
5 * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
6 * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
7 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
9 * Sun source code is provided with no support and without any obligation on
10 * the part of Sun Microsystems, Inc. to assist in its use, correction,
11 * modification or enhancement.
13 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
14 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
15 * OR ANY PART THEREOF.
17 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
18 * or profits or other special, indirect and consequential damages, even if
19 * Sun has been advised of the possibility of such damages.
21 * Sun Microsystems, Inc.
23 * Mountain View, California 94043
29 * Header file for CCITT conversion routines.
36 #define g721_decoder lsx_g721_decoder
37 #define g721_encoder lsx_g721_encoder
38 #define g723_24_decoder lsx_g723_24_decoder
39 #define g723_24_encoder lsx_g723_24_encoder
40 #define g723_40_decoder lsx_g723_40_decoder
41 #define g723_40_encoder lsx_g723_40_encoder
42 #define g72x_init_state lsx_g72x_init_state
43 #define predictor_pole lsx_g72x_predictor_pole
44 #define predictor_zero lsx_g72x_predictor_zero
45 #define quantize lsx_g72x_quantize
46 #define reconstruct lsx_g72x_reconstruct
47 #define step_size lsx_g72x_step_size
48 #define tandem_adjust_alaw lsx_g72x_tandem_adjust_alaw
49 #define tandem_adjust_ulaw lsx_g72x_tandem_adjust_ulaw
50 #define update lsx_g72x_update
52 #define AUDIO_ENCODING_ULAW (1) /* ISDN u-law */
53 #define AUDIO_ENCODING_ALAW (2) /* ISDN A-law */
54 #define AUDIO_ENCODING_LINEAR (3) /* PCM 2's-complement (0-center) */
57 * The following is the definition of the state structure
58 * used by the G.721/G.723 encoder and decoder to preserve their internal
59 * state between successive calls. The meanings of the majority
60 * of the state structure fields are explained in detail in the
61 * CCITT Recommendation G.721. The field names are essentially indentical
62 * to variable names in the bit level description of the coding algorithm
63 * included in this Recommendation.
66 long yl
; /* Locked or steady state step size multiplier. */
67 short yu
; /* Unlocked or non-steady state step size multiplier. */
68 short dms
; /* Short term energy estimate. */
69 short dml
; /* Long term energy estimate. */
70 short ap
; /* Linear weighting coefficient of 'yl' and 'yu'. */
72 short a
[2]; /* Coefficients of pole portion of prediction filter. */
73 short b
[6]; /* Coefficients of zero portion of prediction filter. */
75 * Signs of previous two samples of a partially
76 * reconstructed signal.
79 * Previous 6 samples of the quantized difference
80 * signal represented in an internal floating point
84 * Previous 2 samples of the quantized difference
85 * signal represented in an internal floating point
88 char td
; /* delayed tone detect, new in 1988 version */
91 /* External function definitions. */
93 extern void g72x_init_state(struct g72x_state
*);
94 extern int g721_encoder(
97 struct g72x_state
*state_ptr
);
98 extern int g721_decoder(
101 struct g72x_state
*state_ptr
);
102 extern int g723_16_encoder(
105 struct g72x_state
*state_ptr
);
106 extern int g723_16_decoder(
109 struct g72x_state
*state_ptr
);
110 extern int g723_24_encoder(
113 struct g72x_state
*state_ptr
);
114 extern int g723_24_decoder(
117 struct g72x_state
*state_ptr
);
118 extern int g723_40_encoder(
121 struct g72x_state
*state_ptr
);
122 extern int g723_40_decoder(
125 struct g72x_state
*state_ptr
);
127 int predictor_zero(struct g72x_state
*state_ptr
);
128 int predictor_pole(struct g72x_state
*state_ptr
);
129 int step_size(struct g72x_state
*state_ptr
);
134 int reconstruct(int sign
,
137 void update(int code_size
,
144 struct g72x_state
*state_ptr
);
145 int tandem_adjust_alaw(int sr
,
151 int tandem_adjust_ulaw(int sr
,
157 #endif /* !_G72X_H */