[FFmpeg-cvslog] Simplify trig table rules

Mans Rullgard git at videolan.org
Fri May 20 06:00:42 CEST 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Thu May 19 18:34:40 2011 +0100| [272874c9dbde5d48884c417b76f3c7f04938c92f] | committer: Mans Rullgard

Simplify trig table rules

This collapses the make rules for the trig tables into a pattern
rule.  Based on a patch by Diego, modified to avoid using fragile
make constructs and allow future addition of fixed-point sin tables.

Signed-off-by: Mans Rullgard <mans at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=272874c9dbde5d48884c417b76f3c7f04938c92f
---

 libavcodec/Makefile      |   11 ++++-------
 libavcodec/costablegen.c |    2 +-
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4765ceb..7a9d897 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -676,14 +676,11 @@ include $(SUBDIR)../subdir.mak
 
 $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
 
-$(SUBDIR)cos_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
-	$(M)./$< > $@
-
-$(SUBDIR)cos_fixed_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
-	$(M)./$< cos fixed > $@
+TRIG_TABLES  = cos cos_fixed sin
+TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
 
-$(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
-	$(M)./$< sin > $@
+$(TRIG_TABLES): $(SUBDIR)%_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
+	$(M)./$< $* > $@
 
 ifdef CONFIG_SMALL
 $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
diff --git a/libavcodec/costablegen.c b/libavcodec/costablegen.c
index 6bfb8ea..5e52c48 100644
--- a/libavcodec/costablegen.c
+++ b/libavcodec/costablegen.c
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
 {
     int i, j;
     int do_sin = argc > 1 && !strcmp(argv[1], "sin");
-    int fixed  = argc > 2 && !strcmp(argv[2], "fixed");
+    int fixed  = argc > 1 &&  strstr(argv[1], "fixed");
     double (*func)(double) = do_sin ? sin : cos;
 
     printf("/* This file was automatically generated. */\n");



More information about the ffmpeg-cvslog mailing list