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