30 #define FLOATFMT "%.18e"
31 #define FIXEDFMT "%6d"
35 return v < -32767 ? -32767 :
44 double new_val =
val * (double) (1 << 15);
46 new_val = new_val >= 0 ?
floor(new_val + 0.5) :
ceil(new_val - 0.5);
54 int main(
int argc,
char *argv[])
57 int do_sin = argc > 1 && !strcmp(argv[1],
"sin");
58 int fixed = argc > 1 && strstr(argv[1],
"fixed");
59 double (*
func)(double) = do_sin ? sin : cos;
61 printf(
"/* This file was automatically generated. */\n");
63 printf(
"#include \"libavcodec/%s\"\n", do_sin ?
"rdft.h" :
"fft.h");
66 double freq = 2*
M_PI/m;
67 printf(
"%s(%i) = {\n ", do_sin ?
"SINTABLE" :
"COSTABLE", m);
68 for (j = 0; j < m/2 - 1; j++) {
69 int idx = j > m/4 ? m/2 - j : j;
70 if (do_sin && j >= m/4)