comparison Plugins/Input/aac/libfaad2/sbr_dec.h @ 1010:29feaace84d0 trunk

[svn] - synchronize audacious-faad with FAAD2 CVS.
author nenolod
date Mon, 08 May 2006 06:56:47 -0700
parents 0a2ad94e8607
children 1e6c0a3f2d15
comparison
equal deleted inserted replaced
1009:1008da26c12d 1010:29feaace84d0
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.35 2004/09/04 14:56:28 menno Exp $ 25 ** $Id: sbr_dec.h,v 1.23 2004/02/04 20:07:24 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
50 46
51 typedef struct { 47 typedef struct {
52 real_t *x; 48 real_t *x;
53 int16_t x_index;
54 uint8_t channels; 49 uint8_t channels;
55 } qmfa_info; 50 } qmfa_info;
56 51
57 typedef struct { 52 typedef struct {
58 real_t *v; 53 real_t *v[2];
59 int16_t v_index; 54 uint8_t v_index;
60 uint8_t channels; 55 uint8_t channels;
56 #ifdef USE_SSE
57 void (*qmf_func)(void *a, void *b, void *c, void *d);
58 #endif
61 } qmfs_info; 59 } qmfs_info;
62 60
63 typedef struct 61 typedef struct
64 { 62 {
65 uint32_t sample_rate; 63 uint32_t sample_rate;
66 uint32_t maxAACLine;
67 64
68 uint8_t rate; 65 uint8_t rate;
69 uint8_t just_seeked; 66 uint8_t just_seeked;
70 uint8_t ret; 67 uint8_t ret;
71 68
99 96
100 uint8_t L_E[2]; 97 uint8_t L_E[2];
101 uint8_t L_E_prev[2]; 98 uint8_t L_E_prev[2];
102 uint8_t L_Q[2]; 99 uint8_t L_Q[2];
103 100
104 uint8_t t_E[2][MAX_L_E+1]; 101 uint8_t t_E[2][6];
105 uint8_t t_Q[2][3]; 102 uint8_t t_Q[2][3];
106 uint8_t f[2][MAX_L_E+1]; 103 uint8_t f[2][6];
107 uint8_t f_prev[2]; 104 uint8_t f_prev[2];
108 105
109 real_t *G_temp_prev[2][5]; 106 real_t *G_temp_prev[2][5];
110 real_t *Q_temp_prev[2][5]; 107 real_t *Q_temp_prev[2][5];
111 int8_t GQ_ringbuf_index[2]; 108
112 109 int16_t E[2][64][5];
113 int16_t E[2][64][MAX_L_E];
114 int16_t E_prev[2][64]; 110 int16_t E_prev[2][64];
115 #ifndef FIXED_POINT 111 real_t E_orig[2][64][5];
116 real_t E_orig[2][64][MAX_L_E]; 112 real_t E_curr[2][64][5];
117 #endif
118 real_t E_curr[2][64][MAX_L_E];
119 int32_t Q[2][64][2]; 113 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
124 int32_t Q_prev[2][64]; 114 int32_t Q_prev[2][64];
115 real_t Q_orig[2][64][2];
125 116
126 int8_t l_A[2]; 117 int8_t l_A[2];
127 int8_t l_A_prev[2]; 118 int8_t l_A_prev[2];
128 119
129 uint8_t bs_invf_mode[2][MAX_L_E]; 120 uint8_t bs_invf_mode[2][5];
130 uint8_t bs_invf_mode_prev[2][MAX_L_E]; 121 uint8_t bs_invf_mode_prev[2][5];
131 real_t bwArray[2][64]; 122 real_t bwArray[2][64];
132 real_t bwArray_prev[2][64]; 123 real_t bwArray_prev[2][64];
133 124
134 uint8_t noPatches; 125 uint8_t noPatches;
135 uint8_t patchNoSubbands[64]; 126 uint8_t patchNoSubbands[64];
149 uint8_t bs_noise_bands_prev; 140 uint8_t bs_noise_bands_prev;
150 141
151 int8_t prevEnvIsShort[2]; 142 int8_t prevEnvIsShort[2];
152 143
153 int8_t kx_prev; 144 int8_t kx_prev;
154 uint8_t bsco;
155 uint8_t bsco_prev;
156 uint8_t M_prev;
157 uint16_t frame_len;
158 145
159 uint8_t Reset; 146 uint8_t Reset;
160 uint32_t frame; 147 uint32_t frame;
161 uint32_t header_count; 148 uint32_t header_count;
162 149
163 uint8_t id_aac; 150 uint8_t id_aac;
164 qmfa_info *qmfa[2]; 151 qmfa_info *qmfa[2];
165 qmfs_info *qmfs[2]; 152 qmfs_info *qmfs[2];
166 153
167 qmf_t Xsbr[2][MAX_NTSRHFG][64]; 154 qmf_t Xsbr[2][MAX_NTSRHFG][64];
155 qmf_t Xcodec[2][MAX_NTSRHFG][32];
168 156
169 #ifdef DRM 157 #ifdef DRM
158 int8_t lcstereo_flag;
159 uint8_t bs_dataextra;
170 uint8_t Is_DRM_SBR; 160 uint8_t Is_DRM_SBR;
171 #ifdef DRM_PS 161 #ifdef DRM_PS
172 drm_ps_info *drm_ps; 162 drm_ps_info drm_ps;
173 #endif 163 #endif
174 #endif 164 #endif
175 165
176 uint8_t numTimeSlotsRate; 166 uint8_t numTimeSlotsRate;
177 uint8_t numTimeSlots; 167 uint8_t numTimeSlots;
178 uint8_t tHFGen; 168 uint8_t tHFGen;
179 uint8_t tHFAdj; 169 uint8_t tHFAdj;
180 170
181 #ifdef PS_DEC 171 #ifdef PS_DEC
182 ps_info *ps; 172 ps_info ps;
183 #endif 173 #endif
184 #if (defined(PS_DEC) || defined(DRM_PS)) 174 #if (defined(PS_DEC) || defined(DRM_PS))
185 uint8_t ps_used; 175 uint8_t ps_used;
186 #endif 176 #endif
187 177
223 uint8_t bs_df_env[2][9]; 213 uint8_t bs_df_env[2][9];
224 uint8_t bs_df_noise[2][3]; 214 uint8_t bs_df_noise[2][3];
225 } sbr_info; 215 } sbr_info;
226 216
227 sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, 217 sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
228 uint32_t sample_rate, uint8_t downSampledSBR 218 uint32_t sample_rate
229 #ifdef DRM 219 #ifdef DRM
230 , uint8_t IsDRM 220 , uint8_t IsDRM
231 #endif 221 #endif
232 ); 222 );
233 void sbrDecodeEnd(sbr_info *sbr); 223 void sbrDecodeEnd(sbr_info *sbr);
234 224
235 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, 225 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
236 const uint8_t just_seeked, const uint8_t downSampledSBR); 226 const uint8_t just_seeked, const uint8_t upsample_only);
237 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, 227 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
238 const uint8_t just_seeked, const uint8_t downSampledSBR); 228 const uint8_t just_seeked, const uint8_t upsample_only);
239 #if (defined(PS_DEC) || defined(DRM_PS)) 229 #if (defined(PS_DEC) || defined(DRM_PS))
240 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, 230 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
241 const uint8_t just_seeked, const uint8_t downSampledSBR); 231 const uint8_t just_seeked, const uint8_t upsample_only);
242 #endif 232 #endif
243 233
244 234
245 #ifdef __cplusplus 235 #ifdef __cplusplus
246 } 236 }