diff options
Diffstat (limited to 'lib/rbcodec/codecs/libfaad/structs.h')
-rw-r--r-- | lib/rbcodec/codecs/libfaad/structs.h | 473 |
1 files changed, 473 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libfaad/structs.h b/lib/rbcodec/codecs/libfaad/structs.h new file mode 100644 index 0000000000..a6114f412a --- /dev/null +++ b/lib/rbcodec/codecs/libfaad/structs.h | |||
@@ -0,0 +1,473 @@ | |||
1 | /* | ||
2 | ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding | ||
3 | ** Copyright (C) 2003-2004 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$ | ||
26 | **/ | ||
27 | |||
28 | #ifndef __STRUCTS_H__ | ||
29 | #define __STRUCTS_H__ | ||
30 | |||
31 | #ifdef __cplusplus | ||
32 | extern "C" { | ||
33 | #endif | ||
34 | |||
35 | //#include "cfft.h" | ||
36 | #ifdef SBR_DEC | ||
37 | #include "sbr_dec.h" | ||
38 | #endif | ||
39 | |||
40 | #define MAX_CHANNELS 2 /* Was 64, but we need to limit RAM usage */ | ||
41 | #define MAX_SYNTAX_ELEMENTS 1 /* Was 48, but we need to limit RAM usage */ | ||
42 | #define MAX_WINDOW_GROUPS 8 | ||
43 | #define MAX_SFB 51 | ||
44 | #define MAX_LTP_SFB 40 | ||
45 | #define MAX_LTP_SFB_S 8 | ||
46 | #define FRAME_LEN 1024 | ||
47 | |||
48 | #define DRC_MAX_CHANNELS 64 /* Should be the same as MAX_CHANNELS, but the DRC code expects 64 */ | ||
49 | |||
50 | /* used to save the prediction state */ | ||
51 | typedef struct { | ||
52 | int16_t r[2]; | ||
53 | int16_t COR[2]; | ||
54 | int16_t VAR[2]; | ||
55 | } pred_state; | ||
56 | |||
57 | typedef struct { | ||
58 | uint16_t N; | ||
59 | //cfft_info *cfft; | ||
60 | complex_t *sincos; | ||
61 | #ifdef PROFILE | ||
62 | int64_t cycles; | ||
63 | int64_t fft_cycles; | ||
64 | #endif | ||
65 | } mdct_info; | ||
66 | |||
67 | typedef struct | ||
68 | { | ||
69 | const real_t *long_window[2]; | ||
70 | const real_t *short_window[2]; | ||
71 | #ifdef LD_DEC | ||
72 | const real_t *ld_window[2]; | ||
73 | #endif | ||
74 | |||
75 | mdct_info *mdct256; | ||
76 | #ifdef LD_DEC | ||
77 | mdct_info *mdct1024; | ||
78 | #endif | ||
79 | mdct_info *mdct2048; | ||
80 | #ifdef PROFILE | ||
81 | int64_t cycles; | ||
82 | #endif | ||
83 | } fb_info; | ||
84 | |||
85 | typedef struct | ||
86 | { | ||
87 | uint8_t present; | ||
88 | |||
89 | uint8_t num_bands; | ||
90 | uint8_t pce_instance_tag; | ||
91 | uint8_t excluded_chns_present; | ||
92 | uint8_t band_top[17]; | ||
93 | uint8_t prog_ref_level; | ||
94 | uint8_t dyn_rng_sgn[17]; | ||
95 | uint8_t dyn_rng_ctl[17]; | ||
96 | uint8_t exclude_mask[DRC_MAX_CHANNELS]; | ||
97 | uint8_t additional_excluded_chns[DRC_MAX_CHANNELS/7]; | ||
98 | |||
99 | real_t ctrl1; | ||
100 | real_t ctrl2; | ||
101 | } drc_info; | ||
102 | |||
103 | typedef struct | ||
104 | { | ||
105 | uint8_t element_instance_tag; | ||
106 | uint8_t object_type; | ||
107 | uint8_t sf_index; | ||
108 | uint8_t num_front_channel_elements; | ||
109 | uint8_t num_side_channel_elements; | ||
110 | uint8_t num_back_channel_elements; | ||
111 | uint8_t num_lfe_channel_elements; | ||
112 | uint8_t num_assoc_data_elements; | ||
113 | uint8_t num_valid_cc_elements; | ||
114 | uint8_t mono_mixdown_present; | ||
115 | uint8_t mono_mixdown_element_number; | ||
116 | uint8_t stereo_mixdown_present; | ||
117 | uint8_t stereo_mixdown_element_number; | ||
118 | uint8_t matrix_mixdown_idx_present; | ||
119 | uint8_t pseudo_surround_enable; | ||
120 | uint8_t matrix_mixdown_idx; | ||
121 | uint8_t front_element_is_cpe[16]; | ||
122 | uint8_t front_element_tag_select[16]; | ||
123 | uint8_t side_element_is_cpe[16]; | ||
124 | uint8_t side_element_tag_select[16]; | ||
125 | uint8_t back_element_is_cpe[16]; | ||
126 | uint8_t back_element_tag_select[16]; | ||
127 | uint8_t lfe_element_tag_select[16]; | ||
128 | uint8_t assoc_data_element_tag_select[16]; | ||
129 | uint8_t cc_element_is_ind_sw[16]; | ||
130 | uint8_t valid_cc_element_tag_select[16]; | ||
131 | |||
132 | uint8_t channels; | ||
133 | |||
134 | uint8_t comment_field_bytes; | ||
135 | uint8_t comment_field_data[257]; | ||
136 | |||
137 | /* extra added values */ | ||
138 | uint8_t num_front_channels; | ||
139 | uint8_t num_side_channels; | ||
140 | uint8_t num_back_channels; | ||
141 | uint8_t num_lfe_channels; | ||
142 | uint8_t sce_channel[16]; | ||
143 | uint8_t cpe_channel[16]; | ||
144 | } program_config; | ||
145 | |||
146 | typedef struct | ||
147 | { | ||
148 | uint16_t syncword; | ||
149 | uint8_t id; | ||
150 | uint8_t layer; | ||
151 | uint8_t protection_absent; | ||
152 | uint8_t profile; | ||
153 | uint8_t sf_index; | ||
154 | uint8_t private_bit; | ||
155 | uint8_t channel_configuration; | ||
156 | uint8_t original; | ||
157 | uint8_t home; | ||
158 | uint8_t emphasis; | ||
159 | uint8_t copyright_identification_bit; | ||
160 | uint8_t copyright_identification_start; | ||
161 | uint16_t aac_frame_length; | ||
162 | uint16_t adts_buffer_fullness; | ||
163 | uint8_t no_raw_data_blocks_in_frame; | ||
164 | uint16_t crc_check; | ||
165 | |||
166 | /* control param */ | ||
167 | uint8_t old_format; | ||
168 | } adts_header; | ||
169 | |||
170 | typedef struct | ||
171 | { | ||
172 | uint8_t copyright_id_present; | ||
173 | int8_t copyright_id[10]; | ||
174 | uint8_t original_copy; | ||
175 | uint8_t home; | ||
176 | uint8_t bitstream_type; | ||
177 | uint32_t bitrate; | ||
178 | uint8_t num_program_config_elements; | ||
179 | uint32_t adif_buffer_fullness; | ||
180 | |||
181 | /* maximum of 16 PCEs */ | ||
182 | program_config pce[16]; | ||
183 | } adif_header; | ||
184 | |||
185 | #ifdef LTP_DEC | ||
186 | typedef struct | ||
187 | { | ||
188 | uint8_t last_band; | ||
189 | uint8_t data_present; | ||
190 | uint16_t lag; | ||
191 | uint8_t lag_update; | ||
192 | uint8_t coef; | ||
193 | uint8_t long_used[MAX_SFB]; | ||
194 | uint8_t short_used[8]; | ||
195 | uint8_t short_lag_present[8]; | ||
196 | uint8_t short_lag[8]; | ||
197 | } ltp_info; | ||
198 | #endif | ||
199 | |||
200 | #ifdef MAIN_DEC | ||
201 | typedef struct | ||
202 | { | ||
203 | uint8_t limit; | ||
204 | uint8_t predictor_reset; | ||
205 | uint8_t predictor_reset_group_number; | ||
206 | uint8_t prediction_used[MAX_SFB]; | ||
207 | } pred_info; | ||
208 | #endif | ||
209 | |||
210 | typedef struct | ||
211 | { | ||
212 | uint8_t number_pulse; | ||
213 | uint8_t pulse_start_sfb; | ||
214 | uint8_t pulse_offset[4]; | ||
215 | uint8_t pulse_amp[4]; | ||
216 | } pulse_info; | ||
217 | |||
218 | typedef struct | ||
219 | { | ||
220 | uint8_t n_filt[8]; | ||
221 | uint8_t coef_res[8]; | ||
222 | uint8_t length[8][4]; | ||
223 | uint8_t order[8][4]; | ||
224 | uint8_t direction[8][4]; | ||
225 | uint8_t coef_compress[8][4]; | ||
226 | uint8_t coef[8][4][32]; | ||
227 | } tns_info; | ||
228 | |||
229 | #ifdef SSR_DEC | ||
230 | typedef struct | ||
231 | { | ||
232 | uint8_t max_band; | ||
233 | |||
234 | uint8_t adjust_num[4][8]; | ||
235 | uint8_t alevcode[4][8][8]; | ||
236 | uint8_t aloccode[4][8][8]; | ||
237 | } ssr_info; | ||
238 | #endif | ||
239 | |||
240 | typedef struct | ||
241 | { | ||
242 | uint8_t max_sfb; | ||
243 | |||
244 | uint8_t num_swb; | ||
245 | uint8_t num_window_groups; | ||
246 | uint8_t num_windows; | ||
247 | uint8_t window_sequence; | ||
248 | uint8_t window_group_length[8]; | ||
249 | uint8_t window_shape; | ||
250 | uint8_t scale_factor_grouping; | ||
251 | uint16_t sect_sfb_offset[8][15*8]; | ||
252 | uint16_t swb_offset[52]; | ||
253 | |||
254 | uint8_t sect_cb[8][15*8]; | ||
255 | uint16_t sect_start[8][15*8]; | ||
256 | uint16_t sect_end[8][15*8]; | ||
257 | uint8_t sfb_cb[8][8*15]; | ||
258 | uint8_t num_sec[8]; /* number of sections in a group */ | ||
259 | |||
260 | uint8_t global_gain; | ||
261 | int16_t scale_factors[8][51]; /* [0..255] */ | ||
262 | |||
263 | uint8_t ms_mask_present; | ||
264 | uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB]; | ||
265 | |||
266 | uint8_t noise_used; | ||
267 | |||
268 | uint8_t pulse_data_present; | ||
269 | uint8_t tns_data_present; | ||
270 | uint8_t gain_control_data_present; | ||
271 | uint8_t predictor_data_present; | ||
272 | |||
273 | pulse_info pul; | ||
274 | tns_info tns; | ||
275 | #ifdef MAIN_DEC | ||
276 | pred_info pred; | ||
277 | #endif | ||
278 | #ifdef LTP_DEC | ||
279 | ltp_info ltp; | ||
280 | ltp_info ltp2; | ||
281 | #endif | ||
282 | #ifdef SSR_DEC | ||
283 | ssr_info ssr; | ||
284 | #endif | ||
285 | |||
286 | #ifdef ERROR_RESILIENCE | ||
287 | /* ER HCR data */ | ||
288 | uint16_t length_of_reordered_spectral_data; | ||
289 | uint8_t length_of_longest_codeword; | ||
290 | /* ER RLVC data */ | ||
291 | uint8_t sf_concealment; | ||
292 | uint8_t rev_global_gain; | ||
293 | uint16_t length_of_rvlc_sf; | ||
294 | uint16_t dpcm_noise_nrg; | ||
295 | uint8_t sf_escapes_present; | ||
296 | uint8_t length_of_rvlc_escapes; | ||
297 | uint16_t dpcm_noise_last_position; | ||
298 | #endif | ||
299 | } ic_stream; /* individual channel stream */ | ||
300 | |||
301 | typedef struct | ||
302 | { | ||
303 | uint8_t channel; | ||
304 | int16_t paired_channel; | ||
305 | |||
306 | uint8_t element_instance_tag; | ||
307 | uint8_t common_window; | ||
308 | |||
309 | ic_stream ics1; | ||
310 | ic_stream ics2; | ||
311 | } element; /* syntax element (SCE, CPE, LFE) */ | ||
312 | |||
313 | typedef struct mp4AudioSpecificConfig | ||
314 | { | ||
315 | /* Audio Specific Info */ | ||
316 | /*uint8_t*/ unsigned char objectTypeIndex; | ||
317 | /*uint8_t*/ unsigned char samplingFrequencyIndex; | ||
318 | /*uint32_t*/ unsigned long samplingFrequency; | ||
319 | /*uint8_t*/ unsigned char channelsConfiguration; | ||
320 | |||
321 | /* GA Specific Info */ | ||
322 | /*uint8_t*/ unsigned char frameLengthFlag; | ||
323 | /*uint8_t*/ unsigned char dependsOnCoreCoder; | ||
324 | /*uint16_t*/ unsigned short coreCoderDelay; | ||
325 | /*uint8_t*/ unsigned char extensionFlag; | ||
326 | /*uint8_t*/ unsigned char aacSectionDataResilienceFlag; | ||
327 | /*uint8_t*/ unsigned char aacScalefactorDataResilienceFlag; | ||
328 | /*uint8_t*/ unsigned char aacSpectralDataResilienceFlag; | ||
329 | /*uint8_t*/ unsigned char epConfig; | ||
330 | |||
331 | /*uint8_t*/ signed char sbr_present_flag; | ||
332 | /*uint8_t*/ char forceUpSampling; | ||
333 | /*uint8_t*/ char downSampledSBR; | ||
334 | } mp4AudioSpecificConfig; | ||
335 | |||
336 | typedef struct NeAACDecConfiguration | ||
337 | { | ||
338 | /*uint8_t*/ unsigned char defObjectType; | ||
339 | /*uint32_t*/ unsigned long defSampleRate; | ||
340 | /*uint8_t*/ unsigned char outputFormat; | ||
341 | /*uint8_t*/ unsigned char downMatrix; | ||
342 | /*uint8_t*/ unsigned char useOldADTSFormat; | ||
343 | /*uint8_t*/ unsigned char dontUpSampleImplicitSBR; | ||
344 | } NeAACDecConfiguration, *NeAACDecConfigurationPtr; | ||
345 | |||
346 | typedef struct NeAACDecFrameInfo | ||
347 | { | ||
348 | /*uint32_t*/ unsigned long bytesconsumed; | ||
349 | /*uint32_t*/ unsigned long samples; | ||
350 | /*uint8_t*/ unsigned char channels; | ||
351 | /*uint8_t*/ unsigned char error; | ||
352 | /*uint32_t*/ unsigned long samplerate; | ||
353 | |||
354 | /* SBR: 0: off, 1: on; normal, 2: on; downsampled */ | ||
355 | /*uint8_t*/ unsigned char sbr; | ||
356 | |||
357 | /* MPEG-4 ObjectType */ | ||
358 | /*uint8_t*/ unsigned char object_type; | ||
359 | |||
360 | /* AAC header type; MP4 will be signalled as RAW also */ | ||
361 | /*uint8_t*/ unsigned char header_type; | ||
362 | |||
363 | /* multichannel configuration */ | ||
364 | /*uint8_t*/ unsigned char num_front_channels; | ||
365 | /*uint8_t*/ unsigned char num_side_channels; | ||
366 | /*uint8_t*/ unsigned char num_back_channels; | ||
367 | /*uint8_t*/ unsigned char num_lfe_channels; | ||
368 | /*uint8_t*/ unsigned char channel_position[MAX_CHANNELS]; | ||
369 | |||
370 | /* PS: 0: off, 1: on */ | ||
371 | /*uint8_t*/ unsigned char ps; | ||
372 | } NeAACDecFrameInfo; | ||
373 | |||
374 | typedef struct | ||
375 | { | ||
376 | uint8_t adts_header_present; | ||
377 | uint8_t adif_header_present; | ||
378 | uint8_t sf_index; | ||
379 | uint8_t object_type; | ||
380 | uint8_t channelConfiguration; | ||
381 | #ifdef ERROR_RESILIENCE | ||
382 | uint8_t aacSectionDataResilienceFlag; | ||
383 | uint8_t aacScalefactorDataResilienceFlag; | ||
384 | uint8_t aacSpectralDataResilienceFlag; | ||
385 | #endif | ||
386 | uint16_t frameLength; | ||
387 | uint8_t postSeekResetFlag; | ||
388 | |||
389 | uint32_t frame; | ||
390 | |||
391 | uint8_t downMatrix; | ||
392 | uint8_t upMatrix; | ||
393 | uint8_t first_syn_ele; | ||
394 | uint8_t has_lfe; | ||
395 | /* number of channels in current frame */ | ||
396 | uint8_t fr_channels; | ||
397 | /* number of elements in current frame */ | ||
398 | uint8_t fr_ch_ele; | ||
399 | |||
400 | /* element_output_channels: | ||
401 | determines the number of channels the element will output | ||
402 | */ | ||
403 | uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS]; | ||
404 | /* element_alloced: | ||
405 | determines whether the data needed for the element is allocated or not | ||
406 | */ | ||
407 | uint8_t element_alloced[MAX_SYNTAX_ELEMENTS]; | ||
408 | /* alloced_channels: | ||
409 | determines the number of channels where output data is allocated for | ||
410 | */ | ||
411 | uint8_t alloced_channels; | ||
412 | |||
413 | uint8_t window_shape_prev[MAX_CHANNELS]; | ||
414 | #ifdef LTP_DEC | ||
415 | uint16_t ltp_lag[MAX_CHANNELS]; | ||
416 | #endif | ||
417 | fb_info *fb; | ||
418 | drc_info *drc; | ||
419 | |||
420 | real_t *time_out[MAX_CHANNELS]; | ||
421 | real_t *fb_intermed[MAX_CHANNELS]; | ||
422 | |||
423 | #ifdef SBR_DEC | ||
424 | int8_t sbr_present_flag; | ||
425 | int8_t forceUpSampling; | ||
426 | int8_t downSampledSBR; | ||
427 | /* determines whether SBR data is allocated for the gives element */ | ||
428 | uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS]; | ||
429 | |||
430 | sbr_info *sbr[MAX_SYNTAX_ELEMENTS]; | ||
431 | #endif | ||
432 | #if (defined(PS_DEC) || defined(DRM_PS)) | ||
433 | uint8_t ps_used[MAX_SYNTAX_ELEMENTS]; | ||
434 | uint8_t ps_used_global; | ||
435 | #endif | ||
436 | |||
437 | #ifdef SSR_DEC | ||
438 | real_t *ssr_overlap[MAX_CHANNELS]; | ||
439 | real_t *prev_fmd[MAX_CHANNELS]; | ||
440 | real_t ipqf_buffer[MAX_CHANNELS][4][96/4]; | ||
441 | #endif | ||
442 | |||
443 | #ifdef MAIN_DEC | ||
444 | pred_state *pred_stat[MAX_CHANNELS]; | ||
445 | #endif | ||
446 | #ifdef LTP_DEC | ||
447 | int16_t *lt_pred_stat[MAX_CHANNELS]; | ||
448 | #endif | ||
449 | |||
450 | /* Program Config Element */ | ||
451 | uint8_t pce_set; | ||
452 | program_config pce; | ||
453 | uint8_t element_id[MAX_CHANNELS]; | ||
454 | uint8_t internal_channel[MAX_CHANNELS]; | ||
455 | |||
456 | /* Configuration data */ | ||
457 | NeAACDecConfiguration config; | ||
458 | |||
459 | #ifdef PROFILE | ||
460 | int64_t cycles; | ||
461 | int64_t spectral_cycles; | ||
462 | int64_t output_cycles; | ||
463 | int64_t scalefac_cycles; | ||
464 | int64_t requant_cycles; | ||
465 | #endif | ||
466 | } NeAACDecStruct, *NeAACDecHandle; | ||
467 | |||
468 | |||
469 | |||
470 | #ifdef __cplusplus | ||
471 | } | ||
472 | #endif | ||
473 | #endif | ||