2 * Copyright (c) Michael Hipp and other authors of the mpglib project.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include <sys/signal.h>
34 # define M_PI 3.14159265358979323846
35 # define M_SQRT2 1.41421356237309504880
36 # define REAL_IS_FLOAT
40 # define srandom srand
46 #elif defined(REAL_IS_LONG_DOUBLE)
47 # define real long double
58 /* AUDIOBUFSIZE = n*64 with n=1,2,3 ... */
59 #define AUDIOBUFSIZE 16384
71 #define SCALE_BLOCK 12
74 #define MPG_MD_STEREO 0
75 #define MPG_MD_JOINT_STEREO 1
76 #define MPG_MD_DUAL_CHANNEL 2
79 #define MAXFRAMESIZE 1792
82 /* Pre Shift fo 16 to 8 bit converter table */
95 int sampling_frequency;
103 int framesize; /* computed framesize */
107 const struct al_table *alloc;
111 int quiet; /* shut up! */
112 int tryresync; /* resync stream after error */
113 int verbose; /* verbose level */
117 extern unsigned int get1bit(void);
118 extern unsigned int getbits(int);
119 extern unsigned int getbits_fast(int);
120 extern int set_pointer(long);
122 extern unsigned char *wordpointer;
125 extern void make_decode_tables(long scaleval);
126 extern int do_layer3(struct frame *fr,unsigned char *,int *);
127 extern int do_layer2(struct frame *fr,unsigned char *,int *);
128 extern int do_layer1(struct frame *fr,unsigned char *,int *);
129 extern int decode_header(struct frame *fr,unsigned long newhead);
135 unsigned part2_3_length;
137 unsigned scalefac_compress;
139 unsigned mixed_block_flag;
140 unsigned table_select[3];
141 unsigned subblock_gain[3];
145 unsigned region1start;
146 unsigned region2start;
148 unsigned scalefac_scale;
149 unsigned count1table_select;
156 unsigned main_data_begin;
157 unsigned private_bits;
159 struct gr_info_s gr[2];
163 extern int synth_1to1 (real *,int,unsigned char *,int *);
164 extern int synth_1to1_8bit (real *,int,unsigned char *,int *);
165 extern int synth_1to1_mono (real *,unsigned char *,int *);
166 extern int synth_1to1_mono2stereo (real *,unsigned char *,int *);
167 extern int synth_1to1_8bit_mono (real *,unsigned char *,int *);
168 extern int synth_1to1_8bit_mono2stereo (real *,unsigned char *,int *);
170 extern int synth_2to1 (real *,int,unsigned char *,int *);
171 extern int synth_2to1_8bit (real *,int,unsigned char *,int *);
172 extern int synth_2to1_mono (real *,unsigned char *,int *);
173 extern int synth_2to1_mono2stereo (real *,unsigned char *,int *);
174 extern int synth_2to1_8bit_mono (real *,unsigned char *,int *);
175 extern int synth_2to1_8bit_mono2stereo (real *,unsigned char *,int *);
177 extern int synth_4to1 (real *,int,unsigned char *,int *);
178 extern int synth_4to1_8bit (real *,int,unsigned char *,int *);
179 extern int synth_4to1_mono (real *,unsigned char *,int *);
180 extern int synth_4to1_mono2stereo (real *,unsigned char *,int *);
181 extern int synth_4to1_8bit_mono (real *,unsigned char *,int *);
182 extern int synth_4to1_8bit_mono2stereo (real *,unsigned char *,int *);
184 extern int synth_ntom (real *,int,unsigned char *,int *);
185 extern int synth_ntom_8bit (real *,int,unsigned char *,int *);
186 extern int synth_ntom_mono (real *,unsigned char *,int *);
187 extern int synth_ntom_mono2stereo (real *,unsigned char *,int *);
188 extern int synth_ntom_8bit_mono (real *,unsigned char *,int *);
189 extern int synth_ntom_8bit_mono2stereo (real *,unsigned char *,int *);
191 extern void rewindNbits(int bits);
192 extern int hsstell(void);
193 extern int get_songlen(struct frame *fr,int no);
195 extern void init_layer3(int);
196 extern void init_layer2(void);
197 extern void make_decode_tables(long scale);
198 extern void make_conv16to8_table(int);
199 extern void dct64(real *,real *,real *);
201 extern void synth_ntom_set_step(long,long);
203 extern unsigned char *conv16to8;
204 extern const long freqs[9];
205 extern real muls[27][64];
206 extern real decwin[512+32];
207 extern real *pnts[5];
209 extern const struct parameter param;