Coverage Report

Created: 2024-09-21 06:25

/src/lame/libmp3lame/newmdct.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 *      MP3 window subband -> subband filtering -> mdct routine
3
 *
4
 *      Copyright (c) 1999-2000 Takehiro Tominaga
5
 *
6
 *
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Library General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2 of the License, or (at your option) any later version.
11
 *
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Library General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Library General Public
18
 * License along with this library; if not, write to the
19
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
 * Boston, MA 02111-1307, USA.
21
 */
22
23
/*
24
 *         Special Thanks to Patrick De Smet for your advices.
25
 */
26
27
/* $Id$ */
28
29
#ifdef HAVE_CONFIG_H
30
# include <config.h>
31
#endif
32
33
#include "lame.h"
34
#include "machine.h"
35
#include "encoder.h"
36
#include "util.h"
37
#include "newmdct.h"
38
39
40
41
#ifndef USE_GOGO_SUBBAND
42
static const FLOAT enwindow[] = {
43
    -4.77e-07 * 0.740951125354959 / 2.384e-06, 1.03951e-04 * 0.740951125354959 / 2.384e-06,
44
    9.53674e-04 * 0.740951125354959 / 2.384e-06, 2.841473e-03 * 0.740951125354959 / 2.384e-06,
45
    3.5758972e-02 * 0.740951125354959 / 2.384e-06, 3.401756e-03 * 0.740951125354959 / 2.384e-06, 9.83715e-04 * 0.740951125354959 / 2.384e-06, 9.9182e-05 * 0.740951125354959 / 2.384e-06, /* 15 */
46
    1.2398e-05 * 0.740951125354959 / 2.384e-06, 1.91212e-04 * 0.740951125354959 / 2.384e-06,
47
    2.283096e-03 * 0.740951125354959 / 2.384e-06, 1.6994476e-02 * 0.740951125354959 / 2.384e-06,
48
    -1.8756866e-02 * 0.740951125354959 / 2.384e-06, -2.630711e-03 * 0.740951125354959 / 2.384e-06,
49
    -2.47478e-04 * 0.740951125354959 / 2.384e-06, -1.4782e-05 * 0.740951125354959 / 2.384e-06,
50
    9.063471690191471e-01,
51
    1.960342806591213e-01,
52
53
54
    -4.77e-07 * 0.773010453362737 / 2.384e-06, 1.05858e-04 * 0.773010453362737 / 2.384e-06,
55
    9.30786e-04 * 0.773010453362737 / 2.384e-06, 2.521515e-03 * 0.773010453362737 / 2.384e-06,
56
    3.5694122e-02 * 0.773010453362737 / 2.384e-06, 3.643036e-03 * 0.773010453362737 / 2.384e-06, 9.91821e-04 * 0.773010453362737 / 2.384e-06, 9.6321e-05 * 0.773010453362737 / 2.384e-06, /* 14 */
57
    1.1444e-05 * 0.773010453362737 / 2.384e-06, 1.65462e-04 * 0.773010453362737 / 2.384e-06,
58
    2.110004e-03 * 0.773010453362737 / 2.384e-06, 1.6112804e-02 * 0.773010453362737 / 2.384e-06,
59
    -1.9634247e-02 * 0.773010453362737 / 2.384e-06, -2.803326e-03 * 0.773010453362737 / 2.384e-06,
60
    -2.77042e-04 * 0.773010453362737 / 2.384e-06, -1.6689e-05 * 0.773010453362737 / 2.384e-06,
61
    8.206787908286602e-01,
62
    3.901806440322567e-01,
63
64
65
    -4.77e-07 * 0.803207531480645 / 2.384e-06, 1.07288e-04 * 0.803207531480645 / 2.384e-06,
66
    9.02653e-04 * 0.803207531480645 / 2.384e-06, 2.174854e-03 * 0.803207531480645 / 2.384e-06,
67
    3.5586357e-02 * 0.803207531480645 / 2.384e-06, 3.858566e-03 * 0.803207531480645 / 2.384e-06, 9.95159e-04 * 0.803207531480645 / 2.384e-06, 9.3460e-05 * 0.803207531480645 / 2.384e-06, /* 13 */
68
    1.0014e-05 * 0.803207531480645 / 2.384e-06, 1.40190e-04 * 0.803207531480645 / 2.384e-06,
69
    1.937389e-03 * 0.803207531480645 / 2.384e-06, 1.5233517e-02 * 0.803207531480645 / 2.384e-06,
70
    -2.0506859e-02 * 0.803207531480645 / 2.384e-06, -2.974033e-03 * 0.803207531480645 / 2.384e-06,
71
    -3.07560e-04 * 0.803207531480645 / 2.384e-06, -1.8120e-05 * 0.803207531480645 / 2.384e-06,
72
    7.416505462720353e-01,
73
    5.805693545089249e-01,
74
75
76
    -4.77e-07 * 0.831469612302545 / 2.384e-06, 1.08242e-04 * 0.831469612302545 / 2.384e-06,
77
    8.68797e-04 * 0.831469612302545 / 2.384e-06, 1.800537e-03 * 0.831469612302545 / 2.384e-06,
78
    3.5435200e-02 * 0.831469612302545 / 2.384e-06, 4.049301e-03 * 0.831469612302545 / 2.384e-06, 9.94205e-04 * 0.831469612302545 / 2.384e-06, 9.0599e-05 * 0.831469612302545 / 2.384e-06, /* 12 */
79
    9.060e-06 * 0.831469612302545 / 2.384e-06, 1.16348e-04 * 0.831469612302545 / 2.384e-06,
80
    1.766682e-03 * 0.831469612302545 / 2.384e-06, 1.4358521e-02 * 0.831469612302545 / 2.384e-06,
81
    -2.1372318e-02 * 0.831469612302545 / 2.384e-06, -3.14188e-03 * 0.831469612302545 / 2.384e-06,
82
    -3.39031e-04 * 0.831469612302545 / 2.384e-06, -1.9550e-05 * 0.831469612302545 / 2.384e-06,
83
    6.681786379192989e-01,
84
    7.653668647301797e-01,
85
86
87
    -4.77e-07 * 0.857728610000272 / 2.384e-06, 1.08719e-04 * 0.857728610000272 / 2.384e-06,
88
    8.29220e-04 * 0.857728610000272 / 2.384e-06, 1.399517e-03 * 0.857728610000272 / 2.384e-06,
89
    3.5242081e-02 * 0.857728610000272 / 2.384e-06, 4.215240e-03 * 0.857728610000272 / 2.384e-06, 9.89437e-04 * 0.857728610000272 / 2.384e-06, 8.7261e-05 * 0.857728610000272 / 2.384e-06, /* 11 */
90
    8.106e-06 * 0.857728610000272 / 2.384e-06, 9.3937e-05 * 0.857728610000272 / 2.384e-06,
91
    1.597881e-03 * 0.857728610000272 / 2.384e-06, 1.3489246e-02 * 0.857728610000272 / 2.384e-06,
92
    -2.2228718e-02 * 0.857728610000272 / 2.384e-06, -3.306866e-03 * 0.857728610000272 / 2.384e-06,
93
    -3.71456e-04 * 0.857728610000272 / 2.384e-06, -2.1458e-05 * 0.857728610000272 / 2.384e-06,
94
    5.993769336819237e-01,
95
    9.427934736519954e-01,
96
97
98
    -4.77e-07 * 0.881921264348355 / 2.384e-06, 1.08719e-04 * 0.881921264348355 / 2.384e-06,
99
    7.8392e-04 * 0.881921264348355 / 2.384e-06, 9.71317e-04 * 0.881921264348355 / 2.384e-06,
100
    3.5007000e-02 * 0.881921264348355 / 2.384e-06, 4.357815e-03 * 0.881921264348355 / 2.384e-06, 9.80854e-04 * 0.881921264348355 / 2.384e-06, 8.3923e-05 * 0.881921264348355 / 2.384e-06, /* 10 */
101
    7.629e-06 * 0.881921264348355 / 2.384e-06, 7.2956e-05 * 0.881921264348355 / 2.384e-06,
102
    1.432419e-03 * 0.881921264348355 / 2.384e-06, 1.2627602e-02 * 0.881921264348355 / 2.384e-06,
103
    -2.3074150e-02 * 0.881921264348355 / 2.384e-06, -3.467083e-03 * 0.881921264348355 / 2.384e-06,
104
    -4.04358e-04 * 0.881921264348355 / 2.384e-06, -2.3365e-05 * 0.881921264348355 / 2.384e-06,
105
    5.345111359507916e-01,
106
    1.111140466039205e+00,
107
108
109
    -9.54e-07 * 0.903989293123443 / 2.384e-06, 1.08242e-04 * 0.903989293123443 / 2.384e-06,
110
    7.31945e-04 * 0.903989293123443 / 2.384e-06, 5.15938e-04 * 0.903989293123443 / 2.384e-06,
111
    3.4730434e-02 * 0.903989293123443 / 2.384e-06, 4.477024e-03 * 0.903989293123443 / 2.384e-06, 9.68933e-04 * 0.903989293123443 / 2.384e-06, 8.0585e-05 * 0.903989293123443 / 2.384e-06, /* 9 */
112
    6.676e-06 * 0.903989293123443 / 2.384e-06, 5.2929e-05 * 0.903989293123443 / 2.384e-06,
113
    1.269817e-03 * 0.903989293123443 / 2.384e-06, 1.1775017e-02 * 0.903989293123443 / 2.384e-06,
114
    -2.3907185e-02 * 0.903989293123443 / 2.384e-06, -3.622532e-03 * 0.903989293123443 / 2.384e-06,
115
    -4.38213e-04 * 0.903989293123443 / 2.384e-06, -2.5272e-05 * 0.903989293123443 / 2.384e-06,
116
    4.729647758913199e-01,
117
    1.268786568327291e+00,
118
119
120
    -9.54e-07 * 0.92387953251128675613 / 2.384e-06,
121
    1.06812e-04 * 0.92387953251128675613 / 2.384e-06,
122
    6.74248e-04 * 0.92387953251128675613 / 2.384e-06,
123
    3.3379e-05 * 0.92387953251128675613 / 2.384e-06,
124
    3.4412861e-02 * 0.92387953251128675613 / 2.384e-06,
125
    4.573822e-03 * 0.92387953251128675613 / 2.384e-06,
126
    9.54151e-04 * 0.92387953251128675613 / 2.384e-06,
127
    7.6771e-05 * 0.92387953251128675613 / 2.384e-06,
128
    6.199e-06 * 0.92387953251128675613 / 2.384e-06, 3.4332e-05 * 0.92387953251128675613 / 2.384e-06,
129
    1.111031e-03 * 0.92387953251128675613 / 2.384e-06,
130
    1.0933399e-02 * 0.92387953251128675613 / 2.384e-06,
131
    -2.4725437e-02 * 0.92387953251128675613 / 2.384e-06,
132
    -3.771782e-03 * 0.92387953251128675613 / 2.384e-06,
133
    -4.72546e-04 * 0.92387953251128675613 / 2.384e-06,
134
    -2.7657e-05 * 0.92387953251128675613 / 2.384e-06,
135
    4.1421356237309504879e-01, /* tan(PI/8) */
136
    1.414213562373095e+00,
137
138
139
    -9.54e-07 * 0.941544065183021 / 2.384e-06, 1.05381e-04 * 0.941544065183021 / 2.384e-06,
140
    6.10352e-04 * 0.941544065183021 / 2.384e-06, -4.75883e-04 * 0.941544065183021 / 2.384e-06,
141
    3.4055710e-02 * 0.941544065183021 / 2.384e-06, 4.649162e-03 * 0.941544065183021 / 2.384e-06, 9.35555e-04 * 0.941544065183021 / 2.384e-06, 7.3433e-05 * 0.941544065183021 / 2.384e-06, /* 7 */
142
    5.245e-06 * 0.941544065183021 / 2.384e-06, 1.7166e-05 * 0.941544065183021 / 2.384e-06,
143
    9.56535e-04 * 0.941544065183021 / 2.384e-06, 1.0103703e-02 * 0.941544065183021 / 2.384e-06,
144
    -2.5527000e-02 * 0.941544065183021 / 2.384e-06, -3.914356e-03 * 0.941544065183021 / 2.384e-06,
145
    -5.07355e-04 * 0.941544065183021 / 2.384e-06, -3.0041e-05 * 0.941544065183021 / 2.384e-06,
146
    3.578057213145241e-01,
147
    1.546020906725474e+00,
148
149
150
    -9.54e-07 * 0.956940335732209 / 2.384e-06, 1.02520e-04 * 0.956940335732209 / 2.384e-06,
151
    5.39303e-04 * 0.956940335732209 / 2.384e-06, -1.011848e-03 * 0.956940335732209 / 2.384e-06,
152
    3.3659935e-02 * 0.956940335732209 / 2.384e-06, 4.703045e-03 * 0.956940335732209 / 2.384e-06, 9.15051e-04 * 0.956940335732209 / 2.384e-06, 7.0095e-05 * 0.956940335732209 / 2.384e-06, /* 6 */
153
    4.768e-06 * 0.956940335732209 / 2.384e-06, 9.54e-07 * 0.956940335732209 / 2.384e-06,
154
    8.06808e-04 * 0.956940335732209 / 2.384e-06, 9.287834e-03 * 0.956940335732209 / 2.384e-06,
155
    -2.6310921e-02 * 0.956940335732209 / 2.384e-06, -4.048824e-03 * 0.956940335732209 / 2.384e-06,
156
    -5.42164e-04 * 0.956940335732209 / 2.384e-06, -3.2425e-05 * 0.956940335732209 / 2.384e-06,
157
    3.033466836073424e-01,
158
    1.662939224605090e+00,
159
160
161
    -1.431e-06 * 0.970031253194544 / 2.384e-06, 9.9182e-05 * 0.970031253194544 / 2.384e-06,
162
    4.62532e-04 * 0.970031253194544 / 2.384e-06, -1.573563e-03 * 0.970031253194544 / 2.384e-06,
163
    3.3225536e-02 * 0.970031253194544 / 2.384e-06, 4.737377e-03 * 0.970031253194544 / 2.384e-06, 8.91685e-04 * 0.970031253194544 / 2.384e-06, 6.6280e-05 * 0.970031253194544 / 2.384e-06, /* 5 */
164
    4.292e-06 * 0.970031253194544 / 2.384e-06, -1.3828e-05 * 0.970031253194544 / 2.384e-06,
165
    6.61850e-04 * 0.970031253194544 / 2.384e-06, 8.487225e-03 * 0.970031253194544 / 2.384e-06,
166
    -2.7073860e-02 * 0.970031253194544 / 2.384e-06, -4.174709e-03 * 0.970031253194544 / 2.384e-06,
167
    -5.76973e-04 * 0.970031253194544 / 2.384e-06, -3.4809e-05 * 0.970031253194544 / 2.384e-06,
168
    2.504869601913055e-01,
169
    1.763842528696710e+00,
170
171
172
    -1.431e-06 * 0.98078528040323 / 2.384e-06, 9.5367e-05 * 0.98078528040323 / 2.384e-06,
173
    3.78609e-04 * 0.98078528040323 / 2.384e-06, -2.161503e-03 * 0.98078528040323 / 2.384e-06,
174
    3.2754898e-02 * 0.98078528040323 / 2.384e-06, 4.752159e-03 * 0.98078528040323 / 2.384e-06, 8.66413e-04 * 0.98078528040323 / 2.384e-06, 6.2943e-05 * 0.98078528040323 / 2.384e-06, /* 4 */
175
    3.815e-06 * 0.98078528040323 / 2.384e-06, -2.718e-05 * 0.98078528040323 / 2.384e-06,
176
    5.22137e-04 * 0.98078528040323 / 2.384e-06, 7.703304e-03 * 0.98078528040323 / 2.384e-06,
177
    -2.7815342e-02 * 0.98078528040323 / 2.384e-06, -4.290581e-03 * 0.98078528040323 / 2.384e-06,
178
    -6.11782e-04 * 0.98078528040323 / 2.384e-06, -3.7670e-05 * 0.98078528040323 / 2.384e-06,
179
    1.989123673796580e-01,
180
    1.847759065022573e+00,
181
182
183
    -1.907e-06 * 0.989176509964781 / 2.384e-06, 9.0122e-05 * 0.989176509964781 / 2.384e-06,
184
    2.88486e-04 * 0.989176509964781 / 2.384e-06, -2.774239e-03 * 0.989176509964781 / 2.384e-06,
185
    3.2248020e-02 * 0.989176509964781 / 2.384e-06, 4.748821e-03 * 0.989176509964781 / 2.384e-06, 8.38757e-04 * 0.989176509964781 / 2.384e-06, 5.9605e-05 * 0.989176509964781 / 2.384e-06, /* 3 */
186
    3.338e-06 * 0.989176509964781 / 2.384e-06, -3.9577e-05 * 0.989176509964781 / 2.384e-06,
187
    3.88145e-04 * 0.989176509964781 / 2.384e-06, 6.937027e-03 * 0.989176509964781 / 2.384e-06,
188
    -2.8532982e-02 * 0.989176509964781 / 2.384e-06, -4.395962e-03 * 0.989176509964781 / 2.384e-06,
189
    -6.46591e-04 * 0.989176509964781 / 2.384e-06, -4.0531e-05 * 0.989176509964781 / 2.384e-06,
190
    1.483359875383474e-01,
191
    1.913880671464418e+00,
192
193
194
    -1.907e-06 * 0.995184726672197 / 2.384e-06, 8.4400e-05 * 0.995184726672197 / 2.384e-06,
195
    1.91689e-04 * 0.995184726672197 / 2.384e-06, -3.411293e-03 * 0.995184726672197 / 2.384e-06,
196
    3.1706810e-02 * 0.995184726672197 / 2.384e-06, 4.728317e-03 * 0.995184726672197 / 2.384e-06,
197
    8.09669e-04 * 0.995184726672197 / 2.384e-06, 5.579e-05 * 0.995184726672197 / 2.384e-06,
198
    3.338e-06 * 0.995184726672197 / 2.384e-06, -5.0545e-05 * 0.995184726672197 / 2.384e-06,
199
    2.59876e-04 * 0.995184726672197 / 2.384e-06, 6.189346e-03 * 0.995184726672197 / 2.384e-06,
200
    -2.9224873e-02 * 0.995184726672197 / 2.384e-06, -4.489899e-03 * 0.995184726672197 / 2.384e-06,
201
    -6.80923e-04 * 0.995184726672197 / 2.384e-06, -4.3392e-05 * 0.995184726672197 / 2.384e-06,
202
    9.849140335716425e-02,
203
    1.961570560806461e+00,
204
205
206
    -2.384e-06 * 0.998795456205172 / 2.384e-06, 7.7724e-05 * 0.998795456205172 / 2.384e-06,
207
    8.8215e-05 * 0.998795456205172 / 2.384e-06, -4.072189e-03 * 0.998795456205172 / 2.384e-06,
208
    3.1132698e-02 * 0.998795456205172 / 2.384e-06, 4.691124e-03 * 0.998795456205172 / 2.384e-06,
209
    7.79152e-04 * 0.998795456205172 / 2.384e-06, 5.2929e-05 * 0.998795456205172 / 2.384e-06,
210
    2.861e-06 * 0.998795456205172 / 2.384e-06, -6.0558e-05 * 0.998795456205172 / 2.384e-06,
211
    1.37329e-04 * 0.998795456205172 / 2.384e-06, 5.462170e-03 * 0.998795456205172 / 2.384e-06,
212
    -2.9890060e-02 * 0.998795456205172 / 2.384e-06, -4.570484e-03 * 0.998795456205172 / 2.384e-06,
213
    -7.14302e-04 * 0.998795456205172 / 2.384e-06, -4.6253e-05 * 0.998795456205172 / 2.384e-06,
214
    4.912684976946725e-02,
215
    1.990369453344394e+00,
216
217
218
    3.5780907e-02 * SQRT2 * 0.5 / 2.384e-06, 1.7876148e-02 * SQRT2 * 0.5 / 2.384e-06,
219
    3.134727e-03 * SQRT2 * 0.5 / 2.384e-06, 2.457142e-03 * SQRT2 * 0.5 / 2.384e-06,
220
    9.71317e-04 * SQRT2 * 0.5 / 2.384e-06, 2.18868e-04 * SQRT2 * 0.5 / 2.384e-06,
221
    1.01566e-04 * SQRT2 * 0.5 / 2.384e-06, 1.3828e-05 * SQRT2 * 0.5 / 2.384e-06,
222
223
    3.0526638e-02 / 2.384e-06, 4.638195e-03 / 2.384e-06, 7.47204e-04 / 2.384e-06,
224
    4.9591e-05 / 2.384e-06,
225
    4.756451e-03 / 2.384e-06, 2.1458e-05 / 2.384e-06, -6.9618e-05 / 2.384e-06, /*    2.384e-06/2.384e-06 */
226
};
227
#endif
228
229
230
2.45M
#define NS 12
231
2.09M
#define NL 36
232
233
static const FLOAT win[4][NL] = {
234
    {
235
     2.382191739347913e-13,
236
     6.423305872147834e-13,
237
     9.400849094049688e-13,
238
     1.122435026096556e-12,
239
     1.183840321267481e-12,
240
     1.122435026096556e-12,
241
     9.400849094049690e-13,
242
     6.423305872147839e-13,
243
     2.382191739347918e-13,
244
245
     5.456116108943412e-12,
246
     4.878985199565852e-12,
247
     4.240448995017367e-12,
248
     3.559909094758252e-12,
249
     2.858043359288075e-12,
250
     2.156177623817898e-12,
251
     1.475637723558783e-12,
252
     8.371015190102974e-13,
253
     2.599706096327376e-13,
254
255
     -5.456116108943412e-12,
256
     -4.878985199565852e-12,
257
     -4.240448995017367e-12,
258
     -3.559909094758252e-12,
259
     -2.858043359288076e-12,
260
     -2.156177623817898e-12,
261
     -1.475637723558783e-12,
262
     -8.371015190102975e-13,
263
     -2.599706096327376e-13,
264
265
     -2.382191739347923e-13,
266
     -6.423305872147843e-13,
267
     -9.400849094049696e-13,
268
     -1.122435026096556e-12,
269
     -1.183840321267481e-12,
270
     -1.122435026096556e-12,
271
     -9.400849094049694e-13,
272
     -6.423305872147840e-13,
273
     -2.382191739347918e-13,
274
     },
275
    {
276
     2.382191739347913e-13,
277
     6.423305872147834e-13,
278
     9.400849094049688e-13,
279
     1.122435026096556e-12,
280
     1.183840321267481e-12,
281
     1.122435026096556e-12,
282
     9.400849094049688e-13,
283
     6.423305872147841e-13,
284
     2.382191739347918e-13,
285
286
     5.456116108943413e-12,
287
     4.878985199565852e-12,
288
     4.240448995017367e-12,
289
     3.559909094758253e-12,
290
     2.858043359288075e-12,
291
     2.156177623817898e-12,
292
     1.475637723558782e-12,
293
     8.371015190102975e-13,
294
     2.599706096327376e-13,
295
296
     -5.461314069809755e-12,
297
     -4.921085770524055e-12,
298
     -4.343405037091838e-12,
299
     -3.732668368707687e-12,
300
     -3.093523840190885e-12,
301
     -2.430835727329465e-12,
302
     -1.734679010007751e-12,
303
     -9.748253656609281e-13,
304
     -2.797435120168326e-13,
305
306
     0.000000000000000e+00,
307
     0.000000000000000e+00,
308
     0.000000000000000e+00,
309
     0.000000000000000e+00,
310
     0.000000000000000e+00,
311
     0.000000000000000e+00,
312
     -2.283748241799531e-13,
313
     -4.037858874020686e-13,
314
     -2.146547464825323e-13,
315
     },
316
    {
317
     1.316524975873958e-01, /* win[SHORT_TYPE] */
318
     4.142135623730950e-01,
319
     7.673269879789602e-01,
320
321
     1.091308501069271e+00, /* tantab_l */
322
     1.303225372841206e+00,
323
     1.569685577117490e+00,
324
     1.920982126971166e+00,
325
     2.414213562373094e+00,
326
     3.171594802363212e+00,
327
     4.510708503662055e+00,
328
     7.595754112725146e+00,
329
     2.290376554843115e+01,
330
331
     0.98480775301220802032, /* cx */
332
     0.64278760968653936292,
333
     0.34202014332566882393,
334
     0.93969262078590842791,
335
     -0.17364817766693030343,
336
     -0.76604444311897790243,
337
     0.86602540378443870761,
338
     0.500000000000000e+00,
339
340
     -5.144957554275265e-01, /* ca */
341
     -4.717319685649723e-01,
342
     -3.133774542039019e-01,
343
     -1.819131996109812e-01,
344
     -9.457419252642064e-02,
345
     -4.096558288530405e-02,
346
     -1.419856857247115e-02,
347
     -3.699974673760037e-03,
348
349
     8.574929257125442e-01, /* cs */
350
     8.817419973177052e-01,
351
     9.496286491027329e-01,
352
     9.833145924917901e-01,
353
     9.955178160675857e-01,
354
     9.991605581781475e-01,
355
     9.998991952444470e-01,
356
     9.999931550702802e-01,
357
     },
358
    {
359
     0.000000000000000e+00,
360
     0.000000000000000e+00,
361
     0.000000000000000e+00,
362
     0.000000000000000e+00,
363
     0.000000000000000e+00,
364
     0.000000000000000e+00,
365
     2.283748241799531e-13,
366
     4.037858874020686e-13,
367
     2.146547464825323e-13,
368
369
     5.461314069809755e-12,
370
     4.921085770524055e-12,
371
     4.343405037091838e-12,
372
     3.732668368707687e-12,
373
     3.093523840190885e-12,
374
     2.430835727329466e-12,
375
     1.734679010007751e-12,
376
     9.748253656609281e-13,
377
     2.797435120168326e-13,
378
379
     -5.456116108943413e-12,
380
     -4.878985199565852e-12,
381
     -4.240448995017367e-12,
382
     -3.559909094758253e-12,
383
     -2.858043359288075e-12,
384
     -2.156177623817898e-12,
385
     -1.475637723558782e-12,
386
     -8.371015190102975e-13,
387
     -2.599706096327376e-13,
388
389
     -2.382191739347913e-13,
390
     -6.423305872147834e-13,
391
     -9.400849094049688e-13,
392
     -1.122435026096556e-12,
393
     -1.183840321267481e-12,
394
     -1.122435026096556e-12,
395
     -9.400849094049688e-13,
396
     -6.423305872147841e-13,
397
     -2.382191739347918e-13,
398
     }
399
};
400
401
37.6M
#define tantab_l (win[SHORT_TYPE]+3)
402
92.0M
#define cx (win[SHORT_TYPE]+12)
403
43.6M
#define ca (win[SHORT_TYPE]+20)
404
43.6M
#define cs (win[SHORT_TYPE]+28)
405
406
/************************************************************************
407
*
408
* window_subband()
409
*
410
* PURPOSE:  Overlapping window on PCM samples
411
*
412
* SEMANTICS:
413
* 32 16-bit pcm samples are scaled to fractional 2's complement and
414
* concatenated to the end of the window buffer #x#. The updated window
415
* buffer #x# is then windowed by the analysis window #c# to produce the
416
* windowed sample #z#
417
*
418
************************************************************************/
419
420
/*
421
 *      new IDCT routine written by Takehiro TOMINAGA
422
 */
