annotate libfaad2/sbr_e_nf.c @ 11886:0d60e54ce395

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