Diffstat (limited to 'core/multimedia/opieplayer/libmpeg3/audio/ac3.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmpeg3/audio/ac3.h | 308 |
1 files changed, 308 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/libmpeg3/audio/ac3.h b/core/multimedia/opieplayer/libmpeg3/audio/ac3.h new file mode 100644 index 0000000..9161c36 --- a/dev/null +++ b/core/multimedia/opieplayer/libmpeg3/audio/ac3.h | |||
@@ -0,0 +1,308 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef AC3_H | ||
21 | #define AC3_H | ||
22 | |||
23 | #include "mpeg3real.h" | ||
24 | |||
25 | #define MAX_AC3_FRAMESIZE 1920 * 2 + 512 | ||
26 | |||
27 | extern int mpeg3_ac3_samplerates[3]; | ||
28 | |||
29 | /* Exponent strategy constants */ | ||
30 | #define MPEG3_EXP_REUSE (0) | ||
31 | #define MPEG3_EXP_D15 (1) | ||
32 | #define MPEG3_EXP_D25 (2) | ||
33 | #define MPEG3_EXP_D45 (3) | ||
34 | |||
35 | /* Delta bit allocation constants */ | ||
36 | #define DELTA_BIT_REUSE (0) | ||
37 | #define DELTA_BIT_NEW (1) | ||
38 | #define DELTA_BIT_NONE (2) | ||
39 | #define DELTA_BIT_RESERVED (3) | ||
40 | |||
41 | |||
42 | typedef mpeg3_real_t mpeg3ac3_stream_samples_t[6][256]; | ||
43 | |||
44 | typedef struct | ||
45 | { | ||
46 | /* Bit stream identification == 0x8 */ | ||
47 | int bsid; | ||
48 | /* Bit stream mode */ | ||
49 | int bsmod; | ||
50 | /* Audio coding mode */ | ||
51 | int acmod; | ||
52 | /* If we're using the centre channel then */ | ||
53 | /* centre mix level */ | ||
54 | int cmixlev; | ||
55 | /* If we're using the surround channel then */ | ||
56 | /* surround mix level */ | ||
57 | int surmixlev; | ||
58 | /* If we're in 2/0 mode then */ | ||
59 | /* Dolby surround mix level - NOT USED - */ | ||
60 | int dsurmod; | ||
61 | /* Low frequency effects on */ | ||
62 | int lfeon; | ||
63 | /* Dialogue Normalization level */ | ||
64 | int dialnorm; | ||
65 | /* Compression exists */ | ||
66 | int compre; | ||
67 | /* Compression level */ | ||
68 | int compr; | ||
69 | /* Language code exists */ | ||
70 | int langcode; | ||
71 | /* Language code */ | ||
72 | int langcod; | ||
73 | /* Audio production info exists*/ | ||
74 | unsigned int audprodie; | ||
75 | int mixlevel; | ||
76 | int roomtyp; | ||
77 | /* If we're in dual mono mode (acmod == 0) then extra stuff */ | ||
78 | int dialnorm2; | ||
79 | int compr2e; | ||
80 | int compr2; | ||
81 | int langcod2e; | ||
82 | int langcod2; | ||
83 | int audprodi2e; | ||
84 | int mixlevel2; | ||
85 | int roomtyp2; | ||
86 | /* Copyright bit */ | ||
87 | int copyrightb; | ||
88 | /* Original bit */ | ||
89 | int origbs; | ||
90 | /* Timecode 1 exists */ | ||
91 | int timecod1e; | ||
92 | /* Timecode 1 */ | ||
93 | unsigned int timecod1; | ||
94 | /* Timecode 2 exists */ | ||
95 | int timecod2e; | ||
96 | /* Timecode 2 */ | ||
97 | unsigned int timecod2; | ||
98 | /* Additional bit stream info exists */ | ||
99 | int addbsie; | ||
100 | /* Additional bit stream length - 1 (in bytes) */ | ||
101 | int addbsil; | ||
102 | /* Additional bit stream information (max 64 bytes) */ | ||
103 | unsigned char addbsi[64]; | ||
104 | |||
105 | /* Information not in the AC-3 bitstream, but derived */ | ||
106 | /* Number of channels (excluding LFE) | ||
107 | * Derived from acmod */ | ||
108 | int nfchans; | ||
109 | } mpeg3_ac3bsi_t; | ||
110 | |||
111 | typedef struct | ||
112 | { | ||
113 | /* block switch bit indexed by channel num */ | ||
114 | unsigned short blksw[5]; | ||
115 | /* dither enable bit indexed by channel num */ | ||
116 | unsigned short dithflag[5]; | ||
117 | /* dynamic range gain exists */ | ||
118 | int dynrnge; | ||
119 | /* dynamic range gain */ | ||
120 | int dynrng; | ||
121 | /* if acmod==0 then */ | ||
122 | /* dynamic range 2 gain exists */ | ||
123 | int dynrng2e; | ||
124 | /* dynamic range 2 gain */ | ||
125 | int dynrng2; | ||
126 | /* coupling strategy exists */ | ||
127 | int cplstre; | ||
128 | /* coupling in use */ | ||
129 | int cplinu; | ||
130 | /* channel coupled */ | ||
131 | unsigned short chincpl[5]; | ||
132 | /* if acmod==2 then */ | ||
133 | /* Phase flags in use */ | ||
134 | int phsflginu; | ||
135 | /* coupling begin frequency code */ | ||
136 | int cplbegf; | ||
137 | /* coupling end frequency code */ | ||
138 | int cplendf; | ||
139 | /* coupling band structure bits */ | ||
140 | unsigned short cplbndstrc[18]; | ||
141 | /* Do coupling co-ords exist for this channel? */ | ||
142 | unsigned short cplcoe[5]; | ||
143 | /* Master coupling co-ordinate */ | ||
144 | unsigned short mstrcplco[5]; | ||
145 | /* Per coupling band coupling co-ordinates */ | ||
146 | unsigned short cplcoexp[5][18]; | ||
147 | unsigned short cplcomant[5][18]; | ||
148 | /* Phase flags for dual mono */ | ||
149 | unsigned short phsflg[18]; | ||
150 | /* Is there a rematrixing strategy */ | ||
151 | unsigned int rematstr; | ||
152 | /* Rematrixing bits */ | ||
153 | unsigned short rematflg[4]; | ||
154 | /* Coupling exponent strategy */ | ||
155 | int cplexpstr; | ||
156 | /* Exponent strategy for full bandwidth channels */ | ||
157 | unsigned short chexpstr[5]; | ||
158 | /* Exponent strategy for lfe channel */ | ||
159 | int lfeexpstr; | ||
160 | /* Channel bandwidth for independent channels */ | ||
161 | unsigned short chbwcod[5]; | ||
162 | /* The absolute coupling exponent */ | ||
163 | int cplabsexp; | ||
164 | /* Coupling channel exponents (D15 mode gives 18 * 12 /3 encoded exponents */ | ||
165 | unsigned short cplexps[18 * 12 / 3]; | ||
166 | /* fbw channel exponents */ | ||
167 | unsigned short exps[5][252 / 3]; | ||
168 | /* channel gain range */ | ||
169 | unsigned short gainrng[5]; | ||
170 | /* low frequency exponents */ | ||
171 | unsigned short lfeexps[3]; | ||
172 | |||
173 | /* Bit allocation info */ | ||
174 | int baie; | ||
175 | /* Slow decay code */ | ||
176 | int sdcycod; | ||
177 | /* Fast decay code */ | ||
178 | int fdcycod; | ||
179 | /* Slow gain code */ | ||
180 | int sgaincod; | ||
181 | /* dB per bit code */ | ||
182 | int dbpbcod; | ||
183 | /* masking floor code */ | ||
184 | int floorcod; | ||
185 | |||
186 | /* SNR offset info */ | ||
187 | int snroffste; | ||
188 | /* coarse SNR offset */ | ||
189 | int csnroffst; | ||
190 | /* coupling fine SNR offset */ | ||
191 | int cplfsnroffst; | ||
192 | /* coupling fast gain code */ | ||
193 | int cplfgaincod; | ||
194 | /* fbw fine SNR offset */ | ||
195 | unsigned short fsnroffst[5]; | ||
196 | /* fbw fast gain code */ | ||
197 | unsigned short fgaincod[5]; | ||
198 | /* lfe fine SNR offset */ | ||
199 | int lfefsnroffst; | ||
200 | /* lfe fast gain code */ | ||
201 | int lfefgaincod; | ||
202 | |||
203 | /* Coupling leak info */ | ||
204 | int cplleake; | ||
205 | /* coupling fast leak initialization */ | ||
206 | int cplfleak; | ||
207 | /* coupling slow leak initialization */ | ||
208 | int cplsleak; | ||
209 | |||
210 | /* delta bit allocation info */ | ||
211 | int deltbaie; | ||
212 | /* coupling delta bit allocation exists */ | ||
213 | int cpldeltbae; | ||
214 | /* fbw delta bit allocation exists */ | ||
215 | unsigned short deltbae[5]; | ||
216 | /* number of cpl delta bit segments */ | ||
217 | int cpldeltnseg; | ||
218 | /* coupling delta bit allocation offset */ | ||
219 | short cpldeltoffst[8]; | ||
220 | /* coupling delta bit allocation length */ | ||
221 | short cpldeltlen[8]; | ||
222 | /* coupling delta bit allocation length */ | ||
223 | short cpldeltba[8]; | ||
224 | /* number of delta bit segments */ | ||
225 | unsigned short deltnseg[5]; | ||
226 | /* fbw delta bit allocation offset */ | ||
227 | short deltoffst[5][8]; | ||
228 | /* fbw delta bit allocation length */ | ||
229 | short deltlen[5][8]; | ||
230 | /* fbw delta bit allocation length */ | ||
231 | short deltba[5][8]; | ||
232 | |||
233 | /* skip length exists */ | ||
234 | int skiple; | ||
235 | /* skip length */ | ||
236 | int skipl; | ||
237 | |||
238 | /* channel mantissas */ | ||
239 | short chmant[5][256]; | ||
240 | |||
241 | /* coupling mantissas */ | ||
242 | unsigned short cplmant[256]; | ||
243 | |||
244 | /* coupling mantissas */ | ||
245 | unsigned short lfemant[7]; | ||
246 | |||
247 | /* -- Information not in the bitstream, but derived thereof -- */ | ||
248 | |||
249 | /* Number of coupling sub-bands */ | ||
250 | int ncplsubnd; | ||
251 | |||
252 | /* Number of combined coupling sub-bands | ||
253 | * Derived from ncplsubnd and cplbndstrc */ | ||
254 | int ncplbnd; | ||
255 | |||
256 | /* Number of exponent groups by channel | ||
257 | * Derived from strmant, endmant */ | ||
258 | int nchgrps[5]; | ||
259 | |||
260 | /* Number of coupling exponent groups | ||
261 | * Derived from cplbegf, cplendf, cplexpstr */ | ||
262 | int ncplgrps; | ||
263 | |||
264 | /* End mantissa numbers of fbw channels */ | ||
265 | unsigned short endmant[5]; | ||
266 | |||
267 | /* Start and end mantissa numbers for the coupling channel */ | ||
268 | int cplstrtmant; | ||
269 | int cplendmant; | ||
270 | |||
271 | /* Decoded exponent info */ | ||
272 | unsigned short fbw_exp[5][256]; | ||
273 | unsigned short cpl_exp[256]; | ||
274 | unsigned short lfe_exp[7]; | ||
275 | |||
276 | /* Bit allocation pointer results */ | ||
277 | short fbw_bap[5][256]; | ||
278 | /*FIXME figure out exactly how many entries there should be (253-37?) */ | ||
279 | short cpl_bap[256]; | ||
280 | short lfe_bap[7]; | ||
281 | } mpeg3_ac3audblk_t; | ||
282 | |||
283 | /* Bit allocation data */ | ||
284 | typedef struct | ||
285 | { | ||
286 | int sdecay; | ||
287 | int fdecay; | ||
288 | int sgain; | ||
289 | int dbknee; | ||
290 | int floor; | ||
291 | short psd[256]; | ||
292 | short bndpsd[256]; | ||
293 | short excite[256]; | ||
294 | short mask[256]; | ||
295 | } mpeg3_ac3_bitallocation_t; | ||
296 | |||
297 | /* Mantissa data */ | ||
298 | typedef struct | ||
299 | { | ||
300 | unsigned short m_1[3]; | ||
301 | unsigned short m_2[3]; | ||
302 | unsigned short m_4[2]; | ||
303 | unsigned short m_1_pointer; | ||
304 | unsigned short m_2_pointer; | ||
305 | unsigned short m_4_pointer; | ||
306 | } mpeg3_ac3_mantissa_t; | ||
307 | |||
308 | #endif | ||