5 DEFINES
= -DDSFMT_MEXP
=19937
6 WARNINGS
= -Wall
-Wextra
-Wno-unused-parameter
9 ifeq "$(ARCH)" "x86_64"
10 ARCH_CFLAGS
= -fPIC
-DPIC
-m64
12 ARCH_CFLAGS
= -m32
-msse2
15 ALL_CFLAGS
= -march
=native
-pthread
$(VECTOR_FLAGS
) -O3
$(WARNINGS
) -pipe
-D_GNU_SOURCE
-DDSFMT_MEXP
=19937 -std
=gnu99
$(INCLUDES
) $(ARCH_CFLAGS
) $(CFLAGS
)
16 ALL_LDFLAGS
= $(LDFLAGS
)
19 DSFMT_FLAGS
= -finline-functions
-fomit-frame-pointer
-DNDEBUG
-fno-strict-aliasing
--param max-inline-insns-single
=1800 -Wmissing-prototypes
-std
=c99
21 VECTOR_FLAGS
= -msse2
-DHAVE_SSE2
-D__SSE2__
-floop-strip-mine
-floop-block
23 # these *might* do something useful
25 #POSSIBLE_OPTIMISING_CFLAGS = -fmodulo-sched -fmodulo-sched-allow-regmoves -fgcse-sm -fgcse-las \
26 # -funsafe-loop-optimizations -Wunsafe-loop-optimizations -fsee -funsafe-math-optimizations and more
27 # "-combine -fwhole-program" with __attribute__((externally_visible))
28 # -fprofile-arcs and -fbranch-probabilities
29 #POSSIBLE_PESSIMISING_CFLAGS -fmudflap -fmudflapth -fmudflapir
31 SPARROW_SRC
= gstsparrow.c dSFMT
/dSFMT.c sparrow.c
37 export GST_DEBUG
= sparrow
:4
38 #export GST_PLUGIN_PATH = .
40 OPENCV_PREFIX
= $(shell test -d
/usr
/local
/include/opencv
&& echo
/usr
/local || echo
/usr
)
42 #OPENCV_INCLUDE = -I/usr/include/opencv/
43 OPENCV_INCLUDE
= -isystem
$(OPENCV_PREFIX
)/include/opencv
/
45 #GST_PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '_*\(gst_\|Gst\|GST_\).*'
46 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
47 INCLUDES
= -I.
$(GST_INCLUDES
) -I
/usr
/include/liboil-0.3
$(OPENCV_INCLUDE
)
49 LINKS
= -L
/usr
/local
/lib
-lgstbase-0.10
-lgstreamer-0.10
-lgobject-2.0 \
50 -lglib-2.0
-lgstvideo-0.10
-lcxcore
-lcv
51 # -lgstcontroller-0.10 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lcv -lcvaux -lhighgui
53 all:: libgstsparrow.so
55 libgstsparrow.so
: gstsparrow.o sparrow.o calibrate.o play.o floodfill.o edges.o dSFMT
/dSFMT.o
56 $(CC
) -shared
-Wl
,-O1
$+ $(GST_PLUGIN_LDFLAGS
) $(INCLUDES
) $(DEFINES
) $(LINKS
) -Wl
,-soname
-Wl
,$@ \
60 rm -f
*.so
*.o
*.a
*.d
*.s
61 cd dSFMT
&& rm -f
*.o
*.s
62 rm -f sparrow_false_colour_lut.h sparrow_gamma_lut.h
64 dSFMT
/dSFMT.o
: dSFMT
/dSFMT.c
65 $(CC
) $(DSFMT_FLAGS
) -MD
$(ALL_CFLAGS
) -fvisibility
=hidden
$(CPPFLAGS
) -c
-o
$@
$<
68 $(CC
) -c
-MD
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
$@
$<
69 # $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) -MD $<
72 $(CC
) -S
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
$@
$<
75 $(CC
) -E
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
$@
$<
77 sparrow_gamma_lut.h
: gamma.py
80 sparrow_false_colour_lut.h
: false_colour.py
83 gstsparrow.c
: sparrow_gamma_lut.h gstsparrow.h sparrow_false_colour_lut.h sparrow.h
85 sparrow.c
: sparrow_gamma_lut.h gstsparrow.h sparrow_false_colour_lut.h sparrow.h
87 GST_LAUNCH
= gst-launch-0.10
89 TEST_GST_ARGS
= --gst-plugin-path
=.
--gst-debug
=sparrow
:$(DEBUG_LEVEL
)
90 TEST_INPUT_SIZE
= width
=320,height
=240
91 TEST_OUTPUT_SIZE
= width
=320,height
=240
92 TEST_V4L2_SHAPE
= 'video/x-raw-yuv,format=(fourcc)YUY2,$(TEST_INPUT_SIZE),framerate=25/1'
93 TEST_OUTPUT_SHAPE
= 'video/x-raw-rgb,$(TEST_OUTPUT_SIZE),framerate=25/1'
94 TEST_SINK
= ximagesink
95 #TEST_SINK = fbdevsink
96 TEST_PIPE_TAIL
= ffmpegcolorspace
! sparrow
$(TEST_OPTIONS
) ! $(TEST_OUTPUT_SHAPE
) ! $(TEST_SINK
)
97 TEST_V4L2_PIPE_TAIL
= $(TEST_V4L2_SHAPE
) ! $(TEST_PIPE_TAIL
)
100 $(GST_LAUNCH
) $(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_PIPE_TAIL
)
103 valgrind
--log-file
=valgrind.log
--trace-children
=yes
--suppressions
=valgrind-python.supp \
104 $(GST_LAUNCH
) $(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_PIPE_TAIL
) 2> gst.log
107 echo
"set args $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_PIPE_TAIL)" > /tmp
/gdb-args.txt
108 gdb
-x
/tmp
/gdb-args.txt
$(GST_LAUNCH
)
111 timeout
-3 20 time
-v
$(GST_LAUNCH
) $(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_PIPE_TAIL
)
114 $(GST_LAUNCH
) $(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_PIPE_TAIL
)
117 GST_DEBUG
=sparrow
:5 \
118 $(GST_LAUNCH
) $(TEST_GST_ARGS
) videotestsrc
! $(TEST_V4L2_PIPE_TAIL
)
120 TEST_VIDEO_FILE
=/home
/douglas
/media
/video
/rochester-pal.avi
121 #TEST_VIDEO_FILE=/home/douglas/tv/newartland_2008_ep2_ps6313_part3.flv
124 $(GST_LAUNCH
) $(TEST_GST_ARGS
) \
125 filesrc location
=$(TEST_VIDEO_FILE
) ! decodebin2
! $(TEST_PIPE_TAIL
)
128 gst-inspect
$(TEST_GST_ARGS
) sparrow
$(TEST_OPTIONS
)
131 #show filtered and unfiltered video side by side
133 $(GST_LAUNCH
) $(TEST_GST_ARGS
) v4l2src
! tee name
=vid2 \
134 ! queue
! ffmpegcolorspace
! sparrow
$(TEST_OPTIONS
) ! $(TEST_OUTPUT_SHAPE
) ! $(TEST_SINK
) \
135 vid2.
! queue
! ffmpegcolorspace
! $(TEST_OUTPUT_SHAPE
) ! $(TEST_SINK
)
138 $(GST_LAUNCH
) $(TEST_GST_ARGS
) -v v4l2src
! ffmpegcolorspace
! tee name
=vid2 \
139 ! queue
! sparrow
$(TEST_OPTIONS
) ! $(TEST_OUTPUT_SHAPE
) ! $(TEST_SINK
) \
140 vid2.
! queue
! fdsink | \
141 $(GST_LAUNCH
) fdsrc
! queue
! $(TEST_OUTPUT_SHAPE
) ! $(TEST_SINK
)
146 # find -name "*.[ch]" | xargs etags -a
147 etags
-R
--exclude
=junk
--exclude
=.git
--exclude
=prof
151 cscope
-b
$(shell echo
"$(INCLUDES)" | sed s
/-isystem
/-I
/)
154 CPROTO_INCLUDES
= $(shell echo
"$(INCLUDES)" | sed s
/-isystem
/-I
/)
157 # cproto $(INCLUDES) -DUNUSED='' -S -i -X 0 *.c
158 cproto
$(CPROTO_INCLUDES
) -DUNUSED
='' $(DEFINES
) -S
-X
0 *.c
161 cproto
$(CPROTO_INCLUDES
) -DUNUSED
='' $(DEFINES
) -X
0 *.c
165 # sudo opcontrol --no-vmlinux $(OP_OPTS) && sudo opcontrol $(OP_OPTS) --start --verbose
166 # timeout -3 10 $(GST_LAUNCH) $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_SHAPE) ! ffmpegcolorspace \
167 # ! sparrow $(TEST_OPTIONS) ! $(TEST_OUTPUT_SHAPE) ! $(TEST_SINK)
168 # opreport $(OP_OPTS)
171 lsmod | grep
-q
'sysprof_module' || sudo modprobe sysprof-module || \
172 echo
"try again after 'sudo m-a a-i sysprof-module-source'"
174 @echo
"click the start button!"
177 splint
$(INCLUDES
) sparrow.c
182 $(CC
) -MD
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
test test.c
186 $(CC
) -MD
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
test shift_test.c
189 CV_LINKS
= -lcv
-lcvaux
-lhighgui
192 $(CC
) -MD
$(ALL_CFLAGS
) $(CPPFLAGS
) $(CV_LINKS
) -o
test test-find-edge.c
196 $(CC
) -MD
$(ALL_CFLAGS
) $(CPPFLAGS
) $(CV_LINKS
) -o
test test-median.c
201 make
-B CFLAGS
='-g -fno-inline -fno-inline-functions -fno-omit-frame-pointer'
205 make
-B CFLAGS
='-lccmalloc -g' CC
='ccmalloc --nowrapper gcc'
208 rsync
-t
$(shell git ls-tree
-r
--name-only HEAD
) 10.42.43.10:sparrow
211 .PHONY
: TAGS
all cproto cproto-nonstatic sysprof splint unittest unittest-shifts unittest-edges \