2
* Musepack audio compression
3
* Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#include "mpc/mpcmath.h"
24
const float tabatan2 [ 2*TABSTEP+1] [2];
25
const float tabcos [26*TABSTEP+1] [2];
26
const float tabsqrt_ex [256];
27
const float tabsqrt_m [ TABSTEP+1] [2];
30
void Init_FastMath ( void )
32
int i; mpc_floatint X, Y; double xm, x0, xp, x, y; float* p;
34
p = (float*) tabatan2;
35
for ( i = -TABSTEP; i <= TABSTEP; i++ ) {
36
xm = atan ((i-0.5)/TABSTEP);
37
x0 = atan ((i+0.0)/TABSTEP);
38
xp = atan ((i+0.5)/TABSTEP);
39
x = x0/2 + (xm + xp)/4;
46
for ( i = -13*TABSTEP; i <= 13*TABSTEP; i++ ) {
47
xm = cos ((i-0.5)/TABSTEP);
48
x0 = cos ((i+0.0)/TABSTEP);
49
xp = cos ((i+0.5)/TABSTEP);
50
x = x0/2 + (xm + xp)/4;
56
p = (float*) tabsqrt_ex;
57
for ( i = 0; i < 255; i++ ) {
59
Y.n = (i << 23) + (1<<23) - 1;
62
X.n = (255 << 23) - 1;
65
p = (float*) tabsqrt_m;
66
for ( i = 1*TABSTEP; i <= 2*TABSTEP; i++ ) {
67
xm = sqrt ((i-0.5)/TABSTEP);
68
x0 = sqrt ((i+0.0)/TABSTEP);
69
xp = sqrt ((i+0.5)/TABSTEP);
70
x = x0/2 + (xm + xp)/4;