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 #POSSIBLE_OPTIMISING_CFLAGS = -fmodulo-sched -fmodulo-sched-allow-regmoves -fgcse-sm -fgcse-las \
16 # -funsafe-loop-optimizations -Wunsafe-loop-optimizations -fsee -funsafe-math-optimizations and more
17 #POSSIBLE_PESSIMISING_CFLAGS -fmudflap -fmudflapth -fmudflapir
19 SPARROW_SRC
= gstsparrow.c dSFMT
/dSFMT.c sparrow.c
25 export GST_DEBUG
= sparrow
:4
26 #export GST_PLUGIN_PATH = .
28 #OPENCV_INCLUDE = -I/usr/include/opencv/
29 OPENCV_INCLUDE
= -isystem
/usr
/local
/include/opencv
/
31 #GST_PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '_*\(gst_\|Gst\|GST_\).*'
32 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
33 INCLUDES
= -I.
$(GST_INCLUDES
) -I
/usr
/include/liboil-0.3
$(OPENCV_INCLUDE
)
35 LINKS
= -L
/usr
/local
/lib
-lgstbase-0.10
-lgstreamer-0.10
-lgobject-2.0 \
36 -lglib-2.0
-lgstvideo-0.10
-lcxcore
37 # -lgstcontroller-0.10 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lcv -lcvaux -lhighgui
39 all:: libgstsparrow.so
41 libgstsparrow.so
: gstsparrow.o sparrow.o dSFMT
/dSFMT.o
42 $(CC
) -shared
-Wl
,-O1
$+ $(GST_PLUGIN_LDFLAGS
) $(INCLUDES
) $(DEFINES
) $(LINKS
) -Wl
,-soname
-Wl
,$@ \
46 rm -f
*.so
*.o
*.a
*.d
*.s
47 cd dSFMT
&& rm -f
*.o
*.s
48 rm -f sparrow_false_colour_lut.h sparrow_gamma_lut.h
50 dSFMT
/dSFMT.o
: dSFMT
/dSFMT.c
51 $(CC
) $(DSFMT_FLAGS
) $(INCLUDES
) -MD
$(ALL_CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
54 $(CC
) $(INCLUDES
) -c
-MD
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
$@
$<
55 # $(CC) $(INCLUDES) -c $(ALL_CFLAGS) $(CPPFLAGS) -MD $<
58 $(CC
) $(INCLUDES
) -S
$(ALL_CFLAGS
) $(CPPFLAGS
) -o
$@
$<
60 sparrow_gamma_lut.h
: gamma.py
63 sparrow_false_colour_lut.h
: false_colour.py
66 gstsparrow.c
: sparrow_gamma_lut.h gstsparrow.h sparrow_false_colour_lut.h sparrow.h
68 sparrow.c
: sparrow_gamma_lut.h gstsparrow.h sparrow_false_colour_lut.h sparrow.h
70 TEST_GST_ARGS
= --gst-plugin-path
=.
--gst-debug
=sparrow
:5
71 TEST_INPUT_SIZE
= width
=320,height
=240
72 TEST_OUTPUT_SIZE
= width
=320,height
=240
73 TEST_V4L2_SHAPE
= 'video/x-raw-yuv,format=(fourcc)YUY2,$(TEST_INPUT_SIZE),framerate=25/1'
74 TEST_OUTPUT_SHAPE
= 'video/x-raw-rgb,$(TEST_OUTPUT_SIZE)'
77 gst-launch
$(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_SHAPE
) ! ffmpegcolorspace
! sparrow
$(TEST_OPTIONS
) ! ximagesink
80 timeout
-3 20 time
-v gst-launch
$(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_SHAPE
) \
81 ! ffmpegcolorspace
! sparrow
$(TEST_OPTIONS
) ! ximagesink
84 gst-launch
$(TEST_GST_ARGS
) v4l2src
! $(TEST_V4L2_SHAPE
) ! ffmpegcolorspace
! ximagesink
88 gst-launch
$(TEST_GST_ARGS
) videotestsrc
! ffmpegcolorspace
! sparrow
$(TEST_OPTIONS
) ! ximagesink
90 TEST_VIDEO_FILE
=/home
/douglas
/media
/video
/rochester-pal.avi
91 #TEST_VIDEO_FILE=/home/douglas/tv/newartland_2008_ep2_ps6313_part3.flv
94 gst-launch
$(TEST_GST_ARGS
) \
95 filesrc location
=$(TEST_VIDEO_FILE
) ! decodebin2 \
96 ! ffmpegcolorspace
! sparrow
$(TEST_OPTIONS
) ! ximagesink
99 gst-inspect
$(TEST_GST_ARGS
) sparrow
$(TEST_OPTIONS
)
102 #show filtered and unfiltered video side by side
104 gst-launch
$(TEST_GST_ARGS
) v4l2src
! tee name
=vid2 \
105 ! queue
! ffmpegcolorspace
! sparrow
$(TEST_OPTIONS
) ! ximagesink \
106 vid2.
! queue
! ffmpegcolorspace
! ximagesink
109 gst-launch
$(TEST_GST_ARGS
) -v v4l2src
! ffmpegcolorspace
! tee name
=vid2 \
110 ! queue
! sparrow
$(TEST_OPTIONS
) ! ximagesink \
111 vid2.
! queue
! fdsink | \
112 gst-launch fdsrc
! queue
! ximagesink
117 # find -name "*.[ch]" | xargs etags -a
121 # cproto $(INCLUDES) -DUNUSED='' -S -i -X 0 *.c
122 cproto
$(INCLUDES
) -DUNUSED
='' $(DEFINES
) -S
-X
0 *.c
125 cproto
$(INCLUDES
) -DUNUSED
='' $(DEFINES
) -X
0 *.c
129 # sudo opcontrol --no-vmlinux $(OP_OPTS) && sudo opcontrol $(OP_OPTS) --start --verbose
130 # timeout -3 10 gst-launch $(TEST_GST_ARGS) v4l2src ! $(TEST_V4L2_SHAPE) ! ffmpegcolorspace \
131 # ! sparrow $(TEST_OPTIONS) ! ximagesink
132 # opreport $(OP_OPTS)
136 make CFLAGS
='-g -fno-inline -fno-inline-functions -fno-omit-frame-pointer'
137 lsmod | grep
-q
'sysprof_module' || sudo modprobe sysprof-module
139 @echo
"click the start button!"
142 splint
$(INCLUDES
) sparrow.c
148 .PHONY
: TAGS
all cproto cproto-nonstatic sysprof splint