count weighted votes for lag
[sparrow.git] / Makefile
blobae59df096fd8a6699246c81839c48337f59e1dfd
1 all::
3 #CFLAGS =
4 #LDFLAGS =
5 DEFINES = -DDSFMT_MEXP=19937
6 WARNINGS = -Wall -Wextra -Wno-unused-parameter
7 ALL_CFLAGS = $(VECTOR_FLAGS) -O3 $(WARNINGS) -pipe -DDSFMT_MEXP=19937 -std=gnu99 $(INCLUDES) $(CFLAGS)
8 ALL_LDFLAGS = $(LDFLAGS)
10 DSFMT_FLAGS = -finline-functions -fomit-frame-pointer -DNDEBUG -fno-strict-aliasing --param max-inline-insns-single=1800 -Wmissing-prototypes -std=c99
12 VECTOR_FLAGS = -msse2 -DHAVE_SSE2 -D__SSE2__ -floop-strip-mine -floop-block
14 # these *might* do something useful
15 # -fvisibility=hidden
16 #POSSIBLE_OPTIMISING_CFLAGS = -fmodulo-sched -fmodulo-sched-allow-regmoves -fgcse-sm -fgcse-las \
17 # -funsafe-loop-optimizations -Wunsafe-loop-optimizations -fsee -funsafe-math-optimizations and more
18 # "-combine -fwhole-program" with __attribute__((externally_visible))
19 # -fprofile-arcs and -fbranch-probabilities
20 #POSSIBLE_PESSIMISING_CFLAGS -fmudflap -fmudflapth -fmudflapir
22 SPARROW_SRC = gstsparrow.c dSFMT/dSFMT.c sparrow.c
24 CC = gcc
25 AR = ar
26 INSTALL = install
28 export GST_DEBUG = sparrow:4
29 #export GST_PLUGIN_PATH = .
31 #OPENCV_INCLUDE = -I/usr/include/opencv/
32 OPENCV_INCLUDE = -isystem /usr/local/include/opencv/
34 #GST_PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '_*\(gst_\|Gst\|GST_\).*'
35 GST_INCLUDES = -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2
36 INCLUDES = -I. $(GST_INCLUDES) -I/usr/include/liboil-0.3 $(OPENCV_INCLUDE)
38 LINKS = -L/usr/local/lib -lgstbase-0.10 -lgstreamer-0.10 -lgobject-2.0 \
39 -lglib-2.0 -lgstvideo-0.10 -lcxcore
40 # -lgstcontroller-0.10 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lcv -lcvaux -lhighgui
42 all:: libgstsparrow.so
44 libgstsparrow.so: gstsparrow.o sparrow.o dSFMT/dSFMT.o
45 $(CC) -shared -Wl,-O1 $+ $(GST_PLUGIN_LDFLAGS) $(INCLUDES) $(DEFINES) $(LINKS) -Wl,-soname -Wl,$@ \
46 -o $@
48 clean:
49 rm -f *.so *.o *.a *.d *.s
50 cd dSFMT && rm -f *.o *.s
51 rm -f sparrow_false_colour_lut.h sparrow_gamma_lut.h
53 dSFMT/dSFMT.o: dSFMT/dSFMT.c
54 $(CC) $(DSFMT_FLAGS) $(INCLUDES) -MD $(ALL_CFLAGS) -fvisibility=hidden $(CPPFLAGS) -c -o $@ $<
56 .c.o:
57 $(CC) $(INCLUDES) -c -MD $(ALL_CFLAGS) $(CPPFLAGS) -o $@ $<
58 # $(CC) $(INCLUDES) -c $(ALL_CFLAGS) $(CPPFLAGS) -MD $<
60 %.s: %.c
61 $(CC) $(INCLUDES) -S $(ALL_CFLAGS) $(CPPFLAGS) -o $@ $<
63 %.i: %.c
64 $(CC) $(INCLUDES) -E $(ALL_CFLAGS) $(CPPFLAGS) -o $@ $<
66 sparrow_gamma_lut.h: gamma.py
67 python $< > $@
69 sparrow_false_colour_lut.h: false_colour.py
70 python $< > $@
72 gstsparrow.c: sparrow_gamma_lut.h gstsparrow.h sparrow_false_colour_lut.h sparrow.h
74 sparrow.c: sparrow_gamma_lut.h gstsparrow.h sparrow_false_colour_lut.h sparrow.h
76 DEBUG_LEVEL = 5
77 TEST_GST_ARGS = --gst-plugin-path=. --gst-debug=sparrow:$(DEBUG_LEVEL)
78 TEST_INPUT_SIZE = width=320,height=240
79 TEST_OUTPUT_SIZE = width=320,height=240
80 TEST_V4L2_SHAPE = 'video/x-raw-yuv,format=(fourcc)YUY2,$(TEST_INPUT_SIZE),framerate=25/1'
81 TEST_OUTPUT_SHAPE = 'video/x-raw-rgb,$(TEST_OUTPUT_SIZE),framerate=25/1'
82 TEST_SINK = ximagesink
83 #TEST_SINK = fbdevsink
84 TEST_PIPE_TAIL = ffmpegcolorspace ! sparrow $(TEST_OPTIONS) ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK)
85 TEST_V4L2_PIPE_TAIL = $(TEST_V4L2_SHAPE) ! $(TEST_PIPE_TAIL)
87 test: all
88 gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_PIPE_TAIL)
90 test-times: all
91 timeout -3 20 time -v gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_PIPE_TAIL)
93 test-cam:
94 gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_PIPE_TAIL)
96 test-pattern: all
97 GST_DEBUG=sparrow:5 \
98 gst-launch $(TEST_GST_ARGS) videotestsrc ! $(TEST_V4L2_PIPE_TAIL)
100 TEST_VIDEO_FILE=/home/douglas/media/video/rochester-pal.avi
101 #TEST_VIDEO_FILE=/home/douglas/tv/newartland_2008_ep2_ps6313_part3.flv
103 test-file: all
104 gst-launch $(TEST_GST_ARGS) \
105 filesrc location=$(TEST_VIDEO_FILE) ! decodebin2 ! $(TEST_PIPE_TAIL)
107 inspect: all
108 gst-inspect $(TEST_GST_ARGS) sparrow $(TEST_OPTIONS)
111 #show filtered and unfiltered video side by side
112 test-tee: all
113 gst-launch $(TEST_GST_ARGS) v4l2src ! tee name=vid2 \
114 ! queue ! ffmpegcolorspace ! sparrow $(TEST_OPTIONS) ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK) \
115 vid2. ! queue ! ffmpegcolorspace ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK)
117 test-tee2: all
118 gst-launch $(TEST_GST_ARGS) -v v4l2src ! ffmpegcolorspace ! tee name=vid2 \
119 ! queue ! sparrow $(TEST_OPTIONS) ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK) \
120 vid2. ! queue ! fdsink | \
121 gst-launch fdsrc ! queue ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK)
124 TAGS:
125 $(RM) TAGS
126 # find -name "*.[ch]" | xargs etags -a
127 etags -R --exclude=junk --exclude=.git --exclude=prof
129 cscope:
130 $(RM) cscope.out
131 cscope -b $(shell echo "$(INCLUDES)" | sed s/-isystem/-I/)
133 cproto:
134 # cproto $(INCLUDES) -DUNUSED='' -S -i -X 0 *.c
135 cproto $(shell echo "$(INCLUDES)" | sed s/-isystem/-I/) -DUNUSED='' $(DEFINES) -S -X 0 *.c
137 cproto-nonstatic:
138 cproto $(INCLUDES) -DUNUSED='' $(DEFINES) -X 0 *.c
141 #oprofile: all
142 # sudo opcontrol --no-vmlinux $(OP_OPTS) && sudo opcontrol $(OP_OPTS) --start --verbose
143 # timeout -3 10 gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_SHAPE) ! ffmpegcolorspace \
144 # ! sparrow $(TEST_OPTIONS) ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK)
145 # opreport $(OP_OPTS)
147 sysprof:
148 make clean
149 make CFLAGS='-g -fno-inline -fno-inline-functions -fno-omit-frame-pointer'
150 lsmod | grep -q 'sysprof_module' || sudo modprobe sysprof-module
151 sysprof &
152 @echo "click the start button!"
154 splint:
155 splint $(INCLUDES) sparrow.c
156 flawfinder $(PWD)
159 unittest:
160 $(CC) $(INCLUDES) -MD $(ALL_CFLAGS) $(CPPFLAGS) -o test test.c
161 ./test
163 unittest-shifts:
164 $(CC) $(INCLUDES) -MD $(ALL_CFLAGS) $(CPPFLAGS) -o test shift_test.c
165 ./test
168 .PHONY: TAGS all cproto cproto-nonstatic sysprof splint