423
static const int order[] = {
424
    0, 1, 16, 17, 8, 9, 24, 25, 4, 5, 20, 21, 12, 13, 28, 29,
425
    2, 3, 18, 19, 10, 11, 26, 27, 6, 7, 22, 23, 14, 15, 30, 31
426
};
427
428
429
/* returns sum_j=0^31 a[j]*cos(PI*j*(k+1/2)/32), 0<=k<32 */
430
inline static void
431
window_subband(const sample_t * x1, FLOAT a[SBLIMIT])
432
3.41M
{
433
3.41M
    int     i;
434
3.41M
    FLOAT const *wp = enwindow + 10;
435
436
3.41M
    const sample_t *x2 = &x1[238 - 14 - 286];
437
438
54.6M
    for (i = -15; i < 0; i++) {
439
51.1M
        FLOAT   w, s, t;
440
441
51.1M
        w = wp[-10];
442
51.1M
        s = x2[-224] * w;
443
51.1M
        t = x1[224] * w;
444
51.1M
        w = wp[-9];
445
51.1M
        s += x2[-160] * w;
446
51.1M
        t += x1[160] * w;
447
51.1M
        w = wp[-8];
448
51.1M
        s += x2[-96] * w;
449
51.1M
        t += x1[96] * w;
450
51.1M
        w = wp[-7];
451
51.1M
        s += x2[-32] * w;
452
51.1M
        t += x1[32] * w;
453
51.1M
        w = wp[-6];
454
51.1M
        s += x2[32] * w;
455
51.1M
        t += x1[-32] * w;
456
51.1M
        w = wp[-5];
457
51.1M
        s += x2[96] * w;
458
51.1M
        t += x1[-96] * w;
459
51.1M
        w = wp[-4];
460
51.1M
        s += x2[160] * w;
461
51.1M
        t += x1[-160] * w;
462
51.1M
        w = wp[-3];
463
51.1M
        s += x2[224] * w;
464
51.1M
        t += x1[-224] * w;
465
466
51.1M
        w = wp[-2];
467
51.1M
        s += x1[-256] * w;
468
51.1M
        t -= x2[256] * w;
469
51.1M
        w = wp[-1];
470
51.1M
        s += x1[-192] * w;
471
51.1M
        t -= x2[192] * w;
472
51.1M
        w = wp[0];
473
51.1M
        s += x1[-128] * w;
474
51.1M
        t -= x2[128] * w;
475
51.1M
        w = wp[1];
476
51.1M
        s += x1[-64] * w;
477
51.1M
        t -= x2[64] * w;
478
51.1M
        w = wp[2];
479
51.1M
        s += x1[0] * w;
480
51.1M
        t -= x2[0] * w;
481
51.1M
        w = wp[3];
482
51.1M
        s += x1[64] * w;
483
51.1M
        t -= x2[-64] * w;
484
51.1M
        w = wp[4];
485
51.1M
        s += x1[128] * w;
486
51.1M
        t -= x2[-128] * w;
487
51.1M
        w = wp[5];
488
51.1M
        s += x1[192] * w;
489
51.1M
        t -= x2[-192] * w;
490
491
        /*
492
         * this multiplyer could be removed, but it needs more 256 FLOAT data.
493
         * thinking about the data cache performance, I think we should not
494
         * use such a huge table. tt 2000/Oct/25
495
         */
496
51.1M
        s *= wp[6];
497
51.1M
        w = t - s;
498
51.1M
        a[30 + i * 2] = t + s;
499
51.1M
        a[31 + i * 2] = wp[7] * w;
500
51.1M
        wp += 18;
501
51.1M
        x1--;
502
51.1M
        x2++;
503
51.1M
    }
504
3.41M
    {
505
3.41M
        FLOAT   s, t, u, v;
506
3.41M
        t = x1[-16] * wp[-10];
507
3.41M
        s = x1[-32] * wp[-2];
508
3.41M
        t += (x1[-48] - x1[16]) * wp[-9];
509
3.41M
        s += x1[-96] * wp[-1];
510
3.41M
        t += (x1[-80] + x1[48]) * wp[-8];
511
3.41M
        s += x1[-160] * wp[0];
512
3.41M
        t += (x1[-112] - x1[80]) * wp[-7];
513
3.41M
        s += x1[-224] * wp[1];
514
3.41M
        t += (x1[-144] + x1[112]) * wp[-6];
515
3.41M
        s -= x1[32] * wp[2];
516
3.41M
        t += (x1[-176] - x1[144]) * wp[-5];
517
3.41M
        s -= x1[96] * wp[3];
518
3.41M
        t += (x1[-208] + x1[176]) * wp[-4];
519
3.41M
        s -= x1[160] * wp[4];
520
3.41M
        t += (x1[-240] - x1[208]) * wp[-3];
521
3.41M
        s -= x1[224];
522
523
3.41M
        u = s - t;
524
3.41M
        v = s + t;
525
526
3.41M
        t = a[14];
527
3.41M
        s = a[15] - t;
528
529
3.41M
        a[31] = v + t;  /* A0 */
530
3.41M
        a[30] = u + s;  /* A1 */
531
3.41M
        a[15] = u - s;  /* A2 */
532
3.41M
        a[14] = v - t;  /* A3 */
533
3.41M
    }
534
3.41M
    {
535
3.41M
        FLOAT   xr;
536
3.41M
        xr = a[28] - a[0];
537
3.41M
        a[0] += a[28];
538
3.41M
        a[28] = xr * wp[-2 * 18 + 7];
539
3.41M
        xr = a[29] - a[1];
540
3.41M
        a[1] += a[29];
541
3.41M
        a[29] = xr * wp[-2 * 18 + 7];
542
543
3.41M
        xr = a[26] - a[2];
544
3.41M
        a[2] += a[26];
545
3.41M
        a[26] = xr * wp[-4 * 18 + 7];
546
3.41M
        xr = a[27] - a[3];
547
3.41M
        a[3] += a[27];
548
3.41M
        a[27] = xr * wp[-4 * 18 + 7];
549
550
3.41M
        xr = a[24] - a[4];
551
3.41M
        a[4] += a[24];
552
3.41M
        a[24] = xr * wp[-6 * 18 + 7];
553
3.41M
        xr = a[25] - a[5];
554
3.41M
        a[5] += a[25];
555
3.41M
        a[25] = xr * wp[-6 * 18 + 7];
556
557
3.41M
        xr = a[22] - a[6];
558
3.41M
        a[6] += a[22];
559
3.41M
        a[22] = xr * SQRT2;
560
3.41M
        xr = a[23] - a[7];
561
3.41M
        a[7] += a[23];
562
3.41M
        a[23] = xr * SQRT2 - a[7];
563
3.41M
        a[7] -= a[6];
564
3.41M
        a[22] -= a[7];
565
3.41M
        a[23] -= a[22];
566
567
3.41M
        xr = a[6];
568
3.41M
        a[6] = a[31] - xr;
569
3.41M
        a[31] = a[31] + xr;
570
3.41M
        xr = a[7];
571
3.41M
        a[7] = a[30] - xr;
572
3.41M
        a[30] = a[30] + xr;
573
3.41M
        xr = a[22];
574
3.41M
        a[22] = a[15] - xr;
575
3.41M
        a[15] = a[15] + xr;
576
3.41M
        xr = a[23];
577
3.41M
        a[23] = a[14] - xr;
578
3.41M
        a[14] = a[14] + xr;
579
580
3.41M
        xr = a[20] - a[8];
581
3.41M
        a[8] += a[20];
582
3.41M
        a[20] = xr * wp[-10 * 18 + 7];
583
3.41M
        xr = a[21] - a[9];
584
3.41M
        a[9] += a[21];
585
3.41M
        a[21] = xr * wp[-10 * 18 + 7];
586
587
3.41M
        xr = a[18] - a[10];
588
3.41M
        a[10] += a[18];
589
3.41M
        a[18] = xr * wp[-12 * 18 + 7];
590
3.41M
        xr = a[19] - a[11];
591
3.41M
        a[11] += a[19];
592
3.41M
        a[19] = xr * wp[-12 * 18 + 7];
593
594
3.41M
        xr = a[16] - a[12];
595
3.41M
        a[12] += a[16];
596
3.41M
        a[16] = xr * wp[-14 * 18 + 7];
597
3.41M
        xr = a[17] - a[13];
598
3.41M
        a[13] += a[17];
599
3.41M
        a[17] = xr * wp[-14 * 18 + 7];
600
601
3.41M
        xr = -a[20] + a[24];
602
3.41M
        a[20] += a[24];
603
3.41M
        a[24] = xr * wp[-12 * 18 + 7];
604
3.41M
        xr = -a[21] + a[25];
605
3.41M
        a[21] += a[25];
606
3.41M
        a[25] = xr * wp[-12 * 18 + 7];
607
608
3.41M
        xr = a[4] - a[8];
609
3.41M
        a[4] += a[8];
610
3.41M
        a[8] = xr * wp[-12 * 18 + 7];
611
3.41M
        xr = a[5] - a[9];
612
3.41M
        a[5] += a[9];
613
3.41M
        a[9] = xr * wp[-12 * 18 + 7];
614
615
3.41M
        xr = a[0] - a[12];
616
3.41M
        a[0] += a[12];
617
3.41M
        a[12] = xr * wp[-4 * 18 + 7];
618
3.41M
        xr = a[1] - a[13];
619
3.41M
        a[1] += a[13];
620
3.41M
        a[13] = xr * wp[-4 * 18 + 7];
621
3.41M
        xr = a[16] - a[28];
622
3.41M
        a[16] += a[28];
623
3.41M
        a[28] = xr * wp[-4 * 18 + 7];
624
3.41M
        xr = -a[17] + a[29];
625
3.41M
        a[17] += a[29];
626
3.41M
        a[29] = xr * wp[-4 * 18 + 7];
627
628
3.41M
        xr = SQRT2 * (a[2] - a[10]);
629
3.41M
        a[2] += a[10];
630
3.41M
        a[10] = xr;
631
3.41M
        xr = SQRT2 * (a[3] - a[11]);
632
3.41M
        a[3] += a[11];
633
3.41M
        a[11] = xr;
634
3.41M
        xr = SQRT2 * (-a[18] + a[26]);
635
3.41M
        a[18] += a[26];
636
3.41M
        a[26] = xr - a[18];
637
3.41M
        xr = SQRT2 * (-a[19] + a[27]);
638
3.41M
        a[19] += a[27];
639
3.41M
        a[27] = xr - a[19];
640
641
3.41M
        xr = a[2];
642
3.41M
        a[19] -= a[3];
643
3.41M
        a[3] -= xr;
644
3.41M
        a[2] = a[31] - xr;
645
3.41M
        a[31] += xr;
646
3.41M
        xr = a[3];
647
3.41M
        a[11] -= a[19];
648
3.41M
        a[18] -= xr;
649
3.41M
        a[3] = a[30] - xr;
650
3.41M
        a[30] += xr;
651
3.41M
        xr = a[18];
652
3.41M
        a[27] -= a[11];
653
3.41M
        a[19] -= xr;
654
3.41M
        a[18] = a[15] - xr;
655
3.41M
        a[15] += xr;
656
657
3.41M
        xr = a[19];
658
3.41M
        a[10] -= xr;
659
3.41M
        a[19] = a[14] - xr;
660
3.41M
        a[14] += xr;
661
3.41M
        xr = a[10];
662
3.41M
        a[11] -= xr;
663
3.41M
        a[10] = a[23] - xr;
664
3.41M
        a[23] += xr;
665
3.41M
        xr = a[11];
666
3.41M
        a[26] -= xr;
667
3.41M
        a[11] = a[22] - xr;
668
3.41M
        a[22] += xr;
669
3.41M
        xr = a[26];
670
3.41M
        a[27] -= xr;
671
3.41M
        a[26] = a[7] - xr;
672
3.41M
        a[7] += xr;
673
674
3.41M
        xr = a[27];
675
3.41M
        a[27] = a[6] - xr;
676
3.41M
        a[6] += xr;
677
678
3.41M
        xr = SQRT2 * (a[0] - a[4]);
679
3.41M
        a[0] += a[4];
680
3.41M
        a[4] = xr;
681
3.41M
        xr = SQRT2 * (a[1] - a[5]);
682
3.41M
        a[1] += a[5];
683
3.41M
        a[5] = xr;
684
3.41M
        xr = SQRT2 * (a[16] - a[20]);
685
3.41M
        a[16] += a[20];
686
3.41M
        a[20] = xr;
687
3.41M
        xr = SQRT2 * (a[17] - a[21]);
688
3.41M
        a[17] += a[21];
689
3.41M
        a[21] = xr;
690
691
3.41M
        xr = -SQRT2 * (a[8] - a[12]);
692
3.41M
        a[8] += a[12];
693
3.41M
        a[12] = xr - a[8];
694
3.41M
        xr = -SQRT2 * (a[9] - a[13]);
695
3.41M
        a[9] += a[13];
696
3.41M
        a[13] = xr - a[9];
697
3.41M
        xr = -SQRT2 * (a[25] - a[29]);
698
3.41M
        a[25] += a[29];
699
3.41M
        a[29] = xr - a[25];
700
3.41M
        xr = -SQRT2 * (a[24] + a[28]);
701
3.41M
        a[24] -= a[28];
702
3.41M
        a[28] = xr - a[24];
703
704
3.41M
        xr = a[24] - a[16];
705
3.41M
        a[24] = xr;
706
3.41M
        xr = a[20] - xr;
707
3.41M
        a[20] = xr;
708
3.41M
        xr = a[28] - xr;
709
3.41M
        a[28] = xr;
710
711
3.41M
        xr = a[25] - a[17];
712
3.41M
        a[25] = xr;
713
3.41M
        xr = a[21] - xr;
714
3.41M
        a[21] = xr;
715
3.41M
        xr = a[29] - xr;
716
3.41M
        a[29] = xr;
717
718
3.41M
        xr = a[17] - a[1];
719
3.41M
        a[17] = xr;
720
3.41M
        xr = a[9] - xr;
721
3.41M
        a[9] = xr;
722
3.41M
        xr = a[25] - xr;
723
3.41M
        a[25] = xr;
724
3.41M
        xr = a[5] - xr;
725
3.41M
        a[5] = xr;
726
3.41M
        xr = a[21] - xr;
727
3.41M
        a[21] = xr;
728
3.41M
        xr = a[13] - xr;
729
3.41M
        a[13] = xr;
730
3.41M
        xr = a[29] - xr;
731
3.41M
        a[29] = xr;
732
733
3.41M
        xr = a[1] - a[0];
734
3.41M
        a[1] = xr;
735
3.41M
        xr = a[16] - xr;
736
3.41M
        a[16] = xr;
737
3.41M
        xr = a[17] - xr;
738
3.41M
        a[17] = xr;
739
3.41M
        xr = a[8] - xr;
740
3.41M
        a[8] = xr;
741
3.41M
        xr = a[9] - xr;
742
3.41M
        a[9] = xr;
743
3.41M
        xr = a[24] - xr;
744
3.41M
        a[24] = xr;
745
3.41M
        xr = a[25] - xr;
746
3.41M
        a[25] = xr;
747
3.41M
        xr = a[4] - xr;
748
3.41M
        a[4] = xr;
749
3.41M
        xr = a[5] - xr;
750
3.41M
        a[5] = xr;
751
3.41M
        xr = a[20] - xr;
752
3.41M
        a[20] = xr;
753
3.41M
        xr = a[21] - xr;
754
3.41M
        a[21] = xr;
755
3.41M
        xr = a[12] - xr;
756
3.41M
        a[12] = xr;
757
3.41M
        xr = a[13] - xr;
758
3.41M
        a[13] = xr;
759
3.41M
        xr = a[28] - xr;
760
3.41M
        a[28] = xr;
761
3.41M
        xr = a[29] - xr;
762
3.41M
        a[29] = xr;
763
764
3.41M
        xr = a[0];
765
3.41M
        a[0] += a[31];
766
3.41M
        a[31] -= xr;
767
3.41M
        xr = a[1];
768
3.41M
        a[1] += a[30];
769
3.41M
        a[30] -= xr;
770
3.41M
        xr = a[16];
771
3.41M
        a[16] += a[15];
772
3.41M
        a[15] -= xr;
773
3.41M
        xr = a[17];
774
3.41M
        a[17] += a[14];
775
3.41M
        a[14] -= xr;
776
3.41M
        xr = a[8];
777
3.41M
        a[8] += a[23];
778
3.41M
        a[23] -= xr;
779
3.41M
        xr = a[9];
780
3.41M
        a[9] += a[22];
781
3.41M
        a[22] -= xr;
782
3.41M
        xr = a[24];
783
3.41M
        a[24] += a[7];
784
3.41M
        a[7] -= xr;
785
3.41M
        xr = a[25];
786
3.41M
        a[25] += a[6];
787
3.41M
        a[6] -= xr;
788
3.41M
        xr = a[4];
789
3.41M
        a[4] += a[27];
790
3.41M
        a[27] -= xr;
791
3.41M
        xr = a[5];
792
3.41M
        a[5] += a[26];
793
3.41M
        a[26] -= xr;
794
3.41M
        xr = a[20];
795
3.41M
        a[20] += a[11];
796
3.41M
        a[11] -= xr;
797
3.41M
        xr = a[21];
798
3.41M
        a[21] += a[10];
799
3.41M
        a[10] -= xr;
800
3.41M
        xr = a[12];
801
3.41M
        a[12] += a[19];
802
3.41M
        a[19] -= xr;
803
3.41M
        xr = a[13];
804
3.41M
        a[13] += a[18];
805
3.41M
        a[18] -= xr;
806
3.41M
        xr = a[28];
807
3.41M
        a[28] += a[3];
808
3.41M
        a[3] -= xr;
809
3.41M
        xr = a[29];
810
3.41M
        a[29] += a[2];
811
3.41M
        a[2] -= xr;
812
3.41M
    }
813
814
3.41M
}
815
816
817
/*-------------------------------------------------------------------*/
818
/*                                                                   */
819
/*   Function: Calculation of the MDCT                               */
820
/*   In the case of long blocks (type 0,1,3) there are               */
821
/*   36 coefficents in the time domain and 18 in the frequency       */
822
/*   domain.                                                         */
823
/*   In the case of short blocks (type 2) there are 3                */
824
/*   transformations with short length. This leads to 12 coefficents */
825
/*   in the time and 6 in the frequency domain. In this case the     */
826
/*   results are stored side by side in the vector out[].            */
827
/*                                                                   */
828
/*   New layer3                                                      */
829
/*                                                                   */
830
/*-------------------------------------------------------------------*/
831
832
inline static void
833
mdct_short(FLOAT * inout)
834
2.45M
{
835
2.45M
    int     l;
836
9.80M
    for (l = 0; l < 3; l++) {
837
7.35M
        FLOAT   tc0, tc1, tc2, ts0, ts1, ts2;
838
839
7.35M
        ts0 = inout[2 * 3] * win[SHORT_TYPE][0] - inout[5 * 3];
840
7.35M
        tc0 = inout[0 * 3] * win[SHORT_TYPE][2] - inout[3 * 3];
841
7.35M
        tc1 = ts0 + tc0;
842
7.35M
        tc2 = ts0 - tc0;
843
844
7.35M
        ts0 = inout[5 * 3] * win[SHORT_TYPE][0] + inout[2 * 3];
845
7.35M
        tc0 = inout[3 * 3] * win[SHORT_TYPE][2] + inout[0 * 3];
846
7.35M
        ts1 = ts0 + tc0;
847
7.35M
        ts2 = -ts0 + tc0;
848
849
7.35M
        tc0 = (inout[1 * 3] * win[SHORT_TYPE][1] - inout[4 * 3]) * 2.069978111953089e-11; /* tritab_s[1] */
850
7.35M
        ts0 = (inout[4 * 3] * win[SHORT_TYPE][1] + inout[1 * 3]) * 2.069978111953089e-11; /* tritab_s[1] */
851
852
7.35M
        inout[3 * 0] = tc1 * 1.907525191737280e-11 /* tritab_s[2] */  + tc0;
853
7.35M
        inout[3 * 5] = -ts1 * 1.907525191737280e-11 /* tritab_s[0] */  + ts0;
854
855
7.35M
        tc2 = tc2 * 0.86602540378443870761 * 1.907525191737281e-11 /* tritab_s[2] */ ;
856
7.35M
        ts1 = ts1 * 0.5 * 1.907525191737281e-11 + ts0;
857
7.35M
        inout[3 * 1] = tc2 - ts1;
858
7.35M
        inout[3 * 2] = tc2 + ts1;
859
860
7.35M
        tc1 = tc1 * 0.5 * 1.907525191737281e-11 - tc0;
861
7.35M
        ts2 = ts2 * 0.86602540378443870761 * 1.907525191737281e-11 /* tritab_s[0] */ ;
862
7.35M
        inout[3 * 3] = tc1 + ts2;
863
7.35M
        inout[3 * 4] = tc1 - ts2;
864
865
7.35M
        inout++;
866
7.35M
    }
867
2.45M
}
868
869
inline static void
870
mdct_long(FLOAT * out, FLOAT const *in)
871
2.09M
{
872
2.09M
    FLOAT   ct, st;
873
2.09M
    {
874
2.09M
        FLOAT   tc1, tc2, tc3, tc4, ts5, ts6, ts7, ts8;
875
        /* 1,2, 5,6, 9,10, 13,14, 17 */
876
2.09M
        tc1 = in[17] - in[9];
877
2.09M
        tc3 = in[15] - in[11];
878
2.09M
        tc4 = in[14] - in[12];
879
2.09M
        ts5 = in[0] + in[8];
880
2.09M
        ts6 = in[1] + in[7];
881
2.09M
        ts7 = in[2] + in[6];
882
2.09M
        ts8 = in[3] + in[5];
883
884
2.09M
        out[17] = (ts5 + ts7 - ts8) - (ts6 - in[4]);
885
2.09M
        st = (ts5 + ts7 - ts8) * cx[7] + (ts6 - in[4]);
886
2.09M
        ct = (tc1 - tc3 - tc4) * cx[6];
887
2.09M
        out[5] = ct + st;
888
2.09M
        out[6] = ct - st;
889
890
2.09M
        tc2 = (in[16] - in[10]) * cx[6];
891
2.09M
        ts6 = ts6 * cx[7] + in[4];
892
2.09M
        ct = tc1 * cx[0] + tc2 + tc3 * cx[1] + tc4 * cx[2];
893
2.09M
        st = -ts5 * cx[4] + ts6 - ts7 * cx[5] + ts8 * cx[3];
894
2.09M
        out[1] = ct + st;
895
2.09M
        out[2] = ct - st;
896
897
2.09M
        ct = tc1 * cx[1] - tc2 - tc3 * cx[2] + tc4 * cx[0];
898
2.09M
        st = -ts5 * cx[5] + ts6 - ts7 * cx[3] + ts8 * cx[4];
899
2.09M
        out[9] = ct + st;
900
2.09M
        out[10] = ct - st;
901
902
2.09M
        ct = tc1 * cx[2] - tc2 + tc3 * cx[0] - tc4 * cx[1];
903
2.09M
        st = ts5 * cx[3] - ts6 + ts7 * cx[4] - ts8 * cx[5];
904
2.09M
        out[13] = ct + st;
905
2.09M
        out[14] = ct - st;
906
2.09M
    }
907
2.09M
    {
908
2.09M
        FLOAT   ts1, ts2, ts3, ts4, tc5, tc6, tc7, tc8;
909
910
2.09M
        ts1 = in[8] - in[0];
911
2.09M
        ts3 = in[6] - in[2];
912
2.09M
        ts4 = in[5] - in[3];
913
2.09M
        tc5 = in[17] + in[9];
914
2.09M
        tc6 = in[16] + in[10];
915
2.09M
        tc7 = in[15] + in[11];
916
2.09M
        tc8 = in[14] + in[12];
917
918
2.09M
        out[0] = (tc5 + tc7 + tc8) + (tc6 + in[13]);
919
2.09M
        ct = (tc5 + tc7 + tc8) * cx[7] - (tc6 + in[13]);
920
2.09M
        st = (ts1 - ts3 + ts4) * cx[6];
921
2.09M
        out[11] = ct + st;
922
2.09M
        out[12] = ct - st;
923
924
2.09M
        ts2 = (in[7] - in[1]) * cx[6];
925
2.09M
        tc6 = in[13] - tc6 * cx[7];
926
2.09M
        ct = tc5 * cx[3] - tc6 + tc7 * cx[4] + tc8 * cx[5];
927
2.09M
        st = ts1 * cx[2] + ts2 + ts3 * cx[0] + ts4 * cx[1];
928
2.09M
        out[3] = ct + st;
929
2.09M
        out[4] = ct - st;
930
931
2.09M
        ct = -tc5 * cx[5] + tc6 - tc7 * cx[3] - tc8 * cx[4];
932
2.09M
        st = ts1 * cx[1] + ts2 - ts3 * cx[2] - ts4 * cx[0];
933
2.09M
        out[7] = ct + st;
934
2.09M
        out[8] = ct - st;
935
936
2.09M
        ct = -tc5 * cx[4] + tc6 - tc7 * cx[5] - tc8 * cx[3];
937
2.09M
        st = ts1 * cx[0] - ts2 + ts3 * cx[1] - ts4 * cx[2];
938
2.09M
        out[15] = ct + st;
939
2.09M
        out[16] = ct - st;
940
2.09M
    }
941
2.09M
}
942
943
944
void
945
mdct_sub48(lame_internal_flags * gfc, const sample_t * w0, const sample_t * w1)
946
66.1k
{
947
66.1k
    SessionConfig_t const *const cfg = &gfc->cfg;
948
66.1k
    EncStateVar_t *const esv = &gfc->sv_enc;
949
66.1k
    int     gr, k, ch;
950
66.1k
    const sample_t *wk;
951
952
66.1k
    wk = w0 + 286;
953
    /* thinking cache performance, ch->gr loop is better than gr->ch loop */
954
180k
    for (ch = 0; ch < cfg->channels_out; ch++) {
955
304k
        for (gr = 0; gr < cfg->mode_gr; gr++) {
956
189k
            int     band;
957
189k
            gr_info *const gi = &(gfc->l3_side.tt[gr][ch]);
958
189k
            FLOAT  *mdct_enc = gi->xr;
959
189k
            FLOAT  *samp = esv->sb_sample[ch][1 - gr][0];
960
961
1.89M
            for (k = 0; k < 18 / 2; k++) {
962
1.70M
                window_subband(wk, samp);
963
1.70M
                window_subband(wk + 32, samp + 32);
964
1.70M
                samp += 64;
965
1.70M
                wk += 64;
966
                /*
967
                 * Compensate for inversion in the analysis filter
968
                 */
969
29.0M
                for (band = 1; band < 32; band += 2) {
970
27.3M
                    samp[band - 32] *= -1;
971
27.3M
                }
972
1.70M
            }
973
974
            /*
975
             * Perform imdct of 18 previous subband samples
976
             * + 18 current subband samples
977
             */
978
6.25M
            for (band = 0; band < 32; band++, mdct_enc += 18) {
979
6.06M
                int     type = gi->block_type;
980
6.06M
                FLOAT const *const band0 = esv->sb_sample[ch][gr][0] + order[band];
981
6.06M
                FLOAT  *const band1 = esv->sb_sample[ch][1 - gr][0] + order[band];
982
6.06M
                if (gi->mixed_block_flag && band < 2)
983
0
                    type = 0;
984
6.06M
                if (esv->amp_filter[band] < 1e-12) {
985
1.52M
                    memset(mdct_enc, 0, 18 * sizeof(FLOAT));
986
1.52M
                }
987
4.54M
                else {
988
4.54M
                    if (esv->amp_filter[band] < 1.0) {
989
3.27M
                        for (k = 0; k < 18; k++)
990
3.09M
                            band1[k * 32] *= esv->amp_filter[band];
991
172k
                    }
992
4.54M
                    if (type == SHORT_TYPE) {
993
9.80M
                        for (k = -NS / 4; k < 0; k++) {
994
7.35M
                            FLOAT const w = win[SHORT_TYPE][k + 3];
995
7.35M
                            mdct_enc[k * 3 + 9] = band0[(9 + k) * 32] * w - band0[(8 - k) * 32];
996
7.35M
                            mdct_enc[k * 3 + 18] = band0[(14 - k) * 32] * w + band0[(15 + k) * 32];
997
7.35M
                            mdct_enc[k * 3 + 10] = band0[(15 + k) * 32] * w - band0[(14 - k) * 32];
998
7.35M
                            mdct_enc[k * 3 + 19] = band1[(2 - k) * 32] * w + band1[(3 + k) * 32];
999
7.35M
                            mdct_enc[k * 3 + 11] = band1[(3 + k) * 32] * w - band1[(2 - k) * 32];
1000
7.35M
                            mdct_enc[k * 3 + 20] = band1[(8 - k) * 32] * w + band1[(9 + k) * 32];
1001
7.35M
                        }
1002
2.45M
                        mdct_short(mdct_enc);
1003
2.45M
                    }
1004
2.09M
                    else {
1005
2.09M
                        FLOAT   work[18];
1006
20.9M
                        for (k = -NL / 4; k < 0; k++) {
1007
18.8M
                            FLOAT   a, b;
1008
18.8M
                            a = win[type][k + 27] * band1[(k + 9) * 32]
1009
18.8M
                                + win[type][k + 36] * band1[(8 - k) * 32];
1010
18.8M
                            b = win[type][k + 9] * band0[(k + 9) * 32]
1011
18.8M
                                - win[type][k + 18] * band0[(8 - k) * 32];
1012
18.8M
                            work[k + 9] = a - b * tantab_l[k + 9];
1013
18.8M
                            work[k + 18] = a * tantab_l[k + 9] + b;
1014
18.8M
                        }
1015
1016
2.09M
                        mdct_long(mdct_enc, work);
1017
2.09M
                    }
1018
4.54M
                }
1019
                /*
1020
                 * Perform aliasing reduction butterfly
1021
                 */
1022
6.06M
                if (type != SHORT_TYPE && band != 0) {
1023
24.5M
                    for (k = 7; k >= 0; --k) {
1024
21.8M
                        FLOAT   bu, bd;
1025
21.8M
                        bu = mdct_enc[k] * ca[k] + mdct_enc[-1 - k] * cs[k];
1026
21.8M
                        bd = mdct_enc[k] * cs[k] - mdct_enc[-1 - k] * ca[k];
1027
1028
21.8M
                        mdct_enc[-1 - k] = bu;
1029
21.8M
                        mdct_enc[k] = bd;
1030
21.8M
                    }
1031
2.72M
                }
1032
6.06M
            }
1033
189k
        }
1034
114k
        wk = w1 + 286;
1035
114k
        if (cfg->mode_gr == 1) {
1036
39.7k
            memcpy(esv->sb_sample[ch][0], esv->sb_sample[ch][1], 576 * sizeof(FLOAT));
1037
39.7k
        }
1038
114k
    }
1039
66.1k
}