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
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
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
,$@ \
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
$@
$<
57 $(CC
) $(INCLUDES
) -c
-MD
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
$@
$<
58 # $(CC) $(INCLUDES) -c $(ALL_CFLAGS) $(CPPFLAGS) -MD $<
61 $(CC
) $(INCLUDES
) -S
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
$@
$<
64 $(CC
) $(INCLUDES
) -E
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
$@
$<
66 sparrow_gamma_lut.h
: gamma.py
69 sparrow_false_colour_lut.h
: false_colour.py
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
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
)
88 gst-launch
$(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_PIPE_TAIL
)
91 timeout
-3 20 time
-v gst-launch
$(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_PIPE_TAIL
)
94 gst-launch
$(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_PIPE_TAIL
)
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
104 gst-launch
$(TEST_GST_ARGS
) \
105 filesrc location
=$(TEST_VIDEO_FILE
) ! decodebin2
! $(TEST_PIPE_TAIL
)
108 gst-inspect
$(TEST_GST_ARGS
) sparrow
$(TEST_OPTIONS
)
111 #show filtered and unfiltered video side by side
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
)
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
)
126 # find -name "*.[ch]" | xargs etags -a
127 etags
-R
--exclude
=junk
--exclude
=.git
--exclude
=prof
131 cscope
-b
$(shell echo
"$(INCLUDES)" | sed s
/-isystem
/-I
/)
134 # cproto $(INCLUDES) -DUNUSED='' -S -i -X 0 *.c
135 cproto
$(shell echo
"$(INCLUDES)" | sed s
/-isystem
/-I
/) -DUNUSED
='' $(DEFINES
) -S
-X
0 *.c
138 cproto
$(INCLUDES
) -DUNUSED
='' $(DEFINES
) -X
0 *.c
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)
149 make CFLAGS
='-g -fno-inline -fno-inline-functions -fno-omit-frame-pointer'
150 lsmod | grep
-q
'sysprof_module' || sudo modprobe sysprof-module
152 @echo
"click the start button!"
155 splint
$(INCLUDES
) sparrow.c
160 $(CC
) $(INCLUDES
) -MD
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
test test.c
164 $(CC
) $(INCLUDES
) -MD
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
test shift_test.c
168 .PHONY
: TAGS
all cproto cproto-nonstatic sysprof splint