kolibrios/programs/media/ac97snd/trunk/mp3dec/l3alias.c
heavyiron 3eda462807 Kernel: Smoothing image code from Mario79, build scripts for skin and drivers/build.bat
Programs: fasm updated to 1.67.14, small fixes in desktop, stackcfg, calc, board, pipes, freecell, big cleanup of unused programs, added some applications from 0.6.3.0 distr...

git-svn-id: svn://kolibrios.org@205 a494cfbc-eb01-0410-851d-a64ba20cac60
2006-11-02 14:18:23 +00:00

39 lines
669 B
C

#include <math.h> //sqrt
static float csa[8][2]; /* antialias */
void alias_init()
{
float Ci[8] =
{
-0.6f, -0.535f, -0.33f, -0.185f, -0.095f, -0.041f, -0.0142f, -0.0037f
};
int i;
for (i = 0; i < 8; i++)
{
csa[i][0] = (float) (1.0 / sqrt(1.0 + Ci[i] * Ci[i]));
csa[i][1] = (float) (Ci[i] / sqrt(1.0 + Ci[i] * Ci[i]));
}
}
void antialias(float x[], int n)
{
int i, k;
float a, b;
for (k = 0; k < n; k++)
{
for (i = 0; i < 8; i++)
{
a = x[17 - i];
b = x[18 + i];
x[17 - i] = a * csa[i][0] - b * csa[i][1];
x[18 + i] = b * csa[i][0] + a * csa[i][1];
}
x += 18;
}
}