Mercurial > audlegacy
comparison Plugins/Input/aac/libfaad2/sbr_dec.h @ 1021:1e6c0a3f2d15 trunk
[svn] - 2.1 beta
author | nenolod |
---|---|
date | Wed, 10 May 2006 14:44:20 -0700 |
parents | 29feaace84d0 |
children | f12d7e208b43 |
comparison
equal
deleted
inserted
replaced
1020:d70514b3b436 | 1021:1e6c0a3f2d15 |
---|---|
1 /* | 1 /* |
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding | 2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding |
3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com | 3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com |
4 ** | 4 ** |
5 ** This program is free software; you can redistribute it and/or modify | 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 | 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 | 7 ** the Free Software Foundation; either version 2 of the License, or |
8 ** (at your option) any later version. | 8 ** (at your option) any later version. |
9 ** | 9 ** |
10 ** This program is distributed in the hope that it will be useful, | 10 ** This program is distributed in the hope that it will be useful, |
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 ** GNU General Public License for more details. | 13 ** GNU General Public License for more details. |
14 ** | 14 ** |
15 ** You should have received a copy of the GNU General Public License | 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 | 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. | 17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 ** | 18 ** |
19 ** Any non-GPL usage of this software or parts of this software is strictly | 19 ** Any non-GPL usage of this software or parts of this software is strictly |
20 ** forbidden. | 20 ** forbidden. |
21 ** | 21 ** |
22 ** Commercial non-GPL licensing of this software is possible. | 22 ** Commercial non-GPL licensing of this software is possible. |
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
24 ** | 24 ** |
25 ** $Id: sbr_dec.h,v 1.23 2004/02/04 20:07:24 menno Exp $ | 25 ** $Id: sbr_dec.h,v 1.35 2004/09/04 14:56:28 menno Exp $ |
26 **/ | 26 **/ |
27 | 27 |
28 #ifndef __SBR_DEC_H__ | 28 #ifndef __SBR_DEC_H__ |
29 #define __SBR_DEC_H__ | 29 #define __SBR_DEC_H__ |
30 | 30 |
41 | 41 |
42 /* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */ | 42 /* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */ |
43 #define MAX_NTSRHFG 40 | 43 #define MAX_NTSRHFG 40 |
44 #define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */ | 44 #define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */ |
45 | 45 |
46 /* MAX_M: maximum value for M */ | |
47 #define MAX_M 49 | |
48 /* MAX_L_E: maximum value for L_E */ | |
49 #define MAX_L_E 5 | |
46 | 50 |
47 typedef struct { | 51 typedef struct { |
48 real_t *x; | 52 real_t *x; |
53 int16_t x_index; | |
49 uint8_t channels; | 54 uint8_t channels; |
50 } qmfa_info; | 55 } qmfa_info; |
51 | 56 |
52 typedef struct { | 57 typedef struct { |
53 real_t *v[2]; | 58 real_t *v; |
54 uint8_t v_index; | 59 int16_t v_index; |
55 uint8_t channels; | 60 uint8_t channels; |
56 #ifdef USE_SSE | |
57 void (*qmf_func)(void *a, void *b, void *c, void *d); | |
58 #endif | |
59 } qmfs_info; | 61 } qmfs_info; |
60 | 62 |
61 typedef struct | 63 typedef struct |
62 { | 64 { |
63 uint32_t sample_rate; | 65 uint32_t sample_rate; |
66 uint32_t maxAACLine; | |
64 | 67 |
65 uint8_t rate; | 68 uint8_t rate; |
66 uint8_t just_seeked; | 69 uint8_t just_seeked; |
67 uint8_t ret; | 70 uint8_t ret; |
68 | 71 |
96 | 99 |
97 uint8_t L_E[2]; | 100 uint8_t L_E[2]; |
98 uint8_t L_E_prev[2]; | 101 uint8_t L_E_prev[2]; |
99 uint8_t L_Q[2]; | 102 uint8_t L_Q[2]; |
100 | 103 |
101 uint8_t t_E[2][6]; | 104 uint8_t t_E[2][MAX_L_E+1]; |
102 uint8_t t_Q[2][3]; | 105 uint8_t t_Q[2][3]; |
103 uint8_t f[2][6]; | 106 uint8_t f[2][MAX_L_E+1]; |
104 uint8_t f_prev[2]; | 107 uint8_t f_prev[2]; |
105 | 108 |
106 real_t *G_temp_prev[2][5]; | 109 real_t *G_temp_prev[2][5]; |
107 real_t *Q_temp_prev[2][5]; | 110 real_t *Q_temp_prev[2][5]; |
108 | 111 int8_t GQ_ringbuf_index[2]; |
109 int16_t E[2][64][5]; | 112 |
113 int16_t E[2][64][MAX_L_E]; | |
110 int16_t E_prev[2][64]; | 114 int16_t E_prev[2][64]; |
111 real_t E_orig[2][64][5]; | 115 #ifndef FIXED_POINT |
112 real_t E_curr[2][64][5]; | 116 real_t E_orig[2][64][MAX_L_E]; |
117 #endif | |
118 real_t E_curr[2][64][MAX_L_E]; | |
113 int32_t Q[2][64][2]; | 119 int32_t Q[2][64][2]; |
120 #ifndef FIXED_POINT | |
121 real_t Q_div[2][64][2]; | |
122 real_t Q_div2[2][64][2]; | |
123 #endif | |
114 int32_t Q_prev[2][64]; | 124 int32_t Q_prev[2][64]; |
115 real_t Q_orig[2][64][2]; | |
116 | 125 |
117 int8_t l_A[2]; | 126 int8_t l_A[2]; |
118 int8_t l_A_prev[2]; | 127 int8_t l_A_prev[2]; |
119 | 128 |
120 uint8_t bs_invf_mode[2][5]; | 129 uint8_t bs_invf_mode[2][MAX_L_E]; |
121 uint8_t bs_invf_mode_prev[2][5]; | 130 uint8_t bs_invf_mode_prev[2][MAX_L_E]; |
122 real_t bwArray[2][64]; | 131 real_t bwArray[2][64]; |
123 real_t bwArray_prev[2][64]; | 132 real_t bwArray_prev[2][64]; |
124 | 133 |
125 uint8_t noPatches; | 134 uint8_t noPatches; |
126 uint8_t patchNoSubbands[64]; | 135 uint8_t patchNoSubbands[64]; |
140 uint8_t bs_noise_bands_prev; | 149 uint8_t bs_noise_bands_prev; |
141 | 150 |
142 int8_t prevEnvIsShort[2]; | 151 int8_t prevEnvIsShort[2]; |
143 | 152 |
144 int8_t kx_prev; | 153 int8_t kx_prev; |
154 uint8_t bsco; | |
155 uint8_t bsco_prev; | |
156 uint8_t M_prev; | |
157 uint16_t frame_len; | |
145 | 158 |
146 uint8_t Reset; | 159 uint8_t Reset; |
147 uint32_t frame; | 160 uint32_t frame; |
148 uint32_t header_count; | 161 uint32_t header_count; |
149 | 162 |
150 uint8_t id_aac; | 163 uint8_t id_aac; |
151 qmfa_info *qmfa[2]; | 164 qmfa_info *qmfa[2]; |
152 qmfs_info *qmfs[2]; | 165 qmfs_info *qmfs[2]; |
153 | 166 |
154 qmf_t Xsbr[2][MAX_NTSRHFG][64]; | 167 qmf_t Xsbr[2][MAX_NTSRHFG][64]; |
155 qmf_t Xcodec[2][MAX_NTSRHFG][32]; | |
156 | 168 |
157 #ifdef DRM | 169 #ifdef DRM |
158 int8_t lcstereo_flag; | |
159 uint8_t bs_dataextra; | |
160 uint8_t Is_DRM_SBR; | 170 uint8_t Is_DRM_SBR; |
161 #ifdef DRM_PS | 171 #ifdef DRM_PS |
162 drm_ps_info drm_ps; | 172 drm_ps_info *drm_ps; |
163 #endif | 173 #endif |
164 #endif | 174 #endif |
165 | 175 |
166 uint8_t numTimeSlotsRate; | 176 uint8_t numTimeSlotsRate; |
167 uint8_t numTimeSlots; | 177 uint8_t numTimeSlots; |
168 uint8_t tHFGen; | 178 uint8_t tHFGen; |
169 uint8_t tHFAdj; | 179 uint8_t tHFAdj; |
170 | 180 |
171 #ifdef PS_DEC | 181 #ifdef PS_DEC |
172 ps_info ps; | 182 ps_info *ps; |
173 #endif | 183 #endif |
174 #if (defined(PS_DEC) || defined(DRM_PS)) | 184 #if (defined(PS_DEC) || defined(DRM_PS)) |
175 uint8_t ps_used; | 185 uint8_t ps_used; |
176 #endif | 186 #endif |
177 | 187 |
213 uint8_t bs_df_env[2][9]; | 223 uint8_t bs_df_env[2][9]; |
214 uint8_t bs_df_noise[2][3]; | 224 uint8_t bs_df_noise[2][3]; |
215 } sbr_info; | 225 } sbr_info; |
216 | 226 |
217 sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, | 227 sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, |
218 uint32_t sample_rate | 228 uint32_t sample_rate, uint8_t downSampledSBR |
219 #ifdef DRM | 229 #ifdef DRM |
220 , uint8_t IsDRM | 230 , uint8_t IsDRM |
221 #endif | 231 #endif |
222 ); | 232 ); |
223 void sbrDecodeEnd(sbr_info *sbr); | 233 void sbrDecodeEnd(sbr_info *sbr); |
224 | 234 |
225 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, | 235 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, |
226 const uint8_t just_seeked, const uint8_t upsample_only); | 236 const uint8_t just_seeked, const uint8_t downSampledSBR); |
227 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, | 237 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, |
228 const uint8_t just_seeked, const uint8_t upsample_only); | 238 const uint8_t just_seeked, const uint8_t downSampledSBR); |
229 #if (defined(PS_DEC) || defined(DRM_PS)) | 239 #if (defined(PS_DEC) || defined(DRM_PS)) |
230 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, | 240 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, |
231 const uint8_t just_seeked, const uint8_t upsample_only); | 241 const uint8_t just_seeked, const uint8_t downSampledSBR); |
232 #endif | 242 #endif |
233 | 243 |
234 | 244 |
235 #ifdef __cplusplus | 245 #ifdef __cplusplus |
236 } | 246 } |