Mercurial > SDL_sound_CoreAudio
annotate decoders/mpglib/mpg123_sdlsound.h @ 279:52b9f37998db
Removed global state variable; should be thread safe now.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 14 Mar 2002 16:38:59 +0000 |
parents | 9b6e82f7c853 |
children | 1e1724673420 |
rev | line source |
---|---|
261 | 1 #include <stdio.h> |
2 #include <string.h> | |
3 #include <signal.h> | |
4 | |
5 #ifndef WIN32 | |
6 #include <sys/signal.h> | |
7 #include <unistd.h> | |
8 #endif | |
9 | |
10 #include <math.h> | |
11 | |
12 #ifdef _WIN32 | |
13 # undef WIN32 | |
14 # define WIN32 | |
15 | |
16 # define M_PI 3.14159265358979323846 | |
17 # define M_SQRT2 1.41421356237309504880 | |
18 # define REAL_IS_FLOAT | |
19 # define NEW_DCT9 | |
20 | |
21 # define random rand | |
22 # define srandom srand | |
23 | |
24 #endif | |
25 | |
26 #ifdef REAL_IS_FLOAT | |
27 # define real float | |
28 #elif defined(REAL_IS_LONG_DOUBLE) | |
29 # define real long double | |
30 #else | |
31 # define real double | |
32 #endif | |
33 | |
34 #ifdef __GNUC__ | |
35 #define INLINE inline | |
36 #else | |
37 #define INLINE | |
38 #endif | |
39 | |
40 /* AUDIOBUFSIZE = n*64 with n=1,2,3 ... */ | |
41 #define AUDIOBUFSIZE 16384 | |
42 | |
43 #ifndef FALSE | |
44 #define FALSE 0 | |
45 #endif | |
46 #ifndef FALSE | |
47 #define TRUE 1 | |
48 #endif | |
49 | |
50 #define SBLIMIT 32 | |
51 #define SSLIMIT 18 | |
52 | |
53 #define SCALE_BLOCK 12 | |
54 | |
55 | |
56 #define MPG_MD_STEREO 0 | |
57 #define MPG_MD_JOINT_STEREO 1 | |
58 #define MPG_MD_DUAL_CHANNEL 2 | |
59 #define MPG_MD_MONO 3 | |
60 | |
61 #define MAXFRAMESIZE 1792 | |
62 | |
63 | |
64 /* Pre Shift fo 16 to 8 bit converter table */ | |
65 #define AUSHIFT (3) | |
66 | |
67 struct frame { | |
68 int stereo; | |
69 int jsbound; | |
70 int single; | |
71 int lsf; | |
72 int mpeg25; | |
73 int header_change; | |
74 int lay; | |
75 int error_protection; | |
76 int bitrate_index; | |
77 int sampling_frequency; | |
78 int padding; | |
79 int extension; | |
80 int mode; | |
81 int mode_ext; | |
82 int copyright; | |
83 int original; | |
84 int emphasis; | |
85 int framesize; /* computed framesize */ | |
86 | |
87 /* layer2 stuff */ | |
88 int II_sblimit; | |
89 void *alloc; | |
90 }; | |
91 | |
92 struct parameter { | |
93 int quiet; /* shut up! */ | |
94 int tryresync; /* resync stream after error */ | |
95 int verbose; /* verbose level */ | |
96 int checkrange; | |
97 }; | |
98 | |
279
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
99 struct mpstr; /* forward declaration. */ |
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
100 |
261 | 101 extern unsigned int get1bit(void); |
102 extern unsigned int getbits(int); | |
103 extern unsigned int getbits_fast(int); | |
279
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
104 extern int set_pointer(long,struct mpstr *); |
261 | 105 |
106 extern unsigned char *wordpointer; | |
107 extern int bitindex; | |
108 | |
109 extern void make_decode_tables(long scaleval); | |
279
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
110 extern int do_layer3(struct frame *fr,unsigned char *,int *,struct mpstr *); |
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
111 extern int do_layer2(struct frame *fr,unsigned char *,int *,struct mpstr *); |
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
112 extern int do_layer1(struct frame *fr,unsigned char *,int *,struct mpstr *); |
261 | 113 extern int decode_header(struct frame *fr,unsigned long newhead); |
114 | |
115 | |
116 | |
117 struct gr_info_s { | |
118 int scfsi; | |
119 unsigned part2_3_length; | |
120 unsigned big_values; | |
121 unsigned scalefac_compress; | |
122 unsigned block_type; | |
123 unsigned mixed_block_flag; | |
124 unsigned table_select[3]; | |
125 unsigned subblock_gain[3]; | |
126 unsigned maxband[3]; | |
127 unsigned maxbandl; | |
128 unsigned maxb; | |
129 unsigned region1start; | |
130 unsigned region2start; | |
131 unsigned preflag; | |
132 unsigned scalefac_scale; | |
133 unsigned count1table_select; | |
134 real *full_gain[3]; | |
135 real *pow2gain; | |
136 }; | |
137 | |
138 struct III_sideinfo | |
139 { | |
140 unsigned main_data_begin; | |
141 unsigned private_bits; | |
142 struct { | |
143 struct gr_info_s gr[2]; | |
144 } ch[2]; | |
145 }; | |
146 | |
279
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
147 |
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
148 extern int synth_1to1 (real *,int,unsigned char *,int *,struct mpstr *); |
261 | 149 extern int synth_1to1_8bit (real *,int,unsigned char *,int *); |
279
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
150 extern int synth_1to1_mono (real *,unsigned char *,int *,struct mpstr *); |
261 | 151 extern int synth_1to1_mono2stereo (real *,unsigned char *,int *); |
152 extern int synth_1to1_8bit_mono (real *,unsigned char *,int *); | |
153 extern int synth_1to1_8bit_mono2stereo (real *,unsigned char *,int *); | |
154 | |
155 extern int synth_2to1 (real *,int,unsigned char *,int *); | |
156 extern int synth_2to1_8bit (real *,int,unsigned char *,int *); | |
157 extern int synth_2to1_mono (real *,unsigned char *,int *); | |
158 extern int synth_2to1_mono2stereo (real *,unsigned char *,int *); | |
159 extern int synth_2to1_8bit_mono (real *,unsigned char *,int *); | |
160 extern int synth_2to1_8bit_mono2stereo (real *,unsigned char *,int *); | |
161 | |
162 extern int synth_4to1 (real *,int,unsigned char *,int *); | |
163 extern int synth_4to1_8bit (real *,int,unsigned char *,int *); | |
164 extern int synth_4to1_mono (real *,unsigned char *,int *); | |
165 extern int synth_4to1_mono2stereo (real *,unsigned char *,int *); | |
166 extern int synth_4to1_8bit_mono (real *,unsigned char *,int *); | |
167 extern int synth_4to1_8bit_mono2stereo (real *,unsigned char *,int *); | |
168 | |
169 extern int synth_ntom (real *,int,unsigned char *,int *); | |
170 extern int synth_ntom_8bit (real *,int,unsigned char *,int *); | |
171 extern int synth_ntom_mono (real *,unsigned char *,int *); | |
172 extern int synth_ntom_mono2stereo (real *,unsigned char *,int *); | |
173 extern int synth_ntom_8bit_mono (real *,unsigned char *,int *); | |
174 extern int synth_ntom_8bit_mono2stereo (real *,unsigned char *,int *); | |
175 | |
176 extern void rewindNbits(int bits); | |
177 extern int hsstell(void); | |
178 extern int get_songlen(struct frame *fr,int no); | |
179 | |
180 extern void init_layer3(int); | |
181 extern void init_layer2(void); | |
182 extern void make_decode_tables(long scale); | |
183 extern void make_conv16to8_table(int); | |
184 extern void dct64(real *,real *,real *); | |
185 | |
186 extern void synth_ntom_set_step(long,long); | |
187 | |
188 extern unsigned char *conv16to8; | |
189 extern long freqs[9]; | |
190 extern real muls[27][64]; | |
191 extern real decwin[512+32]; | |
192 extern real *pnts[5]; | |
193 | |
194 extern struct parameter param; | |
195 | |
196 |