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
42 #elif defined(REAL_IS_LONG_DOUBLE)
43 # define real long double
64 #define SCALE_BLOCK 12
67 #define MPG_MD_STEREO 0
68 #define MPG_MD_JOINT_STEREO 1
69 #define MPG_MD_DUAL_CHANNEL 2
72 #define MAXFRAMESIZE 1792
85 int sampling_frequency;
93 int framesize; /* computed framesize */
97 const struct al_table *alloc;
103 int quiet; /* shut up! */
104 int tryresync; /* resync stream after error */
105 int verbose; /* verbose level */
109 extern unsigned int get1bit(void);
110 extern unsigned int getbits(int);
111 extern unsigned int getbits_fast(int);
112 extern int set_pointer(struct mpstr *,long);
114 extern unsigned char *wordpointer;
117 extern void make_decode_tables(long scaleval);
118 extern int do_layer3(struct frame *fr,unsigned char *,int *);
119 extern int do_layer2(struct frame *fr,unsigned char *,int *);
120 extern int do_layer1(struct frame *fr,unsigned char *,int *);
121 extern int decode_header(struct frame *fr,unsigned long newhead);
127 unsigned part2_3_length;
129 unsigned scalefac_compress;
131 unsigned mixed_block_flag;
132 unsigned table_select[3];
133 unsigned subblock_gain[3];
137 unsigned region1start;
138 unsigned region2start;
140 unsigned scalefac_scale;
141 unsigned count1table_select;
148 unsigned main_data_begin;
149 unsigned private_bits;
151 struct gr_info_s gr[2];
155 extern int synth_1to1 (struct mpstr *,real *,int,unsigned char *,int *);
156 extern int synth_1to1_mono (struct mpstr *,real *,unsigned char *,int *);
158 extern void init_layer3(int);
159 extern void init_layer2(void);
160 extern void make_decode_tables(long scale);
161 extern void dct64(real *,real *,real *);
163 extern unsigned char *conv16to8;
164 extern const long freqs[9];
165 extern real muls[27][64];
166 extern real decwin[512+32];
167 extern real *pnts[5];
169 extern const struct parameter param;