| 1 |
/* |
| 2 |
The function to compute the cos tables at runtime or for pregeneration. |
| 3 |
|
| 4 |
copyright ?-2021 by the mpg123 project - free software under the terms of the LGPL 2.1 |
| 5 |
see COPYING and AUTHORS files in distribution or http://mpg123.org |
| 6 |
initially written by Michael Hipp (in tabinit.c). |
| 7 |
|
| 8 |
The type clreal is either double or float, COS() is cos() or cosf() for runtime. |
| 9 |
*/ |
| 10 |
|
| 11 |
void INT123_init_costabs(void) |
| 12 |
{ |
| 13 |
clreal *cpnts[] = { cos64,cos32,cos16,cos8,cos4 }; |
| 14 |
int i,k,kr,divv; |
| 15 |
clreal *costab; |
| 16 |
|
| 17 |
for(i=0;i<5;i++) |
| 18 |
{ |
| 19 |
kr=0x10>>i; divv=0x40>>i; |
| 20 |
costab = cpnts[i]; |
| 21 |
for(k=0;k<kr;k++) |
| 22 |
costab[k] = 1.0 / (2.0 * COS(M_PI * ((clreal) k * 2.0 + 1.0) / (clreal) divv)); |
| 23 |
} |
| 24 |
} |