~ubuntu-branches/ubuntu/karmic/asterisk/karmic

« back to all changes in this revision

Viewing changes to codecs/mp3/include/L3.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2002-04-27 21:19:32 UTC
  • Revision ID: james.westby@ubuntu.com-20020427211932-kqaertc4bg7ss5mc
Tags: upstream-0.1.11
ImportĀ upstreamĀ versionĀ 0.1.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.1 1999/12/07 05:46:01 markster 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
 
 
36
#define GLOBAL_GAIN_SCALE (4*15)
 
37
/* #define GLOBAL_GAIN_SCALE 0 */
 
38
 
 
39
 
 
40
#ifdef _M_IX86
 
41
#define LITTLE_ENDIAN 1
 
42
#endif
 
43
 
 
44
#ifdef _M_ALPHA
 
45
#define LITTLE_ENDIAN 1
 
46
#endif
 
47
 
 
48
#ifdef sparc
 
49
#define LITTLE_ENDIAN 0
 
50
#endif
 
51
 
 
52
#ifndef LITTLE_ENDIAN
 
53
#error Layer III LITTLE_ENDIAN must be defined 0 or 1
 
54
#endif
 
55
 
 
56
/*-----------------------------------------------------------*/
 
57
/*---- huffman lookup tables ---*/
 
58
/* endian dependent !!! */
 
59
#if LITTLE_ENDIAN
 
60
typedef union
 
61
{
 
62
   int ptr;
 
63
   struct
 
64
   {
 
65
      unsigned char signbits;
 
66
      unsigned char x;
 
67
      unsigned char y;
 
68
      unsigned char purgebits;  // 0 = esc
 
69
 
 
70
   }
 
71
   b;
 
72
}
 
73
HUFF_ELEMENT;
 
74
 
 
75
#else /* big endian machines */
 
76
typedef union
 
77
{
 
78
   int ptr;                     /* int must be 32 bits or more */
 
79
   struct
 
80
   {
 
81
      unsigned char purgebits;  // 0 = esc
 
82
 
 
83
      unsigned char y;
 
84
      unsigned char x;
 
85
      unsigned char signbits;
 
86
   }
 
87
   b;
 
88
}
 
89
HUFF_ELEMENT;
 
90
 
 
91
#endif
 
92
/*--------------------------------------------------------------*/
 
93
typedef struct
 
94
{
 
95
   unsigned int bitbuf;
 
96
   int bits;
 
97
   unsigned char *bs_ptr;
 
98
   unsigned char *bs_ptr0;
 
99
   unsigned char *bs_ptr_end;   // optional for overrun test
 
100
 
 
101
}
 
102
BITDAT;
 
103
 
 
104
/*-- side info ---*/
 
105
typedef struct
 
106
{
 
107
   int part2_3_length;
 
108
   int big_values;
 
109
   int global_gain;
 
110
   int scalefac_compress;
 
111
   int window_switching_flag;
 
112
   int block_type;
 
113
   int mixed_block_flag;
 
114
   int table_select[3];
 
115
   int subblock_gain[3];
 
116
   int region0_count;
 
117
   int region1_count;
 
118
   int preflag;
 
119
   int scalefac_scale;
 
120
   int count1table_select;
 
121
}
 
122
GR;
 
123
typedef struct
 
124
{
 
125
   int mode;
 
126
   int mode_ext;
 
127
/*---------------*/
 
128
   int main_data_begin;         /* beginning, not end, my spec wrong */
 
129
   int private_bits;
 
130
/*---------------*/
 
131
   int scfsi[2];                /* 4 bit flags [ch] */
 
132
   GR gr[2][2];                 /* [gran][ch] */
 
133
}
 
134
SIDE_INFO;
 
135
 
 
136
/*-----------------------------------------------------------*/
 
137
/*-- scale factors ---*/
 
138
// check dimensions - need 21 long, 3*12 short
 
139
// plus extra for implicit sf=0 above highest cb
 
140
typedef struct
 
141
{
 
142
   int l[23];                   /* [cb] */
 
143
   int s[3][13];                /* [window][cb] */
 
144
}
 
145
SCALEFACT;
 
146
 
 
147
/*-----------------------------------------------------------*/
 
148
typedef struct
 
149
{
 
150
   int cbtype;                  /* long=0 short=1 */
 
151
   int cbmax;                   /* max crit band */
 
152
//   int lb_type;                       /* long block type 0 1 3 */
 
153
   int cbs0;                    /* short band start index 0 3 12 (12=no shorts */
 
154
   int ncbl;                    /* number long cb's 0 8 21 */
 
155
   int cbmax_s[3];              /* cbmax by individual short blocks */
 
156
}
 
157
CB_INFO;
 
158
 
 
159
/*-----------------------------------------------------------*/
 
160
/* scale factor infor for MPEG2 intensity stereo  */
 
161
typedef struct
 
162
{
 
163
   int nr[3];
 
164
   int slen[3];
 
165
   int intensity_scale;
 
166
}
 
167
IS_SF_INFO;
 
168
 
 
169
/*-----------------------------------------------------------*/
 
170
typedef union
 
171
{
 
172
   int s;
 
173
   float x;
 
174
}
 
175
SAMPLE;
 
176
 
 
177
/*-----------------------------------------------------------*/