2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software 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 ** Commercial non-GPL licensing of this software is possible.
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
42 #define MAX_NTSRHFG 40 /* maximum of number_time_slots * rate + HFGen. 16*2+8 */
43 #define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
45 /* MAX_M: maximum value for M */
47 /* MAX_L_E: maximum value for L_E */
56 real_t v
[2*64*20]; /* Size was "(downSampledSBR)?32:64". We use 64 now. */
82 uint8_t f_table_res
[2][64];
83 uint8_t f_table_noise
[64];
84 uint8_t f_table_lim
[4][64];
86 uint8_t f_group
[5][64];
90 uint8_t table_map_k_to_g
[64];
92 uint8_t abs_bord_lead
[2];
93 uint8_t abs_bord_trail
[2];
94 uint8_t n_rel_lead
[2];
95 uint8_t n_rel_trail
[2];
101 uint8_t t_E
[2][MAX_L_E
+1];
103 uint8_t f
[2][MAX_L_E
+1];
106 real_t G_temp_prev
[2][5][64];
107 real_t Q_temp_prev
[2][5][64];
108 int8_t GQ_ringbuf_index
[2];
110 int16_t E
[2][64][MAX_L_E
];
111 int16_t E_prev
[2][64];
113 real_t E_orig
[2][64][MAX_L_E
];
115 real_t E_curr
[2][64][MAX_L_E
];
118 real_t Q_div
[2][64][2];
119 real_t Q_div2
[2][64][2];
121 int32_t Q_prev
[2][64];
126 uint8_t bs_invf_mode
[2][MAX_L_E
];
127 uint8_t bs_invf_mode_prev
[2][MAX_L_E
];
128 real_t bwArray
[2][64];
129 real_t bwArray_prev
[2][64];
132 uint8_t patchNoSubbands
[64];
133 uint8_t patchStartSubband
[64];
135 uint8_t bs_add_harmonic
[2][64];
136 uint8_t bs_add_harmonic_prev
[2][64];
138 uint16_t index_noise_prev
[2];
139 uint8_t psi_is_prev
[2];
141 uint8_t bs_start_freq_prev
;
142 uint8_t bs_stop_freq_prev
;
143 uint8_t bs_xover_band_prev
;
144 uint8_t bs_freq_scale_prev
;
145 uint8_t bs_alter_scale_prev
;
146 uint8_t bs_noise_bands_prev
;
148 int8_t prevEnvIsShort
[2];
158 uint32_t header_count
;
161 qmfa_info qmfa
[2] MEM_ALIGN_ATTR
;
162 qmfs_info qmfs
[2] MEM_ALIGN_ATTR
;
164 qmf_t Xsbr
[2][MAX_NTSRHFG
][64] MEM_ALIGN_ATTR
;
173 uint8_t numTimeSlotsRate
;
174 uint8_t numTimeSlots
;
181 #if (defined(PS_DEC) || defined(DRM_PS))
185 /* to get it compiling */
186 /* we'll see during the coding of all the tools, whether
187 these are all used or not.
189 uint8_t bs_header_flag
;
191 uint16_t bs_sbr_crc_bits
;
192 uint8_t bs_protocol_version
;
194 uint8_t bs_start_freq
;
195 uint8_t bs_stop_freq
;
196 uint8_t bs_xover_band
;
197 uint8_t bs_freq_scale
;
198 uint8_t bs_alter_scale
;
199 uint8_t bs_noise_bands
;
200 uint8_t bs_limiter_bands
;
201 uint8_t bs_limiter_gains
;
202 uint8_t bs_interpol_freq
;
203 uint8_t bs_smoothing_mode
;
204 uint8_t bs_samplerate_mode
;
205 uint8_t bs_add_harmonic_flag
[2];
206 uint8_t bs_add_harmonic_flag_prev
[2];
207 uint8_t bs_extended_data
;
208 uint8_t bs_extension_id
;
209 uint8_t bs_extension_data
;
211 uint8_t bs_frame_class
[2];
212 uint8_t bs_rel_bord
[2][9];
213 uint8_t bs_rel_bord_0
[2][9];
214 uint8_t bs_rel_bord_1
[2][9];
215 uint8_t bs_pointer
[2];
216 uint8_t bs_abs_bord_0
[2];
217 uint8_t bs_abs_bord_1
[2];
218 uint8_t bs_num_rel_0
[2];
219 uint8_t bs_num_rel_1
[2];
220 uint8_t bs_df_env
[2][9];
221 uint8_t bs_df_noise
[2][3];
224 sbr_info
*sbrDecodeInit(uint16_t framelength
, uint8_t id_aac
, uint8_t id_ele
,
225 uint32_t sample_rate
, uint8_t downSampledSBR
231 uint8_t sbrDecodeCoupleFrame(sbr_info
*sbr
, real_t
*left_chan
, real_t
*right_chan
,
232 const uint8_t just_seeked
, const uint8_t downSampledSBR
);
233 uint8_t sbrDecodeSingleFrame(sbr_info
*sbr
, real_t
*channel
,
234 const uint8_t just_seeked
, const uint8_t downSampledSBR
);
235 #if (defined(PS_DEC) || defined(DRM_PS))
236 uint8_t sbrDecodeSingleFramePS(sbr_info
*sbr
, real_t
*left_channel
, real_t
*right_channel
,
237 const uint8_t just_seeked
, const uint8_t downSampledSBR
);