1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <math.h>
# define M_PI 3.14159265358979323846
static double cos64[16], cos32[8], cos16[4], cos8[2], cos4[1];
double *pnts[] = { cos64,cos32,cos16,cos8,cos4 };
//double pnts[16];
#ifndef DOUBLE_TO_REAL
# define DOUBLE_TO_REAL(x) (double)(x)
#endif
void prepare_decode_tables()
{
#if !defined(REAL_IS_FIXED) || !defined(PRECALC_TABLES)
int i, k, kr, divv;
double *costab;
double gi;
for (i = 0; i < 5; i++)
{
kr = 0x10 >> i; divv = 0x40 >> i;
costab = pnts[i];
for (k = 0; k < kr; k++)
{
costab[k] = DOUBLE_TO_REAL(1.0 / (2.0 * cos(M_PI * ((double)k * 2.0 + 1.0) / 1.0 / (double)divv)));
}
}
#endif |
Partager