Mercurial > mplayer.hg
annotate libmpcodecs/native/xa_gsm_int.h @ 21660:ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
author | nicodvb |
---|---|
date | Mon, 18 Dec 2006 21:03:59 +0000 |
parents | 3826d2cfa4b0 |
children | 58ff364dc851 |
rev | line source |
---|---|
1 | 1 /******************************************************************** |
2 * | |
3 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische | |
4 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for | |
5 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. | |
6 * | |
19264
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
7 * The contents of the file COPYRIGHT: |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
8 * |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
9 * Any use of this software is permitted provided that this notice is not |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
10 * removed and that neither the authors nor the Technische Universitaet Berlin |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
11 * are deemed to have made any representations as to the suitability of this |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
12 * software for any purpose nor are held responsible for any defects of |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
13 * this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
14 * |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
15 * As a matter of courtesy, the authors request to be informed about uses |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
16 * this software has found, about bugs in this software, and about any |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
17 * improvements that may be of general interest. |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
18 * |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
19 * Berlin, 15.09.1992 |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
20 * Jutta Degener |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
21 * Carsten Bormann |
3826d2cfa4b0
There is a reference to a file COPYRIGHT that we do not include, so paste
diego
parents:
5603
diff
changeset
|
22 * |
1 | 23 ********************************************************************/ |
24 | |
25 #include "xa_gsm.h" | |
26 | |
27 | |
28 typedef short word; /* 16 bit signed int */ | |
29 typedef int longword; /* 32 bit signed int */ | |
30 | |
31 typedef unsigned short uword; /* unsigned word */ | |
32 typedef unsigned int ulongword; /* unsigned longword */ | |
33 | |
34 typedef struct { | |
35 | |
36 word dp0[ 280 ]; | |
37 | |
38 word z1; /* preprocessing.c, Offset_com. */ | |
39 longword L_z2; /* Offset_com. */ | |
40 int mp; /* Preemphasis */ | |
41 | |
42 word u[8]; /* short_term_aly_filter.c */ | |
43 word LARpp[2][8]; /* */ | |
44 word j; /* */ | |
45 | |
46 word ltp_cut; /* long_term.c, LTP crosscorr. */ | |
47 word nrp; /* 40 */ /* long_term.c, synthesis */ | |
48 word v[9]; /* short_term.c, synthesis */ | |
49 word msr; /* decoder.c, Postprocessing */ | |
50 | |
51 char verbose; /* only used if !NDEBUG */ | |
52 char fast; /* only used if FAST */ | |
53 | |
54 char wav_fmt; /* only used if WAV49 defined */ | |
55 unsigned char frame_index; /* odd/even chaining */ | |
56 unsigned char frame_chain; /* half-byte to carry forward */ | |
57 } XA_GSM_STATE; | |
58 | |
59 | |
60 #define MIN_WORD (-32767 - 1) | |
61 #define MAX_WORD 32767 | |
62 | |
63 #define MIN_LONGWORD (-2147483647 - 1) | |
64 #define MAX_LONGWORD 2147483647 | |
65 | |
66 #ifdef SASR /* flag: >> is a signed arithmetic shift right */ | |
67 #undef SASR | |
68 #define SASR(x, by) ((x) >> (by)) | |
69 #else | |
70 #define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by)))) | |
71 #endif /* SASR */ | |
72 | |
73 | |
74 | |
75 /* | |
76 * Inlined functions from add.h | |
77 */ | |
78 | |
79 /* | |
80 * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \ | |
81 * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15)) | |
82 */ | |
83 #define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \ | |
84 (SASR( ((longword)(a) * (longword)(b) + 16384), 15 )) | |
85 | |
86 # define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \ | |
87 (SASR( ((longword)(a) * (longword)(b)), 15 )) | |
88 | |
89 # define GSM_L_MULT(a, b) /* word a, word b */ \ | |
90 (((longword)(a) * (longword)(b)) << 1) | |
91 | |
92 # define GSM_L_ADD(a, b) \ | |
93 ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \ | |
94 : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \ | |
95 >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \ | |
96 : ((b) <= 0 ? (a) + (b) \ | |
97 : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \ | |
98 ? MAX_LONGWORD : utmp)) | |
99 | |
100 /* | |
101 * # define GSM_ADD(a, b) \ | |
102 * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \ | |
103 * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) | |
104 */ | |
105 /* Nonportable, but faster: */ | |
106 | |
107 #define GSM_ADD(a, b) \ | |
108 ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \ | |
109 MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp) | |
110 | |
111 # define GSM_SUB(a, b) \ | |
112 ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \ | |
113 ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) | |
114 | |
115 # define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a)) | |
116 | |
117 /* Use these if necessary: | |
118 | |
119 # define GSM_MULT_R(a, b) gsm_mult_r(a, b) | |
120 # define GSM_MULT(a, b) gsm_mult(a, b) | |
121 # define GSM_L_MULT(a, b) gsm_L_mult(a, b) | |
122 | |
123 # define GSM_L_ADD(a, b) gsm_L_add(a, b) | |
124 # define GSM_ADD(a, b) gsm_add(a, b) | |
125 # define GSM_SUB(a, b) gsm_sub(a, b) | |
126 | |
127 # define GSM_ABS(a) gsm_abs(a) | |
128 | |
129 */ | |
130 |