annotate libfaad2/sbr_e_nf.c @ 13035:8b823470d1fd

massive sync, rewording, consistency, fixes etc.
author wight
date Tue, 17 Aug 2004 17:51:54 +0000
parents d81145997036
children 6d50ef45a058
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
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
10725
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 **
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
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
26 ** $Id: sbr_e_nf.c,v 1.3 2004/06/02 22:59:03 diego Exp $
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
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
28 **/
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
29
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
30 #include "common.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
31 #include "structs.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
32
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
33 #ifdef SBR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35 #include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
36
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
37 #include "sbr_syntax.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
38 #include "sbr_e_nf.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
39
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
40 ALIGN static const real_t pow2deq[] = {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
41 REAL_CONST(2.9103830456733704E-011), REAL_CONST(5.8207660913467407E-011),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
42 REAL_CONST(1.1641532182693481E-010), REAL_CONST(2.3283064365386963E-010),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
43 REAL_CONST(4.6566128730773926E-010), REAL_CONST(9.3132257461547852E-010),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
44 REAL_CONST(1.862645149230957E-009), REAL_CONST(3.7252902984619141E-009),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
45 REAL_CONST(7.4505805969238281E-009), REAL_CONST(1.4901161193847656E-008),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
46 REAL_CONST(2.9802322387695313E-008), REAL_CONST(5.9604644775390625E-008),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
47 REAL_CONST(1.1920928955078125E-007), REAL_CONST(2.384185791015625E-007),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
48 REAL_CONST(4.76837158203125E-007), REAL_CONST(9.5367431640625E-007),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
49 REAL_CONST(1.9073486328125E-006), REAL_CONST(3.814697265625E-006),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
50 REAL_CONST(7.62939453125E-006), REAL_CONST(1.52587890625E-005),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
51 REAL_CONST(3.0517578125E-005), REAL_CONST(6.103515625E-005),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
52 REAL_CONST(0.0001220703125), REAL_CONST(0.000244140625),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
53 REAL_CONST(0.00048828125), REAL_CONST(0.0009765625),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
54 REAL_CONST(0.001953125), REAL_CONST(0.00390625),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
55 REAL_CONST(0.0078125), REAL_CONST(0.015625),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
56 REAL_CONST(0.03125), REAL_CONST(0.0625),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
57 REAL_CONST(0.125), REAL_CONST(0.25),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
58 REAL_CONST(0.5), REAL_CONST(1.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
59 REAL_CONST(2.0), REAL_CONST(4.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
60 REAL_CONST(8.0), REAL_CONST(16.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
61 REAL_CONST(32.0), REAL_CONST(64.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
62 REAL_CONST(128.0), REAL_CONST(256.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
63 REAL_CONST(512.0), REAL_CONST(1024.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
64 REAL_CONST(2048.0), REAL_CONST(4096.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
65 REAL_CONST(8192.0), REAL_CONST(16384.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
66 REAL_CONST(32768.0), REAL_CONST(65536.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
67 REAL_CONST(131072.0), REAL_CONST(262144.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
68 REAL_CONST(524288.0), REAL_CONST(1048576.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
69 REAL_CONST(2097152.0), REAL_CONST(4194304.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
70 REAL_CONST(8388608.0), REAL_CONST(16777216.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
71 REAL_CONST(33554432.0), REAL_CONST(67108864.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
72 REAL_CONST(134217728.0), REAL_CONST(268435456.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
73 REAL_CONST(536870912.0), REAL_CONST(1073741824.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
74 REAL_CONST(2147483648.0), REAL_CONST(4294967296.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
75 REAL_CONST(8589934592.0), REAL_CONST(17179869184.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
76 REAL_CONST(34359738368.0), REAL_CONST(68719476736.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
77 REAL_CONST(137438953472.0), REAL_CONST(274877906944.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
78 REAL_CONST(549755813888.0), REAL_CONST(1099511627776.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
79 REAL_CONST(2199023255552.0), REAL_CONST(4398046511104.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
80 REAL_CONST(8796093022208.0), REAL_CONST(17592186044416.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
81 REAL_CONST(35184372088832.0), REAL_CONST(70368744177664.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
82 REAL_CONST(140737488355328.0), REAL_CONST(281474976710656.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
83 REAL_CONST(562949953421312.0), REAL_CONST(1125899906842624.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
84 REAL_CONST(2251799813685248.0), REAL_CONST(4503599627370496.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
85 REAL_CONST(9007199254740992.0), REAL_CONST(18014398509481984.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
86 REAL_CONST(36028797018963968.0), REAL_CONST(72057594037927936.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
87 REAL_CONST(144115188075855870.0), REAL_CONST(288230376151711740.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
88 REAL_CONST(576460752303423490.0), REAL_CONST(1152921504606847000.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
89 REAL_CONST(2305843009213694000.0), REAL_CONST(4611686018427387900.0),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
90 REAL_CONST(9223372036854775800.0), REAL_CONST(1.8446744073709552E+019),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
91 REAL_CONST(3.6893488147419103E+019), REAL_CONST(7.3786976294838206E+019),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
92 REAL_CONST(1.4757395258967641E+020), REAL_CONST(2.9514790517935283E+020),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
93 REAL_CONST(5.9029581035870565E+020), REAL_CONST(1.1805916207174113E+021),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
94 REAL_CONST(2.3611832414348226E+021), REAL_CONST(4.7223664828696452E+021),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
95 REAL_CONST(9.4447329657392904E+021), REAL_CONST(1.8889465931478581E+022),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
96 REAL_CONST(3.7778931862957162E+022), REAL_CONST(7.5557863725914323E+022),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
97 REAL_CONST(1.5111572745182865E+023), REAL_CONST(3.0223145490365729E+023),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
98 REAL_CONST(6.0446290980731459E+023), REAL_CONST(1.2089258196146292E+024),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
99 REAL_CONST(2.4178516392292583E+024), REAL_CONST(4.8357032784585167E+024),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
100 REAL_CONST(9.6714065569170334E+024), REAL_CONST(1.9342813113834067E+025),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
101 REAL_CONST(3.8685626227668134E+025), REAL_CONST(7.7371252455336267E+025),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
102 REAL_CONST(1.5474250491067253E+026), REAL_CONST(3.0948500982134507E+026),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
103 REAL_CONST(6.1897001964269014E+026), REAL_CONST(1.2379400392853803E+027),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
104 REAL_CONST(2.4758800785707605E+027)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
105 };
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
106
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
107 /* 1.0 / (1.0 + pow(2.0, x - 12) */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
108 ALIGN static const real_t pow2deq_rcp[] = {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
109 FRAC_CONST(0.99975591896509641),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
110 FRAC_CONST(0.99951195705222062),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
111 FRAC_CONST(0.99902439024390244),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
112 FRAC_CONST(0.99805068226120852),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
113 FRAC_CONST(0.99610894941634243),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
114 FRAC_CONST(0.99224806201550386),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
115 FRAC_CONST(0.98461538461538467),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
116 FRAC_CONST(0.96969696969696972),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
117 FRAC_CONST(0.94117647058823528),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
118 FRAC_CONST(0.88888888888888884),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
119 FRAC_CONST(0.80000000000000004),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
120 FRAC_CONST(0.66666666666666663),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
121 FRAC_CONST(0.5),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
122 FRAC_CONST(0.33333333333333331),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
123 FRAC_CONST(0.20000000000000001),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
124 FRAC_CONST(0.1111111111111111),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
125 FRAC_CONST(0.058823529411764705),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
126 FRAC_CONST(0.030303030303030304),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
127 FRAC_CONST(0.015384615384615385),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
128 FRAC_CONST(0.0077519379844961239),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
129 FRAC_CONST(0.0038910505836575876),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
130 FRAC_CONST(0.0019493177387914229),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
131 FRAC_CONST(0.00097560975609756097),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
132 FRAC_CONST(0.0004880429477794046),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
133 FRAC_CONST(0.00024408103490358799),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
134 FRAC_CONST(0.00012205541315757354),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
135 FRAC_CONST(6.1031431187061336E-005),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
136 FRAC_CONST(3.0516646830846227E-005),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
137 FRAC_CONST(1.5258556235409006E-005),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
138 FRAC_CONST(7.6293363240331724E-006),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
139 FRAC_CONST(3.8146827137652828E-006),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
140 FRAC_CONST(1.9073449948406318E-006),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
141 FRAC_CONST(9.5367340691241559E-007)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
142 };
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
143
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
144 void extract_envelope_data(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
145 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
146 uint8_t l, k;
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 if (sbr->bs_df_env[ch][l] == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
151 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
152 for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
153 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
154 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
155 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
156
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
157 } else { /* bs_df_env == 1 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
158
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
159 uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160 int16_t E_prev;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
161
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
162 if (sbr->f[ch][l] == g)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
163 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
164 for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
165 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
166 if (l == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167 E_prev = sbr->E_prev[ch][k];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
168 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
169 E_prev = sbr->E[ch][k][l - 1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
171 sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
172 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
173
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174 } else if ((g == 1) && (sbr->f[ch][l] == 0)) {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
175 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
178 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179 for (i = 0; i < sbr->N_high; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
180 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
182 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183 if (l == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 E_prev = sbr->E_prev[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 E_prev = sbr->E[ch][i][l - 1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189 }
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
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193 } else if ((g == 0) && (sbr->f[ch][l] == 1)) {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196 for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
198 for (i = 0; i < sbr->N_low; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
199 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
200 if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) &&
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201 (sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1]))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 if (l == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204 E_prev = sbr->E_prev[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
206 E_prev = sbr->E[ch][i][l - 1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
207
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 sbr->E[ch][k][l] = E_prev + sbr->E[ch][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 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
216
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217 void extract_noise_floor_data(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
218 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
219 uint8_t l, k;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
220
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
221 for (l = 0; l < sbr->L_Q[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
222 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
223 if (sbr->bs_df_noise[ch][l] == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
224 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
225 for (k = 1; k < sbr->N_Q; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
226 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
227 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
228 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
229 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
230 if (l == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
231 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
232 for (k = 0; k < sbr->N_Q; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
233 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
234 sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
235 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
236 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
237 for (k = 0; k < sbr->N_Q; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
238 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
239 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
240 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
241 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
242 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
243 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
244 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
245
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
246 void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
247 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
248 if (sbr->bs_coupling == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
249 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
250 int16_t exp;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
251 uint8_t l, k;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
252 uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
253
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
254 for (l = 0; l < sbr->L_E[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
255 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
256 for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
257 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
258 /* +6 for the *64 and -10 for the /32 in the synthesis QMF
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
259 * since this is a energy value: (x/32)^2 = (x^2)/1024
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
260 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
261 exp = (sbr->E[ch][k][l] >> amp) + 6;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
262
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
263 if ((exp < -P2_TABLE_OFFSET) || (exp > P2_TABLE_MAX))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
264 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
265 sbr->E_orig[ch][k][l] = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
266 } else {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
267 /* FIXED POINT TODO: E_orig: INTEGER!! */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
268 sbr->E_orig[ch][k][l] = pow2deq[exp + P2_TABLE_OFFSET];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
269
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
270 /* save half the table size at the cost of 1 multiply */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
271 if (amp && (sbr->E[ch][k][l] & 1))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
272 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
273 sbr->E_orig[ch][k][l] = MUL_R(sbr->E_orig[ch][k][l], REAL_CONST(1.414213562));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
274 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
275 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
276 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
277 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
278
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
279 for (l = 0; l < sbr->L_Q[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
280 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
281 for (k = 0; k < sbr->N_Q; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
282 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
283 if (sbr->Q[ch][k][l] < 0 || sbr->Q[ch][k][l] > 30)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
284 {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
285 sbr->Q_orig[ch][k][l] = 0;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
286 } else {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
287 exp = NOISE_FLOOR_OFFSET - sbr->Q[ch][k][l];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
288 sbr->Q_orig[ch][k][l] = pow2deq[exp + P2_TABLE_OFFSET];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
289 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
290 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
291 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
292 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
293 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
294
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
295 void unmap_envelope_noise(sbr_info *sbr)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
296 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
297 real_t tmp;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
298 int16_t exp0, exp1;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
299 uint8_t l, k;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
300 uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
301 uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
302
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
303 for (l = 0; l < sbr->L_E[0]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
304 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
305 for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
306 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
307 /* +6: * 64 ; +1: * 2 ; -10: /1024 QMF */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
308 exp0 = (sbr->E[0][k][l] >> amp0) + 7;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
309
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
310 /* UN_MAP removed: (x / 4096) same as (x >> 12) */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
311 /* E[1] is always even so no need for compensating the divide by 2 with
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
312 * an extra multiplication
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
313 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
314 exp1 = (sbr->E[1][k][l] >> amp1) - 12;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
315
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
316 if ((exp0 < -P2_TABLE_OFFSET) || (exp0 > P2_TABLE_MAX) ||
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
317 (exp1 < -P2_TABLE_RCP_OFFSET) || (exp1 > P2_TABLE_RCP_MAX))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
318 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
319 sbr->E_orig[1][k][l] = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
320 sbr->E_orig[0][k][l] = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
321 } else {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
322 tmp = pow2deq[exp0 + P2_TABLE_OFFSET];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
323 if (amp0 && (sbr->E[0][k][l] & 1))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
324 tmp = MUL_R(tmp, REAL_CONST(1.414213562));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
325
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
326 /* FIXED POINT TODO: E_orig: INTEGER!! */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
327 sbr->E_orig[1][k][l] = MUL_F(tmp, pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
328 sbr->E_orig[0][k][l] = MUL_R(sbr->E_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
329 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
330 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
331 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
332 for (l = 0; l < sbr->L_Q[0]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
333 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
334 for (k = 0; k < sbr->N_Q; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
335 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
336 if ((sbr->Q[0][k][l] < 0 || sbr->Q[0][k][l] > 30) ||
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
337 (sbr->Q[1][k][l] < 0 || sbr->Q[1][k][l] > 24 /* 2*panOffset(1) */))
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
338 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
339 sbr->Q_orig[0][k][l] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
340 sbr->Q_orig[1][k][l] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
341 } else {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
342 exp0 = NOISE_FLOOR_OFFSET - sbr->Q[0][k][l] + 1;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
343 exp1 = sbr->Q[1][k][l] - 12;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
344
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
345 sbr->Q_orig[1][k][l] = MUL_F(pow2deq[exp0 + P2_TABLE_OFFSET], pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
346 sbr->Q_orig[0][k][l] = MUL_R(sbr->Q_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
347 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
348 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
349 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
350 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
351
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
352 #endif