mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-08 18:39:54 +00:00
43 lines
638 B
C
43 lines
638 B
C
|
|
||
|
#include <stdio.h>
|
||
|
#include <math.h>
|
||
|
|
||
|
|
||
|
static int
|
||
|
get_value (int i)
|
||
|
{
|
||
|
int x;
|
||
|
|
||
|
x = floor (256 * (0.5 + 0.5 * sin (i * 2 * M_PI / 256)));
|
||
|
if (x > 255)
|
||
|
x = 255;
|
||
|
return x;
|
||
|
}
|
||
|
|
||
|
int
|
||
|
main (int argc, char *argv[])
|
||
|
{
|
||
|
int i;
|
||
|
int j;
|
||
|
|
||
|
printf ("static const guint8\n");
|
||
|
printf ("sine_table[256] = {\n");
|
||
|
for (i = 0; i < 256; i += 8) {
|
||
|
printf (" ");
|
||
|
for (j = 0; j < 8; j++) {
|
||
|
printf ("%3d", get_value (i + j));
|
||
|
if (j != 7) {
|
||
|
printf (", ");
|
||
|
} else {
|
||
|
if (i + j != 255) {
|
||
|
printf (",\n");
|
||
|
} else {
|
||
|
printf ("\n");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
printf ("};\n");
|
||
|
|
||
|
}
|