Mercurial > mplayer.hg
comparison libfaad2/structs.h @ 10725:e989150f8216
libfaad2 v2.0rc1 imported
author | arpi |
---|---|
date | Sat, 30 Aug 2003 22:30:28 +0000 |
parents | |
children | 3185f64f6350 |
comparison
equal
deleted
inserted
replaced
10724:adf5697b9d83 | 10725:e989150f8216 |
---|---|
1 /* | |
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding | |
3 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com | |
4 ** | |
5 ** This program is free software; you can redistribute it and/or modify | |
6 ** it under the terms of the GNU General Public License as published by | |
7 ** the Free Software Foundation; either version 2 of the License, or | |
8 ** (at your option) any later version. | |
9 ** | |
10 ** This program is distributed in the hope that it will be useful, | |
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ** GNU General Public License for more details. | |
14 ** | |
15 ** You should have received a copy of the GNU General Public License | |
16 ** along with this program; if not, write to the Free Software | |
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
18 ** | |
19 ** Any non-GPL usage of this software or parts of this software is strictly | |
20 ** forbidden. | |
21 ** | |
22 ** Commercial non-GPL licensing of this software is possible. | |
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
24 ** | |
25 ** $Id: structs.h,v 1.10 2003/07/29 08:20:14 menno Exp $ | |
26 **/ | |
27 | |
28 #ifndef __STRUCTS_H__ | |
29 #define __STRUCTS_H__ | |
30 | |
31 #ifdef __cplusplus | |
32 extern "C" { | |
33 #endif | |
34 | |
35 #ifdef SBR_DEC | |
36 #include "sbr_dec.h" | |
37 #endif | |
38 | |
39 #define MAX_CHANNELS 64 | |
40 #define MAX_SYNTAX_ELEMENTS 48 | |
41 #define MAX_WINDOW_GROUPS 8 | |
42 #define MAX_SFB 51 | |
43 #define MAX_LTP_SFB 40 | |
44 #define MAX_LTP_SFB_S 8 | |
45 | |
46 /* used to save the prediction state */ | |
47 typedef struct { | |
48 real_t r[2]; | |
49 real_t KOR[2]; | |
50 real_t VAR[2]; | |
51 } pred_state; | |
52 | |
53 typedef struct | |
54 { | |
55 uint16_t n; | |
56 uint16_t ifac[15]; | |
57 complex_t *work; | |
58 complex_t *tab; | |
59 } cfft_info; | |
60 | |
61 typedef struct { | |
62 uint16_t N; | |
63 cfft_info *cfft; | |
64 complex_t *sincos; | |
65 complex_t *Z1; | |
66 } mdct_info; | |
67 | |
68 typedef struct | |
69 { | |
70 real_t *long_window[2]; | |
71 real_t *short_window[2]; | |
72 #ifdef LD_DEC | |
73 real_t *ld_window[2]; | |
74 #endif | |
75 | |
76 mdct_info *mdct256; | |
77 #ifdef LD_DEC | |
78 mdct_info *mdct1024; | |
79 #endif | |
80 mdct_info *mdct2048; | |
81 } fb_info; | |
82 | |
83 typedef struct | |
84 { | |
85 uint8_t present; | |
86 | |
87 uint8_t num_bands; | |
88 uint8_t pce_instance_tag; | |
89 uint8_t excluded_chns_present; | |
90 uint8_t band_top[17]; | |
91 uint8_t prog_ref_level; | |
92 uint8_t dyn_rng_sgn[17]; | |
93 uint8_t dyn_rng_ctl[17]; | |
94 uint8_t exclude_mask[MAX_CHANNELS]; | |
95 uint8_t additional_excluded_chns[MAX_CHANNELS]; | |
96 | |
97 real_t ctrl1; | |
98 real_t ctrl2; | |
99 } drc_info; | |
100 | |
101 typedef struct | |
102 { | |
103 uint8_t element_instance_tag; | |
104 uint8_t object_type; | |
105 uint8_t sf_index; | |
106 uint8_t num_front_channel_elements; | |
107 uint8_t num_side_channel_elements; | |
108 uint8_t num_back_channel_elements; | |
109 uint8_t num_lfe_channel_elements; | |
110 uint8_t num_assoc_data_elements; | |
111 uint8_t num_valid_cc_elements; | |
112 uint8_t mono_mixdown_present; | |
113 uint8_t mono_mixdown_element_number; | |
114 uint8_t stereo_mixdown_present; | |
115 uint8_t stereo_mixdown_element_number; | |
116 uint8_t matrix_mixdown_idx_present; | |
117 uint8_t pseudo_surround_enable; | |
118 uint8_t matrix_mixdown_idx; | |
119 uint8_t front_element_is_cpe[16]; | |
120 uint8_t front_element_tag_select[16]; | |
121 uint8_t side_element_is_cpe[16]; | |
122 uint8_t side_element_tag_select[16]; | |
123 uint8_t back_element_is_cpe[16]; | |
124 uint8_t back_element_tag_select[16]; | |
125 uint8_t lfe_element_tag_select[16]; | |
126 uint8_t assoc_data_element_tag_select[16]; | |
127 uint8_t cc_element_is_ind_sw[16]; | |
128 uint8_t valid_cc_element_tag_select[16]; | |
129 | |
130 uint8_t channels; | |
131 | |
132 uint8_t comment_field_bytes; | |
133 uint8_t comment_field_data[257]; | |
134 | |
135 /* extra added values */ | |
136 uint8_t num_front_channels; | |
137 uint8_t num_side_channels; | |
138 uint8_t num_back_channels; | |
139 uint8_t num_lfe_channels; | |
140 uint8_t sce_channel[16]; | |
141 uint8_t cpe_channel[16]; | |
142 } program_config; | |
143 | |
144 typedef struct | |
145 { | |
146 uint16_t syncword; | |
147 uint8_t id; | |
148 uint8_t layer; | |
149 uint8_t protection_absent; | |
150 uint8_t profile; | |
151 uint8_t sf_index; | |
152 uint8_t private_bit; | |
153 uint8_t channel_configuration; | |
154 uint8_t original; | |
155 uint8_t home; | |
156 uint8_t emphasis; | |
157 uint8_t copyright_identification_bit; | |
158 uint8_t copyright_identification_start; | |
159 uint16_t aac_frame_length; | |
160 uint16_t adts_buffer_fullness; | |
161 uint8_t no_raw_data_blocks_in_frame; | |
162 uint16_t crc_check; | |
163 } adts_header; | |
164 | |
165 typedef struct | |
166 { | |
167 uint8_t copyright_id_present; | |
168 int8_t copyright_id[10]; | |
169 uint8_t original_copy; | |
170 uint8_t home; | |
171 uint8_t bitstream_type; | |
172 uint32_t bitrate; | |
173 uint8_t num_program_config_elements; | |
174 uint32_t adif_buffer_fullness; | |
175 | |
176 /* maximum of 16 PCEs */ | |
177 program_config pce[16]; | |
178 } adif_header; | |
179 | |
180 typedef struct | |
181 { | |
182 uint8_t last_band; | |
183 uint8_t data_present; | |
184 uint16_t lag; | |
185 uint8_t lag_update; | |
186 uint8_t coef; | |
187 uint8_t long_used[MAX_SFB]; | |
188 uint8_t short_used[8]; | |
189 uint8_t short_lag_present[8]; | |
190 uint8_t short_lag[8]; | |
191 } ltp_info; | |
192 | |
193 typedef struct | |
194 { | |
195 uint8_t limit; | |
196 uint8_t predictor_reset; | |
197 uint8_t predictor_reset_group_number; | |
198 uint8_t prediction_used[MAX_SFB]; | |
199 } pred_info; | |
200 | |
201 typedef struct | |
202 { | |
203 uint8_t number_pulse; | |
204 uint8_t pulse_start_sfb; | |
205 uint8_t pulse_offset[4]; | |
206 uint8_t pulse_amp[4]; | |
207 } pulse_info; | |
208 | |
209 typedef struct | |
210 { | |
211 uint8_t n_filt[8]; | |
212 uint8_t coef_res[8]; | |
213 uint8_t length[8][4]; | |
214 uint8_t order[8][4]; | |
215 uint8_t direction[8][4]; | |
216 uint8_t coef_compress[8][4]; | |
217 uint8_t coef[8][4][32]; | |
218 } tns_info; | |
219 | |
220 #ifdef SSR_DEC | |
221 typedef struct | |
222 { | |
223 uint8_t max_band; | |
224 | |
225 uint8_t adjust_num[4][8]; | |
226 uint8_t alevcode[4][8][8]; | |
227 uint8_t aloccode[4][8][8]; | |
228 } ssr_info; | |
229 #endif | |
230 | |
231 typedef struct | |
232 { | |
233 uint8_t max_sfb; | |
234 | |
235 uint8_t num_swb; | |
236 uint8_t num_window_groups; | |
237 uint8_t num_windows; | |
238 uint8_t window_sequence; | |
239 uint8_t window_group_length[8]; | |
240 uint8_t window_shape; | |
241 uint8_t scale_factor_grouping; | |
242 uint16_t sect_sfb_offset[8][15*8]; | |
243 uint16_t swb_offset[52]; | |
244 | |
245 uint8_t sect_cb[8][15*8]; | |
246 uint16_t sect_start[8][15*8]; | |
247 uint16_t sect_end[8][15*8]; | |
248 uint8_t sfb_cb[8][8*15]; | |
249 uint8_t num_sec[8]; /* number of sections in a group */ | |
250 | |
251 uint8_t global_gain; | |
252 int16_t scale_factors[8][51]; | |
253 | |
254 uint8_t ms_mask_present; | |
255 uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB]; | |
256 | |
257 uint8_t noise_used; | |
258 | |
259 uint8_t pulse_data_present; | |
260 uint8_t tns_data_present; | |
261 uint8_t gain_control_data_present; | |
262 uint8_t predictor_data_present; | |
263 | |
264 pulse_info pul; | |
265 tns_info tns; | |
266 pred_info pred; | |
267 ltp_info ltp; | |
268 ltp_info ltp2; | |
269 #ifdef SSR_DEC | |
270 ssr_info ssr; | |
271 #endif | |
272 | |
273 #ifdef ERROR_RESILIENCE | |
274 /* ER HCR data */ | |
275 uint16_t length_of_reordered_spectral_data; | |
276 uint8_t length_of_longest_codeword; | |
277 /* ER RLVC data */ | |
278 uint8_t sf_concealment; | |
279 uint8_t rev_global_gain; | |
280 uint16_t length_of_rvlc_sf; | |
281 uint16_t dpcm_noise_nrg; | |
282 uint8_t sf_escapes_present; | |
283 uint8_t length_of_rvlc_escapes; | |
284 uint16_t dpcm_noise_last_position; | |
285 #endif | |
286 } ic_stream; /* individual channel stream */ | |
287 | |
288 typedef struct | |
289 { | |
290 uint8_t ele_id; | |
291 | |
292 uint8_t channel; | |
293 int16_t paired_channel; | |
294 | |
295 uint8_t element_instance_tag; | |
296 uint8_t common_window; | |
297 | |
298 ic_stream ics1; | |
299 ic_stream ics2; | |
300 } element; /* syntax element (SCE, CPE, LFE) */ | |
301 | |
302 typedef struct mp4AudioSpecificConfig | |
303 { | |
304 /* Audio Specific Info */ | |
305 uint8_t objectTypeIndex; | |
306 uint8_t samplingFrequencyIndex; | |
307 uint32_t samplingFrequency; | |
308 uint8_t channelsConfiguration; | |
309 | |
310 /* GA Specific Info */ | |
311 uint8_t frameLengthFlag; | |
312 uint8_t dependsOnCoreCoder; | |
313 uint16_t coreCoderDelay; | |
314 uint8_t extensionFlag; | |
315 uint8_t aacSectionDataResilienceFlag; | |
316 uint8_t aacScalefactorDataResilienceFlag; | |
317 uint8_t aacSpectralDataResilienceFlag; | |
318 uint8_t epConfig; | |
319 | |
320 int8_t sbr_present_flag; | |
321 } mp4AudioSpecificConfig; | |
322 | |
323 typedef struct faacDecConfiguration | |
324 { | |
325 uint8_t defObjectType; | |
326 uint32_t defSampleRate; | |
327 uint8_t outputFormat; | |
328 uint8_t downMatrix; | |
329 } faacDecConfiguration, *faacDecConfigurationPtr; | |
330 | |
331 typedef struct faacDecFrameInfo | |
332 { | |
333 uint32_t bytesconsumed; | |
334 uint32_t samples; | |
335 uint8_t channels; | |
336 uint8_t error; | |
337 uint32_t samplerate; | |
338 | |
339 /* multichannel configuration */ | |
340 uint8_t num_front_channels; | |
341 uint8_t num_side_channels; | |
342 uint8_t num_back_channels; | |
343 uint8_t num_lfe_channels; | |
344 uint8_t channel_position[MAX_CHANNELS]; | |
345 } faacDecFrameInfo; | |
346 | |
347 typedef struct | |
348 { | |
349 uint8_t adts_header_present; | |
350 uint8_t adif_header_present; | |
351 uint8_t sf_index; | |
352 uint8_t object_type; | |
353 uint8_t channelConfiguration; | |
354 #ifdef ERROR_RESILIENCE | |
355 uint8_t aacSectionDataResilienceFlag; | |
356 uint8_t aacScalefactorDataResilienceFlag; | |
357 uint8_t aacSpectralDataResilienceFlag; | |
358 #endif | |
359 uint16_t frameLength; | |
360 uint16_t samplesLeft; | |
361 uint8_t postSeekResetFlag; | |
362 | |
363 uint32_t frame; | |
364 | |
365 uint8_t downMatrix; | |
366 uint8_t first_syn_ele; | |
367 uint8_t last_syn_ele; | |
368 uint8_t has_lfe; | |
369 uint8_t fr_channels; | |
370 uint8_t fr_ch_ele; | |
371 | |
372 void *sample_buffer; | |
373 | |
374 uint8_t window_shape_prev[MAX_CHANNELS]; | |
375 #ifdef LTP_DEC | |
376 uint16_t ltp_lag[MAX_CHANNELS]; | |
377 #endif | |
378 fb_info *fb; | |
379 drc_info *drc; | |
380 | |
381 real_t *time_out[MAX_CHANNELS]; | |
382 | |
383 #ifdef SBR_DEC | |
384 int8_t sbr_present_flag; | |
385 | |
386 real_t *time_out2[MAX_CHANNELS]; | |
387 | |
388 uint8_t sbr_used[32]; | |
389 | |
390 sbr_info *sbr[32]; | |
391 #endif | |
392 | |
393 #ifdef SSR_DEC | |
394 real_t *ssr_overlap[MAX_CHANNELS]; | |
395 real_t *prev_fmd[MAX_CHANNELS]; | |
396 real_t ipqf_buffer[MAX_CHANNELS][4][96/4]; | |
397 #endif | |
398 | |
399 #ifdef MAIN_DEC | |
400 pred_state *pred_stat[MAX_CHANNELS]; | |
401 #endif | |
402 #ifdef LTP_DEC | |
403 real_t *lt_pred_stat[MAX_CHANNELS]; | |
404 #endif | |
405 | |
406 #ifndef FIXED_POINT | |
407 #if POW_TABLE_SIZE | |
408 real_t *pow2_table; | |
409 #endif | |
410 #endif | |
411 | |
412 /* Program Config Element */ | |
413 uint8_t pce_set; | |
414 program_config pce; | |
415 uint8_t channel_element[MAX_CHANNELS]; | |
416 uint8_t internal_channel[MAX_CHANNELS]; | |
417 | |
418 /* Configuration data */ | |
419 faacDecConfiguration config; | |
420 } faacDecStruct, *faacDecHandle; | |
421 | |
422 | |
423 | |
424 #ifdef __cplusplus | |
425 } | |
426 #endif | |
427 #endif |