1 /*____________________________________________________________________________
2 
3 	FreeAmp - The Free MP3 Player
4 
5         MP3 Decoder originally Copyright (C) 1996-1997 Xing Technology
6         Corp.  http://www.xingtech.com
7 
8 	Portions Copyright (C) 1998-1999 Emusic.com
9 
10 	This program is free software; you can redistribute it and/or modify
11 	it under the terms of the GNU General Public License as published by
12 	the Free Software Foundation; either version 2 of the License, or
13 	(at your option) any later version.
14 
15 	This program is distributed in the hope that it will be useful,
16 	but WITHOUT ANY WARRANTY; without even the implied warranty of
17 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 	GNU General Public License for more details.
19 
20 	You should have received a copy of the GNU General Public License
21 	along with this program; if not, write to the Free Software
22 	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 
24 	$Id: L3.h,v 1.7 1999/12/10 07:16:42 elrod Exp $
25 ____________________________________________________________________________*/
26 
27 /****  L3.h  ***************************************************
28 
29   Layer III structures
30 
31   *** Layer III is 32 bit only          ***
32   *** Layer III code assumes 32 bit int ***
33 
34 ******************************************************************/
35 #ifndef L3_H
36 #define L3_H
37 
38 #include "config.h"
39 
40 #include "qcommon/q_platform.h"
41 
42 #define GLOBAL_GAIN_SCALE (4*15)
43 /* #define GLOBAL_GAIN_SCALE 0 */
44 
45 /*-----------------------------------------------------------*/
46 /*---- huffman lookup tables ---*/
47 /* endian dependent !!! */
48 #ifdef Q3_LITTLE_ENDIAN
49 typedef union
50 {
51    int ptr;
52    struct
53    {
54       unsigned char signbits;
55       unsigned char x;
56       unsigned char y;
57       unsigned char purgebits;	// 0 = esc
58 
59    }
60    b;
61 }
62 HUFF_ELEMENT;
63 
64 #else /* big endian machines */
65 typedef union
66 {
67    int ptr;			/* int must be 32 bits or more */
68    struct
69    {
70       unsigned char purgebits;	// 0 = esc
71 
72       unsigned char y;
73       unsigned char x;
74       unsigned char signbits;
75    }
76    b;
77 }
78 HUFF_ELEMENT;
79 
80 #endif
81 /*--------------------------------------------------------------*/
82 typedef struct
83 {
84    unsigned int bitbuf;
85    int bits;
86    unsigned char *bs_ptr;
87    unsigned char *bs_ptr0;
88    unsigned char *bs_ptr_end;	// optional for overrun test
89 
90 }
91 BITDAT;
92 
93 /*-- side info ---*/
94 typedef struct
95 {
96    int part2_3_length;
97    int big_values;
98    int global_gain;
99    int scalefac_compress;
100    int window_switching_flag;
101    int block_type;
102    int mixed_block_flag;
103    int table_select[3];
104    int subblock_gain[3];
105    int region0_count;
106    int region1_count;
107    int preflag;
108    int scalefac_scale;
109    int count1table_select;
110 }
111 GR;
112 typedef struct
113 {
114    int mode;
115    int mode_ext;
116 /*---------------*/
117    int main_data_begin;		/* beginning, not end, my spec wrong */
118    int private_bits;
119 /*---------------*/
120    int scfsi[2];		/* 4 bit flags [ch] */
121    GR gr[2][2];			/* [gran][ch] */
122 }
123 SIDE_INFO;
124 
125 /*-----------------------------------------------------------*/
126 /*-- scale factors ---*/
127 // check dimensions - need 21 long, 3*12 short
128 // plus extra for implicit sf=0 above highest cb
129 typedef struct
130 {
131    int l[23];			/* [cb] */
132    int s[3][13];		/* [window][cb] */
133 }
134 SCALEFACT;
135 
136 /*-----------------------------------------------------------*/
137 typedef struct
138 {
139    int cbtype;			/* long=0 short=1 */
140    int cbmax;			/* max crit band */
141 //   int lb_type;			/* long block type 0 1 3 */
142    int cbs0;			/* short band start index 0 3 12 (12=no shorts */
143    int ncbl;			/* number long cb's 0 8 21 */
144    int cbmax_s[3];		/* cbmax by individual short blocks */
145 }
146 CB_INFO;
147 
148 /*-----------------------------------------------------------*/
149 /* scale factor infor for MPEG2 intensity stereo  */
150 typedef struct
151 {
152    int nr[3];
153    int slen[3];
154    int intensity_scale;
155 }
156 IS_SF_INFO;
157 
158 
159 #ifndef SAMPLE
160 #include "small_header.h"
161 #endif
162 
163 /*-----------------------------------------------------------*/
164 
165 #endif	// #ifndef L3_H
166 
167