2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3 ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
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.
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.
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.
19 ** Any non-GPL usage of this software or parts of this software is strictly
22 ** The "appropriate copyright message" mentioned in section 2c of the GPLv2
23 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
25 ** Commercial non-GPL licensing of this software is possible.
26 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
28 ** $Id: structs.h,v 1.49 2009/01/26 23:51:15 menno Exp $
43 #define MAX_CHANNELS 64
44 #define MAX_SYNTAX_ELEMENTS 48
45 #define MAX_WINDOW_GROUPS 8
47 #define MAX_LTP_SFB 40
48 #define MAX_LTP_SFB_S 8
50 /* used to save the prediction state */
69 const real_t *long_window[2];
70 const real_t *short_window[2];
72 const real_t *ld_window[2];
90 uint8_t pce_instance_tag;
91 uint8_t excluded_chns_present;
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[MAX_CHANNELS];
97 uint8_t additional_excluded_chns[MAX_CHANNELS];
105 uint8_t element_instance_tag;
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];
134 uint8_t comment_field_bytes;
135 uint8_t comment_field_data[257];
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];
151 uint8_t protection_absent;
155 uint8_t channel_configuration;
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;
172 uint8_t copyright_id_present;
173 int8_t copyright_id[10];
174 uint8_t original_copy;
176 uint8_t bitstream_type;
178 uint8_t num_program_config_elements;
179 uint32_t adif_buffer_fullness;
181 /* maximum of 16 PCEs */
182 program_config pce[16];
189 uint8_t data_present;
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];
204 uint8_t predictor_reset;
205 uint8_t predictor_reset_group_number;
206 uint8_t prediction_used[MAX_SFB];
212 uint8_t number_pulse;
213 uint8_t pulse_start_sfb;
214 uint8_t pulse_offset[4];
215 uint8_t pulse_amp[4];
222 uint8_t length[8][4];
224 uint8_t direction[8][4];
225 uint8_t coef_compress[8][4];
226 uint8_t coef[8][4][32];
234 uint8_t adjust_num[4][8];
235 uint8_t alevcode[4][8][8];
236 uint8_t aloccode[4][8][8];
245 uint8_t num_window_groups;
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 uint16_t swb_offset_max;
255 uint8_t sect_cb[8][15*8];
256 uint16_t sect_start[8][15*8];
257 uint16_t sect_end[8][15*8];
258 uint8_t sfb_cb[8][8*15];
259 uint8_t num_sec[8]; /* number of sections in a group */
262 int16_t scale_factors[8][51]; /* [0..255] */
264 uint8_t ms_mask_present;
265 uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB];
270 uint8_t pulse_data_present;
271 uint8_t tns_data_present;
272 uint8_t gain_control_data_present;
273 uint8_t predictor_data_present;
288 #ifdef ERROR_RESILIENCE
290 uint16_t length_of_reordered_spectral_data;
291 uint8_t length_of_longest_codeword;
293 uint8_t sf_concealment;
294 uint8_t rev_global_gain;
295 uint16_t length_of_rvlc_sf;
296 uint16_t dpcm_noise_nrg;
297 uint8_t sf_escapes_present;
298 uint8_t length_of_rvlc_escapes;
299 uint16_t dpcm_noise_last_position;
301 } ic_stream; /* individual channel stream */
306 int16_t paired_channel;
308 uint8_t element_instance_tag;
309 uint8_t common_window;
313 } element; /* syntax element (SCE, CPE, LFE) */
315 #define MAX_ASC_BYTES 64
318 int version, versionA;
320 int useSameStreamMux;
321 int allStreamsSameTimeFraming;
325 int otherDataPresent;
326 uint32_t otherDataLenBits;
327 uint32_t frameLength;
328 uint8_t ASC[MAX_ASC_BYTES];
334 uint8_t adts_header_present;
335 uint8_t adif_header_present;
336 uint8_t latm_header_present;
339 uint8_t channelConfiguration;
340 #ifdef ERROR_RESILIENCE
341 uint8_t aacSectionDataResilienceFlag;
342 uint8_t aacScalefactorDataResilienceFlag;
343 uint8_t aacSpectralDataResilienceFlag;
345 uint16_t frameLength;
346 uint8_t postSeekResetFlag;
352 uint8_t first_syn_ele;
354 /* number of channels in current frame */
356 /* number of elements in current frame */
359 /* element_output_channels:
360 determines the number of channels the element will output
362 uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS];
364 determines whether the data needed for the element is allocated or not
366 uint8_t element_alloced[MAX_SYNTAX_ELEMENTS];
368 determines the number of channels where output data is allocated for
370 uint8_t alloced_channels;
372 /* output data buffer */
375 uint8_t window_shape_prev[MAX_CHANNELS];
377 uint16_t ltp_lag[MAX_CHANNELS];
382 real_t *time_out[MAX_CHANNELS];
383 real_t *fb_intermed[MAX_CHANNELS];
386 int8_t sbr_present_flag;
387 int8_t forceUpSampling;
388 int8_t downSampledSBR;
389 /* determines whether SBR data is allocated for the gives element */
390 uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS];
392 sbr_info *sbr[MAX_SYNTAX_ELEMENTS];
394 #if (defined(PS_DEC) || defined(DRM_PS))
395 uint8_t ps_used[MAX_SYNTAX_ELEMENTS];
396 uint8_t ps_used_global;
400 real_t *ssr_overlap[MAX_CHANNELS];
401 real_t *prev_fmd[MAX_CHANNELS];
402 real_t ipqf_buffer[MAX_CHANNELS][4][96/4];
406 pred_state *pred_stat[MAX_CHANNELS];
409 int16_t *lt_pred_stat[MAX_CHANNELS];
420 /* Program Config Element */
423 uint8_t element_id[MAX_CHANNELS];
424 uint8_t internal_channel[MAX_CHANNELS];
426 /* Configuration data */
427 NeAACDecConfiguration config;
431 int64_t spectral_cycles;
432 int64_t output_cycles;
433 int64_t scalefac_cycles;
434 int64_t requant_cycles;
436 latm_header latm_config;
437 const unsigned char *cmes;