Browse code

Rename costablegen.c ---> cos_tablegen.c.

This is consistent with how all other table generation programs are named.
Moreover this ensures that the cos table generation program is correctly
deleted when cleaning the tree.

Diego Biurrun authored on 2011/05/16 07:53:07
Showing 3 changed files
... ...
@@ -666,7 +666,7 @@ TESTPROGS = cabac dct eval fft fft-fixed h264 iirfilter rangecoder snow
666 666
 TESTPROGS-$(HAVE_MMX) += motion
667 667
 TESTOBJS = dctref.o
668 668
 
669
-HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen costablegen       \
669
+HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen      \
670 670
             dv_tablegen motionpixels_tablegen mpegaudio_tablegen        \
671 671
             pcm_tablegen qdm2_tablegen sinewin_tablegen
672 672
 
... ...
@@ -681,7 +681,7 @@ $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
681 681
 TRIG_TABLES  = cos cos_fixed sin
682 682
 TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
683 683
 
684
-$(TRIG_TABLES): $(SUBDIR)%_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
684
+$(TRIG_TABLES): $(SUBDIR)%_tables.c: $(SUBDIR)cos_tablegen$(HOSTEXESUF)
685 685
 	$(M)./$< $* > $@
686 686
 
687 687
 ifdef CONFIG_SMALL
688 688
new file mode 100644
... ...
@@ -0,0 +1,76 @@
0
+/*
1
+ * Generate a header file for hardcoded ff_cos_* tables
2
+ *
3
+ * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
4
+ *
5
+ * This file is part of Libav.
6
+ *
7
+ * Libav is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * Libav is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with Libav; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+#include <stdio.h>
23
+#include <string.h>
24
+#include <math.h>
25
+
26
+#ifndef M_PI
27
+#define M_PI 3.14159265358979323846
28
+#endif
29
+#define BITS 16
30
+#define FLOATFMT "%.18e"
31
+#define FIXEDFMT "%6d"
32
+
33
+static int clip_f15(int v)
34
+{
35
+    return v < -32767 ? -32767 :
36
+           v >  32767 ?  32767 :
37
+           v;
38
+}
39
+
40
+static void printval(double val, int fixed)
41
+{
42
+    if (fixed)
43
+        printf(" "FIXEDFMT",", clip_f15(lrint(val * (double)(1<<15))));
44
+    else
45
+        printf(" "FLOATFMT",", val);
46
+
47
+}
48
+
49
+int main(int argc, char *argv[])
50
+{
51
+    int i, j;
52
+    int do_sin = argc > 1 && !strcmp(argv[1], "sin");
53
+    int fixed  = argc > 1 &&  strstr(argv[1], "fixed");
54
+    double (*func)(double) = do_sin ? sin : cos;
55
+
56
+    printf("/* This file was automatically generated. */\n");
57
+    printf("#define CONFIG_FFT_FLOAT %d\n", !fixed);
58
+    printf("#include \"libavcodec/%s\"\n", do_sin ? "rdft.h" : "fft.h");
59
+    for (i = 4; i <= BITS; i++) {
60
+        int m = 1 << i;
61
+        double freq = 2*M_PI/m;
62
+        printf("%s(%i) = {\n   ", do_sin ? "SINTABLE" : "COSTABLE", m);
63
+        for (j = 0; j < m/2 - 1; j++) {
64
+            int idx = j > m/4 ? m/2 - j : j;
65
+            if (do_sin && j >= m/4)
66
+                idx = m/4 - j;
67
+            printval(func(idx*freq), fixed);
68
+            if ((j & 3) == 3)
69
+                printf("\n   ");
70
+        }
71
+        printval(func(do_sin ? -(m/4 - 1)*freq : freq), fixed);
72
+        printf("\n};\n");
73
+    }
74
+    return 0;
75
+}
0 76
deleted file mode 100644
... ...
@@ -1,76 +0,0 @@
1
-/*
2
- * Generate a header file for hardcoded ff_cos_* tables
3
- *
4
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
5
- *
6
- * This file is part of Libav.
7
- *
8
- * Libav is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * Libav is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with Libav; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#include <stdio.h>
24
-#include <string.h>
25
-#include <math.h>
26
-
27
-#ifndef M_PI
28
-#define M_PI 3.14159265358979323846
29
-#endif
30
-#define BITS 16
31
-#define FLOATFMT "%.18e"
32
-#define FIXEDFMT "%6d"
33
-
34
-static int clip_f15(int v)
35
-{
36
-    return v < -32767 ? -32767 :
37
-           v >  32767 ?  32767 :
38
-           v;
39
-}
40
-
41
-static void printval(double val, int fixed)
42
-{
43
-    if (fixed)
44
-        printf(" "FIXEDFMT",", clip_f15(lrint(val * (double)(1<<15))));
45
-    else
46
-        printf(" "FLOATFMT",", val);
47
-
48
-}
49
-
50
-int main(int argc, char *argv[])
51
-{
52
-    int i, j;
53
-    int do_sin = argc > 1 && !strcmp(argv[1], "sin");
54
-    int fixed  = argc > 1 &&  strstr(argv[1], "fixed");
55
-    double (*func)(double) = do_sin ? sin : cos;
56
-
57
-    printf("/* This file was automatically generated. */\n");
58
-    printf("#define CONFIG_FFT_FLOAT %d\n", !fixed);
59
-    printf("#include \"libavcodec/%s\"\n", do_sin ? "rdft.h" : "fft.h");
60
-    for (i = 4; i <= BITS; i++) {
61
-        int m = 1 << i;
62
-        double freq = 2*M_PI/m;
63
-        printf("%s(%i) = {\n   ", do_sin ? "SINTABLE" : "COSTABLE", m);
64
-        for (j = 0; j < m/2 - 1; j++) {
65
-            int idx = j > m/4 ? m/2 - j : j;
66
-            if (do_sin && j >= m/4)
67
-                idx = m/4 - j;
68
-            printval(func(idx*freq), fixed);
69
-            if ((j & 3) == 3)
70
-                printf("\n   ");
71
-        }
72
-        printval(func(do_sin ? -(m/4 - 1)*freq : freq), fixed);
73
-        printf("\n};\n");
74
-    }
75
-    return 0;
76
-}