Mercurial > SDL_sound_CoreAudio
annotate decoders/mpglib/mpg123_sdlsound.h @ 487:78176684050d
Updated.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 27 Feb 2005 19:56:24 +0000 |
parents | c66080364dff |
children |
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 | |
401
c42ac9ee2ce4
Fixed "inline" keyword to compile.
Ryan C. Gordon <icculus@icculus.org>
parents:
377
diff
changeset
|
37 #elif ((defined _MSC_VER) || (defined __inline__)) |
299
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; | |
474
c66080364dff
Most decoders now report total sample play time, now. Technically, this
Ryan C. Gordon <icculus@icculus.org>
parents:
401
diff
changeset
|
93 |
c66080364dff
Most decoders now report total sample play time, now. Technically, this
Ryan C. Gordon <icculus@icculus.org>
parents:
401
diff
changeset
|
94 int bitrate; |
261 | 95 }; |
96 | |
97 struct parameter { | |
98 int quiet; /* shut up! */ | |
99 int tryresync; /* resync stream after error */ | |
100 int verbose; /* verbose level */ | |
101 int checkrange; | |
102 }; | |
103 | |
279
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
104 struct mpstr; /* forward declaration. */ |
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
105 |
261 | 106 extern unsigned int get1bit(void); |
107 extern unsigned int getbits(int); | |
108 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
|
109 extern int set_pointer(long,struct mpstr *); |
261 | 110 |
111 extern unsigned char *wordpointer; | |
112 extern int bitindex; | |
113 | |
114 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
|
115 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
|
116 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
|
117 extern int do_layer1(struct frame *fr,unsigned char *,int *,struct mpstr *); |
261 | 118 extern int decode_header(struct frame *fr,unsigned long newhead); |
119 | |
120 | |
121 | |
122 struct gr_info_s { | |
123 int scfsi; | |
124 unsigned part2_3_length; | |
125 unsigned big_values; | |
126 unsigned scalefac_compress; | |
127 unsigned block_type; | |
128 unsigned mixed_block_flag; | |
129 unsigned table_select[3]; | |
130 unsigned subblock_gain[3]; | |
131 unsigned maxband[3]; | |
132 unsigned maxbandl; | |
133 unsigned maxb; | |
134 unsigned region1start; | |
135 unsigned region2start; | |
136 unsigned preflag; | |
137 unsigned scalefac_scale; | |
138 unsigned count1table_select; | |
139 real *full_gain[3]; | |
140 real *pow2gain; | |
141 }; | |
142 | |
143 struct III_sideinfo | |
144 { | |
145 unsigned main_data_begin; | |
146 unsigned private_bits; | |
147 struct { | |
148 struct gr_info_s gr[2]; | |
149 } ch[2]; | |
150 }; | |
151 | |
279
52b9f37998db
Removed global state variable; should be thread safe now.
Ryan C. Gordon <icculus@icculus.org>
parents:
261
diff
changeset
|
152 |
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 (real *,int,unsigned char *,int *,struct mpstr *); |
261 | 154 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
|
155 extern int synth_1to1_mono (real *,unsigned char *,int *,struct mpstr *); |
261 | 156 extern int synth_1to1_mono2stereo (real *,unsigned char *,int *); |
157 extern int synth_1to1_8bit_mono (real *,unsigned char *,int *); | |
158 extern int synth_1to1_8bit_mono2stereo (real *,unsigned char *,int *); | |
159 | |
160 extern int synth_2to1 (real *,int,unsigned char *,int *); | |
161 extern int synth_2to1_8bit (real *,int,unsigned char *,int *); | |
162 extern int synth_2to1_mono (real *,unsigned char *,int *); | |
163 extern int synth_2to1_mono2stereo (real *,unsigned char *,int *); | |
164 extern int synth_2to1_8bit_mono (real *,unsigned char *,int *); | |
165 extern int synth_2to1_8bit_mono2stereo (real *,unsigned char *,int *); | |
166 | |
167 extern int synth_4to1 (real *,int,unsigned char *,int *); | |
168 extern int synth_4to1_8bit (real *,int,unsigned char *,int *); | |
169 extern int synth_4to1_mono (real *,unsigned char *,int *); | |
170 extern int synth_4to1_mono2stereo (real *,unsigned char *,int *); | |
171 extern int synth_4to1_8bit_mono (real *,unsigned char *,int *); | |
172 extern int synth_4to1_8bit_mono2stereo (real *,unsigned char *,int *); | |
173 | |
174 extern int synth_ntom (real *,int,unsigned char *,int *); | |
175 extern int synth_ntom_8bit (real *,int,unsigned char *,int *); | |
176 extern int synth_ntom_mono (real *,unsigned char *,int *); | |
177 extern int synth_ntom_mono2stereo (real *,unsigned char *,int *); | |
178 extern int synth_ntom_8bit_mono (real *,unsigned char *,int *); | |
179 extern int synth_ntom_8bit_mono2stereo (real *,unsigned char *,int *); | |
180 | |
181 extern void rewindNbits(int bits); | |
182 extern int hsstell(void); | |
183 extern int get_songlen(struct frame *fr,int no); | |
184 | |
185 extern void init_layer3(int); | |
186 extern void init_layer2(void); | |
187 extern void make_decode_tables(long scale); | |
188 extern void make_conv16to8_table(int); | |
189 extern void dct64(real *,real *,real *); | |
190 | |
191 extern void synth_ntom_set_step(long,long); | |
192 | |
193 extern unsigned char *conv16to8; | |
292
a9e211c3faa4
Cleanups and audio format determination.
Ryan C. Gordon <icculus@icculus.org>
parents:
290
diff
changeset
|
194 extern long mpglib_freqs[9]; |
261 | 195 extern real muls[27][64]; |
196 extern real decwin[512+32]; | |
197 extern real *pnts[5]; | |
198 | |
199 extern struct parameter param; | |
200 | |
201 |