annotate Input/aac/libfaad2/sbr_e_nf.c @ 22:696f87ed66e2 trunk

[svn] More GCC retardation
author nenolod
date Mon, 24 Oct 2005 20:25:00 -0700
parents 6efb9e514224
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
1 /*
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
3 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
4 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
5 ** This program is free software; you can redistribute it and/or modify
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
6 ** it under the terms of the GNU General Public License as published by
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
7 ** the Free Software Foundation; either version 2 of the License, or
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
8 ** (at your option) any later version.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
9 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
10 ** This program is distributed in the hope that it will be useful,
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
13 ** GNU General Public License for more details.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
14 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
15 ** You should have received a copy of the GNU General Public License
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
16 ** along with this program; if not, write to the Free Software
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
18 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
19 ** Any non-GPL usage of this software or parts of this software is strictly
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
20 ** forbidden.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
21 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
22 ** Commercial non-GPL licensing of this software is possible.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
24 **
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
25 ** $Id: sbr_e_nf.c,v 1.9 2003/11/14 15:15:51 menno Exp $
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
26 **/
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
27
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
28 #include "common.h"
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
29 #include "structs.h"
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
30
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
31 #ifdef SBR_DEC
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
32
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
33 #include <stdlib.h>
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
34
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
35 #include "sbr_syntax.h"
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
36 #include "sbr_e_nf.h"
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
37
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
38 void extract_envelope_data(sbr_info *sbr, uint8_t ch)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
39 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
40 uint8_t l, k;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
41
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
42 for (l = 0; l < sbr->L_E[ch]; l++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
43 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
44 if (sbr->bs_df_env[ch][l] == 0)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
45 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
46 for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
47 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
48 sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
49 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
50
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
51 } else { /* bs_df_env == 1 */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
52
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
53 uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
54 int16_t E_prev;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
55
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
56 if (sbr->f[ch][l] == g)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
57 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
58 for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
59 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
60 if (l == 0)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
61 E_prev = sbr->E_prev[ch][k];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
62 else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
63 E_prev = sbr->E[ch][k][l - 1];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
64
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
65 sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
66 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
67
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
68 } else if ((g == 1) && (sbr->f[ch][l] == 0)) {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
69 uint8_t i;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
70
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
71 for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
72 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
73 for (i = 0; i < sbr->N_high; i++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
74 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
75 if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k])
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
76 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
77 if (l == 0)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
78 E_prev = sbr->E_prev[ch][i];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
79 else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
80 E_prev = sbr->E[ch][i][l - 1];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
81
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
82 sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
83 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
84 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
85 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
86
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
87 } else if ((g == 0) && (sbr->f[ch][l] == 1)) {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
88 uint8_t i;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
89
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
90 for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
91 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
92 for (i = 0; i < sbr->N_low; i++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
93 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
94 if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) &&
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
95 (sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1]))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
96 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
97 if (l == 0)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
98 E_prev = sbr->E_prev[ch][i];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
99 else
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
100 E_prev = sbr->E[ch][i][l - 1];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
101
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
102 sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
103 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
104 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
105 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
106 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
107 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
108 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
109 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
110
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
111 void extract_noise_floor_data(sbr_info *sbr, uint8_t ch)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
112 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
113 uint8_t l, k;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
114
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
115 for (l = 0; l < sbr->L_Q[ch]; l++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
116 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
117 if (sbr->bs_df_noise[ch][l] == 0)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
118 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
119 for (k = 1; k < sbr->N_Q; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
120 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
121 sbr->Q[ch][k][l] = sbr->Q[ch][k][l] + sbr->Q[ch][k-1][l];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
122 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
123 } else {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
124 if (l == 0)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
125 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
126 for (k = 0; k < sbr->N_Q; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
127 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
128 sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
129 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
130 } else {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
131 for (k = 0; k < sbr->N_Q; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
132 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
133 sbr->Q[ch][k][l] = sbr->Q[ch][k][l - 1] + sbr->Q[ch][k][l];
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
134 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
135 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
136 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
137 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
138 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
139
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
140 /* FIXME: pow() not needed */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
141 void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
142 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
143 if (sbr->bs_coupling == 0)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
144 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
145 uint8_t l, k;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
146 real_t amp = (sbr->amp_res[ch]) ? 1.0f : 0.5f;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
147
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
148 for (l = 0; l < sbr->L_E[ch]; l++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
149 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
150 for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
151 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
152 /* +6 for the *64 */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
153 sbr->E_orig[ch][k][l] = (real_t)pow(2, sbr->E[ch][k][l]*amp + 6);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
154 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
155 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
156
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
157 for (l = 0; l < sbr->L_Q[ch]; l++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
158 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
159 for (k = 0; k < sbr->N_Q; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
160 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
161 if (sbr->Q[ch][k][l] < 0 || sbr->Q[ch][k][l] > 30)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
162 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
163 sbr->Q_orig[ch][k][l] = 0;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
164 } else {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
165 sbr->Q_orig[ch][k][l] = (real_t)pow(2, NOISE_FLOOR_OFFSET - sbr->Q[ch][k][l]);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
166 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
167 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
168 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
169 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
170 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
171
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
172 void unmap_envelope_noise(sbr_info *sbr)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
173 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
174 uint8_t l, k;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
175 real_t amp0 = (sbr->amp_res[0]) ? (real_t)1.0 : (real_t)0.5;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
176 real_t amp1 = (sbr->amp_res[1]) ? (real_t)1.0 : (real_t)0.5;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
177
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
178 for (l = 0; l < sbr->L_E[0]; l++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
179 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
180 for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
181 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
182 real_t l_temp, r_temp;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
183
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
184 /* +6: * 64 ; +1: * 2 */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
185 l_temp = (real_t)pow(2, sbr->E[0][k][l]*amp0 + 7);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
186 /* UN_MAP removed: (x / 4096) same as (x >> 12) */
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
187 r_temp = (real_t)pow(2, sbr->E[1][k][l]*amp1 - 12);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
188
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
189 sbr->E_orig[1][k][l] = l_temp / ((real_t)1.0 + r_temp);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
190 sbr->E_orig[0][k][l] = MUL_R(r_temp, sbr->E_orig[1][k][l]);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
191 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
192 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
193 for (l = 0; l < sbr->L_Q[0]; l++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
194 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
195 for (k = 0; k < sbr->N_Q; k++)
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
196 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
197 if ((sbr->Q[0][k][l] < 0 || sbr->Q[0][k][l] > 30) ||
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
198 (sbr->Q[1][k][l] < 0 || sbr->Q[1][k][l] > 24 /* 2*panOffset(1) */))
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
199 {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
200 sbr->Q_orig[0][k][l] = 0;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
201 sbr->Q_orig[1][k][l] = 0;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
202 } else {
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
203 real_t l_temp, r_temp;
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
204
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
205 l_temp = (real_t)pow(2.0, NOISE_FLOOR_OFFSET - sbr->Q[0][k][l] + 1);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
206 r_temp = (real_t)pow(2.0, sbr->Q[1][k][l] - 12);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
207
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
208 sbr->Q_orig[1][k][l] = l_temp / ((real_t)1.0 + r_temp);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
209 sbr->Q_orig[0][k][l] = MUL_R(r_temp, sbr->Q_orig[1][k][l]);
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
210 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
211 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
212 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
213 }
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
214
6efb9e514224 [svn] Import AAC stuff.
nenolod
parents:
diff changeset
215 #endif