annotate xa/xa_gsm_int.h @ 701:14c720e7b85c

Fixed bug of mplayer freezing - better
author arpi_esp
date Sat, 05 May 2001 15:44:07 +0000
parents 3b5f5d1c5041
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /********************************************************************
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 ********************************************************************/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 #include "xa_gsm.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 typedef short word; /* 16 bit signed int */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 typedef int longword; /* 32 bit signed int */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 typedef unsigned short uword; /* unsigned word */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 typedef unsigned int ulongword; /* unsigned longword */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 typedef struct {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 word dp0[ 280 ];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 word z1; /* preprocessing.c, Offset_com. */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 longword L_z2; /* Offset_com. */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 int mp; /* Preemphasis */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 word u[8]; /* short_term_aly_filter.c */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 word LARpp[2][8]; /* */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 word j; /* */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 word ltp_cut; /* long_term.c, LTP crosscorr. */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 word nrp; /* 40 */ /* long_term.c, synthesis */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 word v[9]; /* short_term.c, synthesis */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 word msr; /* decoder.c, Postprocessing */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 char verbose; /* only used if !NDEBUG */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 char fast; /* only used if FAST */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 char wav_fmt; /* only used if WAV49 defined */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 unsigned char frame_index; /* odd/even chaining */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 unsigned char frame_chain; /* half-byte to carry forward */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 } XA_GSM_STATE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 #define MIN_WORD (-32767 - 1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 #define MAX_WORD 32767
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 #define MIN_LONGWORD (-2147483647 - 1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 #define MAX_LONGWORD 2147483647
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 #ifdef SASR /* flag: >> is a signed arithmetic shift right */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 #undef SASR
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 #define SASR(x, by) ((x) >> (by))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 #define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by))))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 #endif /* SASR */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 * Inlined functions from add.h
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 #define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 (SASR( ((longword)(a) * (longword)(b) + 16384), 15 ))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 # define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 (SASR( ((longword)(a) * (longword)(b)), 15 ))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 # define GSM_L_MULT(a, b) /* word a, word b */ \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 (((longword)(a) * (longword)(b)) << 1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 # define GSM_L_ADD(a, b) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 : ((b) <= 0 ? (a) + (b) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 ? MAX_LONGWORD : utmp))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 * # define GSM_ADD(a, b) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 /* Nonportable, but faster: */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 #define GSM_ADD(a, b) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 # define GSM_SUB(a, b) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 # define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 /* Use these if necessary:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 # define GSM_MULT_R(a, b) gsm_mult_r(a, b)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 # define GSM_MULT(a, b) gsm_mult(a, b)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 # define GSM_L_MULT(a, b) gsm_L_mult(a, b)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 # define GSM_L_ADD(a, b) gsm_L_add(a, b)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 # define GSM_ADD(a, b) gsm_add(a, b)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 # define GSM_SUB(a, b) gsm_sub(a, b)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 # define GSM_ABS(a) gsm_abs(a)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114