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