Mercurial > mplayer.hg
annotate libfaad2/sbr_dec.h @ 13757:40c44e178073
1.132: MSGTR_EdlCantOpenForWrite updated
1.133: mp_msg transition of unmaintained audio output drivers (referring to date 2004/09/18!)
file isn't yet up to date, will continue updating in steps..
author | kraymer |
---|---|
date | Mon, 25 Oct 2004 16:31:50 +0000 |
parents | 6d50ef45a058 |
children | 2ae5ab4331ca |
rev | line source |
---|---|
10725 | 1 /* |
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding | |
12527 | 3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com |
10725 | 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 ** | |
12625
d81145997036
More information about modifications to comply more closely with GPL 2a.
diego
parents:
12527
diff
changeset
|
25 ** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30 |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
26 ** $Id: sbr_dec.h,v 1.4 2004/06/23 13:50:51 diego Exp $ |
12625
d81145997036
More information about modifications to comply more closely with GPL 2a.
diego
parents:
12527
diff
changeset
|
27 ** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ |
10725 | 28 **/ |
29 | |
30 #ifndef __SBR_DEC_H__ | |
31 #define __SBR_DEC_H__ | |
32 | |
33 #ifdef __cplusplus | |
34 extern "C" { | |
35 #endif | |
36 | |
12527 | 37 #ifdef PS_DEC |
38 #include "ps_dec.h" | |
39 #endif | |
40 #ifdef DRM_PS | |
41 #include "drm_dec.h" | |
42 #endif | |
43 | |
44 /* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */ | |
45 #define MAX_NTSRHFG 40 | |
46 #define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */ | |
47 | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
48 /* MAX_M: maximum value for M */ |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
49 #define MAX_M 49 |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
50 /* MAX_L_E: maximum value for L_E */ |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
51 #define MAX_L_E 5 |
12527 | 52 |
10725 | 53 typedef struct { |
54 real_t *x; | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
55 int16_t x_index; |
10725 | 56 uint8_t channels; |
57 } qmfa_info; | |
58 | |
59 typedef struct { | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
60 real_t *v; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
61 int16_t v_index; |
10725 | 62 uint8_t channels; |
63 } qmfs_info; | |
64 | |
65 typedef struct | |
66 { | |
67 uint32_t sample_rate; | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
68 uint32_t maxAACLine; |
10725 | 69 |
70 uint8_t rate; | |
71 uint8_t just_seeked; | |
12527 | 72 uint8_t ret; |
10725 | 73 |
74 uint8_t amp_res[2]; | |
75 | |
76 uint8_t k0; | |
77 uint8_t kx; | |
78 uint8_t M; | |
79 uint8_t N_master; | |
80 uint8_t N_high; | |
81 uint8_t N_low; | |
82 uint8_t N_Q; | |
83 uint8_t N_L[4]; | |
84 uint8_t n[2]; | |
85 | |
86 uint8_t f_master[64]; | |
87 uint8_t f_table_res[2][64]; | |
88 uint8_t f_table_noise[64]; | |
89 uint8_t f_table_lim[4][64]; | |
90 #ifdef SBR_LOW_POWER | |
91 uint8_t f_group[5][64]; | |
92 uint8_t N_G[5]; | |
93 #endif | |
94 | |
95 uint8_t table_map_k_to_g[64]; | |
96 | |
97 uint8_t abs_bord_lead[2]; | |
98 uint8_t abs_bord_trail[2]; | |
99 uint8_t n_rel_lead[2]; | |
100 uint8_t n_rel_trail[2]; | |
101 | |
102 uint8_t L_E[2]; | |
103 uint8_t L_E_prev[2]; | |
104 uint8_t L_Q[2]; | |
105 | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
106 uint8_t t_E[2][MAX_L_E+1]; |
10725 | 107 uint8_t t_Q[2][3]; |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
108 uint8_t f[2][MAX_L_E+1]; |
10725 | 109 uint8_t f_prev[2]; |
110 | |
111 real_t *G_temp_prev[2][5]; | |
112 real_t *Q_temp_prev[2][5]; | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
113 int8_t GQ_ringbuf_index[2]; |
10725 | 114 |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
115 int16_t E[2][64][MAX_L_E]; |
10725 | 116 int16_t E_prev[2][64]; |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
117 #ifndef FIXED_POINT |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
118 real_t E_orig[2][64][MAX_L_E]; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
119 #endif |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
120 real_t E_curr[2][64][MAX_L_E]; |
10725 | 121 int32_t Q[2][64][2]; |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
122 #ifndef FIXED_POINT |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
123 real_t Q_div[2][64][2]; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
124 real_t Q_div2[2][64][2]; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
125 #endif |
10725 | 126 int32_t Q_prev[2][64]; |
127 | |
128 int8_t l_A[2]; | |
129 int8_t l_A_prev[2]; | |
130 | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
131 uint8_t bs_invf_mode[2][MAX_L_E]; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
132 uint8_t bs_invf_mode_prev[2][MAX_L_E]; |
10725 | 133 real_t bwArray[2][64]; |
134 real_t bwArray_prev[2][64]; | |
135 | |
136 uint8_t noPatches; | |
137 uint8_t patchNoSubbands[64]; | |
138 uint8_t patchStartSubband[64]; | |
139 | |
140 uint8_t bs_add_harmonic[2][64]; | |
141 uint8_t bs_add_harmonic_prev[2][64]; | |
142 | |
143 uint16_t index_noise_prev[2]; | |
144 uint8_t psi_is_prev[2]; | |
145 | |
146 uint8_t bs_start_freq_prev; | |
147 uint8_t bs_stop_freq_prev; | |
148 uint8_t bs_xover_band_prev; | |
149 uint8_t bs_freq_scale_prev; | |
150 uint8_t bs_alter_scale_prev; | |
151 uint8_t bs_noise_bands_prev; | |
152 | |
153 int8_t prevEnvIsShort[2]; | |
154 | |
155 int8_t kx_prev; | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
156 uint8_t bsco; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
157 uint8_t bsco_prev; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
158 uint8_t M_prev; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
159 uint16_t frame_len; |
10725 | 160 |
161 uint8_t Reset; | |
162 uint32_t frame; | |
163 uint32_t header_count; | |
164 | |
165 uint8_t id_aac; | |
166 qmfa_info *qmfa[2]; | |
167 qmfs_info *qmfs[2]; | |
168 | |
12527 | 169 qmf_t Xsbr[2][MAX_NTSRHFG][64]; |
10725 | 170 |
10989 | 171 #ifdef DRM |
172 uint8_t Is_DRM_SBR; | |
12527 | 173 #ifdef DRM_PS |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
174 drm_ps_info *drm_ps; |
12527 | 175 #endif |
10989 | 176 #endif |
177 | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
178 uint8_t numTimeSlotsRate; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
179 uint8_t numTimeSlots; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
180 uint8_t tHFGen; |
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
181 uint8_t tHFAdj; |
10725 | 182 |
12527 | 183 #ifdef PS_DEC |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
184 ps_info *ps; |
12527 | 185 #endif |
186 #if (defined(PS_DEC) || defined(DRM_PS)) | |
187 uint8_t ps_used; | |
188 #endif | |
189 | |
10725 | 190 /* to get it compiling */ |
191 /* we'll see during the coding of all the tools, whether | |
192 these are all used or not. | |
193 */ | |
194 uint8_t bs_header_flag; | |
195 uint8_t bs_crc_flag; | |
196 uint16_t bs_sbr_crc_bits; | |
197 uint8_t bs_protocol_version; | |
198 uint8_t bs_amp_res; | |
199 uint8_t bs_start_freq; | |
200 uint8_t bs_stop_freq; | |
201 uint8_t bs_xover_band; | |
202 uint8_t bs_freq_scale; | |
203 uint8_t bs_alter_scale; | |
204 uint8_t bs_noise_bands; | |
205 uint8_t bs_limiter_bands; | |
206 uint8_t bs_limiter_gains; | |
207 uint8_t bs_interpol_freq; | |
208 uint8_t bs_smoothing_mode; | |
209 uint8_t bs_samplerate_mode; | |
210 uint8_t bs_add_harmonic_flag[2]; | |
211 uint8_t bs_add_harmonic_flag_prev[2]; | |
212 uint8_t bs_extended_data; | |
213 uint8_t bs_extension_id; | |
214 uint8_t bs_extension_data; | |
215 uint8_t bs_coupling; | |
216 uint8_t bs_frame_class[2]; | |
217 uint8_t bs_rel_bord[2][9]; | |
218 uint8_t bs_rel_bord_0[2][9]; | |
219 uint8_t bs_rel_bord_1[2][9]; | |
220 uint8_t bs_pointer[2]; | |
221 uint8_t bs_abs_bord_0[2]; | |
222 uint8_t bs_abs_bord_1[2]; | |
223 uint8_t bs_num_rel_0[2]; | |
224 uint8_t bs_num_rel_1[2]; | |
225 uint8_t bs_df_env[2][9]; | |
226 uint8_t bs_df_noise[2][3]; | |
227 } sbr_info; | |
228 | |
12527 | 229 sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
230 uint32_t sample_rate, uint8_t downSampledSBR |
10989 | 231 #ifdef DRM |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
232 , uint8_t IsDRM |
10989 | 233 #endif |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
234 ); |
10725 | 235 void sbrDecodeEnd(sbr_info *sbr); |
236 | |
12527 | 237 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
238 const uint8_t just_seeked, const uint8_t downSampledSBR); |
12527 | 239 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
240 const uint8_t just_seeked, const uint8_t downSampledSBR); |
12527 | 241 #if (defined(PS_DEC) || defined(DRM_PS)) |
242 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, | |
13453
6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents:
12625
diff
changeset
|
243 const uint8_t just_seeked, const uint8_t downSampledSBR); |
12527 | 244 #endif |
10725 | 245 |
246 | |
247 #ifdef __cplusplus | |
248 } | |
249 #endif | |
250 #endif | |
251 |