convert mesh to fullsize LUT
[sparrow.git] / Makefile
blobbdbd3e29ab9c6ed6b0c88eb74ac6284ef1d007d8
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 -D_GNU_SOURCE -DDSFMT_MEXP=19937 -std=gnu99 $(INCLUDES) $(CFLAGS)
8 ALL_LDFLAGS = $(LDFLAGS)
11 DSFMT_FLAGS = -finline-functions -fomit-frame-pointer -DNDEBUG -fno-strict-aliasing --param max-inline-insns-single=1800 -Wmissing-prototypes -std=c99
13 VECTOR_FLAGS = -msse2 -DHAVE_SSE2 -D__SSE2__ -floop-strip-mine -floop-block
15 # these *might* do something useful
16 # -fvisibility=hidden
17 #POSSIBLE_OPTIMISING_CFLAGS = -fmodulo-sched -fmodulo-sched-allow-regmoves -fgcse-sm -fgcse-las \
18 # -funsafe-loop-optimizations -Wunsafe-loop-optimizations -fsee -funsafe-math-optimizations and more
19 # "-combine -fwhole-program" with __attribute__((externally_visible))
20 # -fprofile-arcs and -fbranch-probabilities
21 #POSSIBLE_PESSIMISING_CFLAGS -fmudflap -fmudflapth -fmudflapir
23 SPARROW_SRC = gstsparrow.c dSFMT/dSFMT.c sparrow.c
25 CC = gcc
26 AR = ar
27 INSTALL = install
29 export GST_DEBUG = sparrow:4
30 #export GST_PLUGIN_PATH = .
32 #OPENCV_INCLUDE = -I/usr/include/opencv/
33 OPENCV_INCLUDE = -isystem /usr/local/include/opencv/
35 #GST_PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '_*\(gst_\|Gst\|GST_\).*'
36 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
37 INCLUDES = -I. $(GST_INCLUDES) -I/usr/include/liboil-0.3 $(OPENCV_INCLUDE)
39 LINKS = -L/usr/local/lib -lgstbase-0.10 -lgstreamer-0.10 -lgobject-2.0 \
40 -lglib-2.0 -lgstvideo-0.10 -lcxcore -lcv
41 # -lgstcontroller-0.10 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lcv -lcvaux -lhighgui
43 all:: libgstsparrow.so
45 libgstsparrow.so: gstsparrow.o sparrow.o calibrate.o itworks.o floodfill.o edges.o dSFMT/dSFMT.o
46 $(CC) -shared -Wl,-O1 $+ $(GST_PLUGIN_LDFLAGS) $(INCLUDES) $(DEFINES) $(LINKS) -Wl,-soname -Wl,$@ \
47 -o $@
49 clean:
50 rm -f *.so *.o *.a *.d *.s
51 cd dSFMT && rm -f *.o *.s
52 rm -f sparrow_false_colour_lut.h sparrow_gamma_lut.h
54 dSFMT/dSFMT.o: dSFMT/dSFMT.c
55 $(CC) $(DSFMT_FLAGS) -MD $(ALL_CFLAGS) -fvisibility=hidden $(CPPFLAGS) -c -o $@ $<
57 .c.o:
58 $(CC) -c -MD $(ALL_CFLAGS) $(CPPFLAGS) -o $@ $<
59 # $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) -MD $<
61 %.s: %.c
62 $(CC) -S $(ALL_CFLAGS) $(CPPFLAGS) -o $@ $<
64 %.i: %.c
65 $(CC) -E $(ALL_CFLAGS) $(CPPFLAGS) -o $@ $<
67 sparrow_gamma_lut.h: gamma.py
68 python $< > $@
70 sparrow_false_colour_lut.h: false_colour.py
71 python $< > $@
73 gstsparrow.c: sparrow_gamma_lut.h gstsparrow.h sparrow_false_colour_lut.h sparrow.h
75 sparrow.c: sparrow_gamma_lut.h gstsparrow.h sparrow_false_colour_lut.h sparrow.h
77 DEBUG_LEVEL = 5
78 TEST_GST_ARGS = --gst-plugin-path=. --gst-debug=sparrow:$(DEBUG_LEVEL)
79 TEST_INPUT_SIZE = width=320,height=240
80 TEST_OUTPUT_SIZE = width=320,height=240
81 TEST_V4L2_SHAPE = 'video/x-raw-yuv,format=(fourcc)YUY2,$(TEST_INPUT_SIZE),framerate=25/1'
82 TEST_OUTPUT_SHAPE = 'video/x-raw-rgb,$(TEST_OUTPUT_SIZE),framerate=25/1'
83 TEST_SINK = ximagesink
84 #TEST_SINK = fbdevsink
85 TEST_PIPE_TAIL = ffmpegcolorspace ! sparrow $(TEST_OPTIONS) ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK)
86 TEST_V4L2_PIPE_TAIL = $(TEST_V4L2_SHAPE) ! $(TEST_PIPE_TAIL)
88 test: all
89 gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_PIPE_TAIL)
91 test-valgrind: debug
92 valgrind --log-file=valgrind.log --trace-children=yes --suppressions=valgrind-python.supp \
93 gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_PIPE_TAIL) 2> gst.log
95 test-nemiver: debug
96 nemiver "gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_PIPE_TAIL)"
99 test-times: all
100 timeout -3 20 time -v gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_PIPE_TAIL)
102 test-cam:
103 gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_PIPE_TAIL)
105 test-pattern: all
106 GST_DEBUG=sparrow:5 \
107 gst-launch $(TEST_GST_ARGS) videotestsrc ! $(TEST_V4L2_PIPE_TAIL)
109 TEST_VIDEO_FILE=/home/douglas/media/video/rochester-pal.avi
110 #TEST_VIDEO_FILE=/home/douglas/tv/newartland_2008_ep2_ps6313_part3.flv
112 test-file: all
113 gst-launch $(TEST_GST_ARGS) \
114 filesrc location=$(TEST_VIDEO_FILE) ! decodebin2 ! $(TEST_PIPE_TAIL)
116 inspect: all
117 gst-inspect $(TEST_GST_ARGS) sparrow $(TEST_OPTIONS)
120 #show filtered and unfiltered video side by side
121 test-tee: all
122 gst-launch $(TEST_GST_ARGS) v4l2src ! tee name=vid2 \
123 ! queue ! ffmpegcolorspace ! sparrow $(TEST_OPTIONS) ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK) \
124 vid2. ! queue ! ffmpegcolorspace ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK)
126 test-tee2: all
127 gst-launch $(TEST_GST_ARGS) -v v4l2src ! ffmpegcolorspace ! tee name=vid2 \
128 ! queue ! sparrow $(TEST_OPTIONS) ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK) \
129 vid2. ! queue ! fdsink | \
130 gst-launch fdsrc ! queue ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK)
133 TAGS:
134 $(RM) TAGS
135 # find -name "*.[ch]" | xargs etags -a
136 etags -R --exclude=junk --exclude=.git --exclude=prof
138 cscope:
139 $(RM) cscope.out
140 cscope -b $(shell echo "$(INCLUDES)" | sed s/-isystem/-I/)
143 CPROTO_INCLUDES = $(shell echo "$(INCLUDES)" | sed s/-isystem/-I/)
145 cproto:
146 # cproto $(INCLUDES) -DUNUSED='' -S -i -X 0 *.c
147 cproto $(CPROTO_INCLUDES) -DUNUSED='' $(DEFINES) -S -X 0 *.c
149 cproto-nonstatic:
150 cproto $(CPROTO_INCLUDES) -DUNUSED='' $(DEFINES) -X 0 *.c
153 #oprofile: all
154 # sudo opcontrol --no-vmlinux $(OP_OPTS) && sudo opcontrol $(OP_OPTS) --start --verbose
155 # timeout -3 10 gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_SHAPE) ! ffmpegcolorspace \
156 # ! sparrow $(TEST_OPTIONS) ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK)
157 # opreport $(OP_OPTS)
159 sysprof: debug
160 lsmod | grep -q 'sysprof_module' || sudo modprobe sysprof-module
161 sysprof &
162 @echo "click the start button!"
164 splint:
165 splint $(INCLUDES) sparrow.c
166 flawfinder $(PWD)
169 unittest:
170 $(CC) -MD $(ALL_CFLAGS) $(CPPFLAGS) -o test test.c
171 ./test
173 unittest-shifts:
174 $(CC) -MD $(ALL_CFLAGS) $(CPPFLAGS) -o test shift_test.c
175 ./test
177 CV_LINKS = -lcv -lcvaux -lhighgui
179 unittest-edges:
180 $(CC) -MD $(ALL_CFLAGS) $(CPPFLAGS) $(CV_LINKS) -o test test-find-edge.c
181 ./test
184 debug:
185 make -B CFLAGS='-g -fno-inline -fno-inline-functions -fno-omit-frame-pointer'
187 #ccmalloc
188 ccmalloc:
189 make -B CFLAGS='-lccmalloc -g' CC='ccmalloc --nowrapper gcc'
192 .PHONY: TAGS all cproto cproto-nonstatic sysprof splint unittest unittest-shifts unittest-edges \
193 debug ccmalloc