]> CRI, Mines Paris - PSL - Faustine.git/commitdiff
Replace Sys.time by Unix.time in main.ml.
authorWANG <wang@wang-OptiPlex-780.(none)>
Mon, 23 Sep 2013 14:49:47 +0000 (16:49 +0200)
committerWANG <wang@wang-OptiPlex-780.(none)>
Mon, 23 Sep 2013 14:49:47 +0000 (16:49 +0200)
Modify the input/output type of functions in morpho.lib from vector to matrix.

18 files changed:
Makefile
examples/2d_fft/Makefile
examples/close/Makefile
examples/close/close.dsp
examples/dilation/Makefile
examples/dilation/dilation.dsp
examples/erosion/Makefile
examples/erosion/erosion.dsp
examples/fft/Makefile
examples/fft/sinsum.dsp [new file with mode: 0644]
examples/licenceplate/Makefile
examples/open/Makefile
examples/open/open.dsp
examples/primitives/Makefile
examples/sinwave/Makefile
interpreter/main.ml
interpreter/preprocessor/faust-0.9.47mr3/compiler/Makefile
lib/morpho.lib

index 748378e4c94611aef2ee683ad64cd328daa8e227..5f8cbbad58d5c41fec7822b25cf081b4948d514a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ test:
        @echo "open $(SINWAVE_DIR)/output1.wav"
        @echo "octave -q --eval 'plot(wavread(\"$(SINWAVE_DIR)/output1.wav\")); pause'"
 
-example:
+examples::
        @($(MAKE) -C $(EXAMPLES_DIR))
 
 install :
index 1c58826e1620277f6ac15a7682aefe5b54a4488e..553124fd8081720faaa32bd27a63bbdea39a5ee4 100644 (file)
@@ -14,7 +14,7 @@ $(IMGOUT): $(CSVOUT)
        octave -qf img_write.m
 
 $(CSVOUT): $(SRC) $(CSVIN)
-       faustine -d $(SRC) -i $(CSVIN) -t $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
+       faustine -f $(SRC) -i $(CSVIN) -l $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
 
 $(CSVIN): $(IMGIN)
        octave -qf img_read.m
index 3e51a51b812481f6ed63d8779bd2be8ea8adfaf0..22c4885683e8157f7a502f383f56d95316cb4c05 100644 (file)
@@ -14,7 +14,7 @@ $(IMGOUT): $(CSVOUT)
        octave -qf img_write.m
 
 $(CSVOUT): $(SRC) $(CSVIN)
-       faustine -d $(SRC) -i $(CSVIN) -t $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
+       faustine -f $(SRC) -i $(CSVIN) -l $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
 
 $(CSVIN): $(IMGIN)
        octave -qf img_read.m
index e68d28cb88a3f9a5139396cd5be047bcbbdcf33f..9331bf92b55435ee507fb0e5cf8861c0a36d8dd1 100644 (file)
@@ -1,3 +1,3 @@
 import ("morpho.lib");
 
-process = closing_square(119, 123, 2);
+process = vectorize(123) : closing_square(119, 123, 2) : serialize;
index 1958879eb173e667dedbd60462405def36bd60ab..3d2c6dd2d85e364f5deb67360c126a0c971e1f52 100644 (file)
@@ -14,7 +14,7 @@ $(IMGOUT): $(CSVOUT)
        octave -qf img_write.m
 
 $(CSVOUT): $(SRC) $(CSVIN)
-       faustine -d $(SRC) -i $(CSVIN) -t $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
+       faustine -f $(SRC) -i $(CSVIN) -l $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
 
 $(CSVIN): $(IMGIN)
        octave -qf img_read.m
index 2ea985ed97f6807d12c67aff7cfb4dc11b635ec5..d69d8d4ea46bfb144d41d26ecb943575a16d8171 100644 (file)
@@ -1,3 +1,3 @@
 import ("morpho.lib");
 
-process = dilations_square(112, 150, 2);
+process = vectorize(150) : dilations_square(112, 150, 2) : serialize;
index 420030f57d7dd3b78bcdf8eadc9fdda1dedcd692..d70affebae7df9cf367fe57fc1b7f2e2a4dda652 100644 (file)
@@ -14,7 +14,7 @@ $(IMGOUT): $(CSVOUT)
        octave -qf img_write.m
 
 $(CSVOUT): $(SRC) $(CSVIN)
-       faustine -d $(SRC) -i $(CSVIN) -t $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
+       faustine -f $(SRC) -i $(CSVIN) -l $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
 
 $(CSVIN): $(IMGIN)
        octave -qf img_read.m
index 79389dd6f43e3456e7ac5e900f2757638c8aaf7b..4634feab18940d28dad2cc45b60271454c3bcafe 100644 (file)
@@ -1,3 +1,3 @@
 import ("morpho.lib");
 
-process = erosions_square(112, 150, 2);
+process = vectorize(150) : erosions_square(112, 150, 2) : serialize; 
index 8194124db8ac18a9dde37cf132c6822e6c50188a..cbe38a628d30ddc183cfe78890813cb12dccdf20 100644 (file)
@@ -4,8 +4,8 @@ FORMAT = csv
 CSVOUT = $(BASENAME)1.$(FORMAT)
 IMGOUT = $(SRC:.dsp=.png)
 
-SINS = four_sins.dsp
-WAV_BASENAME = $(SINS:.dsp=)
+SINSUM = sinsum.dsp
+WAV_BASENAME = $(SINSUM:.dsp=)
 WAV_FORMAT = wav
 WAVIN = $(WAV_BASENAME)1.$(WAV_FORMAT)
 
@@ -21,13 +21,13 @@ $(IMGOUT): $(CSVOUT)
        octave -qf img_write.m
 
 $(CSVOUT): $(SRC) $(WAVIN)
-       faustine -d $(SRC) -i $(WAVIN) --oformat $(FORMAT) --obasename $(BASENAME)
+       faustine -f $(SRC) -i $(WAVIN) --oformat $(FORMAT) --obasename $(BASENAME)
 
 $(WAVIN): $(SINS) $(INPUT1) $(INPUT2) $(INPUT3) $(INPUT4)
-       faustine -d $(SINS) -i $(INPUT1) -i $(INPUT2) -i $(INPUT3) -i $(INPUT4) --oformat $(WAV_FORMAT) --obasename $(WAV_BASENAME)
+       faustine -f $(SINSUM) -i $(INPUT1) -i $(INPUT2) -i $(INPUT3) -i $(INPUT4) --oformat $(WAV_FORMAT) --obasename $(WAV_BASENAME)
 
 clean::
-       rm -f gmon.out output*
+       rm -f gmon.out $(CSVOUT) $(IMGOUT) $(WAVIN) *~
 
 
 
diff --git a/examples/fft/sinsum.dsp b/examples/fft/sinsum.dsp
new file mode 100644 (file)
index 0000000..0ee1d5b
--- /dev/null
@@ -0,0 +1 @@
+process = +, + : +;
index c0597915d84fade0f23508b4b78b51826580e7ba..a30591bdfddc09db757ea7f230eec1ba2c9daa5f 100644 (file)
@@ -14,7 +14,7 @@ $(IMGOUT): $(CSVOUT)
        octave -qf img_write.m
 
 $(CSVOUT): $(SRC) $(CSVIN)
-       faustine -d $(SRC) -i $(CSVIN) -t $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
+       faustine -f $(SRC) -i $(CSVIN) -l $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
 
 $(CSVIN): $(IMGIN)
        octave -qf img_read.m
index 54199bad05d7ed92412d07d0b9a2e810a0335852..cdd7930b371ea34d8929cd40fbc04ac6df95c082 100644 (file)
@@ -14,7 +14,7 @@ $(IMGOUT): $(CSVOUT)
        octave -qf img_write.m
 
 $(CSVOUT): $(SRC) $(CSVIN)
-       faustine -d $(SRC) -i $(CSVIN) -t $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
+       faustine -f $(SRC) -i $(CSVIN) -l $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
 
 $(CSVIN): $(IMGIN)
        octave -qf img_read.m
index 00e155dd0e4f4a59c82e8122779d09e131453e9d..77a360eb5327dcd9d8b81d53393b1db9602a6ac3 100644 (file)
@@ -1,3 +1,3 @@
 import ("morpho.lib");
 
-process = opening_square(119, 123, 2);
+process = vectorize(123) : opening_square(119, 123, 2) : serialize;
index b392c2bd73ee0f7fca74bac8d6302d7b4f466394..fb73fc3405efafe1cd425bfd4ba6a2bf962a5431 100644 (file)
@@ -9,7 +9,7 @@ CSVOUT = $(BASENAME)1.$(FORMAT)
 all: $(CSVOUT)
 
 $(CSVOUT): $(SRC)
-       faustine -d $(SRC) -t $(SAMPLES) --oformat $(FORMAT) --obasename $(BASENAME)
+       faustine -f $(SRC) -l $(SAMPLES) --oformat $(FORMAT) --obasename $(BASENAME)
 
 clean::
        rm -f gmon.out output*
index c6d2ec9694432f5fd0e284ab546d14d1fc5d0181..064b7c8bf9446347806f18cffcf7937963230cbe 100644 (file)
@@ -7,7 +7,7 @@ WAVOUT = $(BASENAME)1.$(FORMAT)
 all: $(WAVOUT)
 
 $(WAVOUT): $(SRC)
-       faustine -d $< --obasename $(BASENAME) --oformat $(FORMAT)
+       faustine -f $< --obasename $(BASENAME) --oformat $(FORMAT)
 
 clean::
        rm -f gmon.out $(BASENAME)*
index ff94e29f433832cb297b407ca802a3b42bc49547..54c7f1a58789799f85f50243e286c96b6bed6c49 100644 (file)
@@ -13,7 +13,7 @@ exception Missing_Expression;;
 
 let version = "Faustine: 0.0.1";;
 
-let set_GC () = 
+ let set_GC () = 
        let _ = Gc.set { (Gc.get()) 
                       with Gc.minor_heap_size = 0xFFFFFF } in
        let _ = Gc.set { (Gc.get()) 
@@ -37,15 +37,15 @@ let format_output = ref "wav";;
 let basename_output = ref "output";;
 
 let option_usage = "usage: " ^ Sys.argv.(0) 
-  ^ " [-d dsp_src] [-i input] [-t time] [--odir dir] [--oformat wav/csv] [--obasename name]";;
+  ^ " [-f dsp_src] [-i input] [-l length] [--odir dir] [--oformat wav/csv] [--obasename name]";;
 
 let option_unknown = 
   fun x -> raise (Arg.Bad ("Bad argument : " ^ x))
 
 let speclist = [
-  ("-d", Arg.String (fun s -> path_dsp := s), ": set dsp source file");
+  ("-f", Arg.String (fun s -> path_dsp := s), ": faust .dsp source file");
   ("-i", Arg.String (fun s -> incr size_input; inputs := !inputs @ [s]), ": set input wave file");
-  ("-t", Arg.Int (fun i -> time_max := i), ": set max output length");
+  ("-l", Arg.Int (fun i -> time_max := i), ": maximun number of output samples");
   ("--odir", Arg.String (fun s -> dir_output := s), ": set output directory");
   ("--oformat", Arg.String (fun s -> format_output := s), ": set output format");
   ("--obasename", Arg.String (fun s -> basename_output := s), ": set output basename");
@@ -53,7 +53,12 @@ let speclist = [
  
 
 let main () = 
-
+(*
+        let () = print_endline (Scanf.Scanning.name_of_input (Scanf.Scanning.stdin)) in
+       let () = print_endline (Unix.readlink "/proc/self/fd/0") in
+       let () = print_endline (Unix.readlink "/proc/self/fd/1") in
+       let () = print_endline (Unix.readlink "/proc/self/fd/2") in
+*)
        let () = Arg.parse speclist option_unknown option_usage in
         let _ = Sys.signal Sys.sigalrm Sys.Signal_ignore in
        let _ = set_GC () in
@@ -62,46 +67,46 @@ let main () =
 
 
        let () = print_string("    Faustine -> Reading input ...") in
-       let tic0 = Sys.time () in
+       let tic0 = Unix.time () in
        let input = io#read !inputs in
-       let toc0 = Sys.time () in
+       let toc0 = Unix.time () in
        let () = print_endline(" Done. (duration: " ^ (string_of_float (toc0 -. tic0)) ^ "s.)") in
 
 
        let () = print_string("    Faustine -> Preprocessing...") in
-       let tic1 = Sys.time () in
+       let tic1 = Unix.time () in
        let faust_core = Preprocess.preprocess !path_dsp in
-       let toc1 = Sys.time () in
+       let toc1 = Unix.time () in
        let () = print_endline(" Done. (duration: " ^ (string_of_float (toc1 -. tic1)) ^ "s.)") in
 
 
        let () = print_string("    Faustine -> Constructing process...") in
-       let tic2 = Sys.time () in
+       let tic2 = Unix.time () in
        let faust_exp = exp_of_string faust_core in
        let proc = (new proc_factory)#make faust_exp in
-       let toc2 = Sys.time () in
+       let toc2 = Unix.time () in
        let () = print_endline(" Done. (duration: " ^ (string_of_float (toc2 -. tic2)) ^ "s.)") in
 
 
        let () = print_string("    Faustine -> Constructing signals...") in
-       let tic3 = Sys.time () in
+       let tic3 = Unix.time () in
        let output = proc#eval input in
-       let toc3 = Sys.time () in
+       let toc3 = Unix.time () in
        let () = print_endline(" Done. (duration: " ^ (string_of_float (toc3 -. tic3)) ^ "s.)") in
 
 
        let () = print_string("    Faustine -> Evaluating...") in
-       let tic4 = Sys.time () in
+       let tic4 = Unix.time () in
        let data = output#output !time_max in
        let rates = output#frequency in
-       let toc4 = Sys.time () in
+       let toc4 = Unix.time () in
        let () = print_endline(" Done. (duration: " ^ (string_of_float (toc4 -. tic4)) ^ "s.)") in
 
 
        let () = print_string("    Faustine -> Writing output...") in
-       let tic5 = Sys.time () in
+       let tic5 = Unix.time () in
        let output_paths = io#write rates data in
-       let toc5 = Sys.time () in
+       let toc5 = Unix.time () in
        let () = print_endline(" Done. (duration: " ^ (string_of_float (toc5 -. tic5)) ^ "s.)") in
 
        let _ = Array.map print_endline 
index 36665bf8ee64e50974aeaa15a81dc7b3c17400d5..5bfb3f93ef0dbbc8b45e54d8744c54a5691510a4 100755 (executable)
@@ -23,7 +23,7 @@ endif
 CXXFLAGS ?= -O3 -Wall -Wuninitialized $(ARCHFLAGS)
 CXXFLAGS += -Wno-parentheses $(addprefix -I, $(subprojects)) -DINSTALL_PREFIX='"$(prefix)"'
 
-all : faust preprocess.a # Haisheng WANG adds preprocess.a for multirate faust interpreter
+all : faust preprocess.a # Haisheng WANG adds preprocess.a for multirate faust interpreter
 
 faust : $(objects)
        $(CXX) $(CXXFLAGS) $(objects) -o faust
index 5c42861c6c5484c53addf9217c3c1b7336ffdce7..4b7e21bc377f479f1ab4d7f22cd010aac1045e23 100644 (file)
@@ -14,31 +14,31 @@ tri_maxs(n) = par(i, n, tri_max);
 tri_min = min, _ : min;
 tri_mins(n) = par(i, n, tri_min);
 
-dilating(n) = strel_shift_dilation, _, strel_shift_dilation : #, _ : # : spray_by_three(n) : tri_maxs(n) : nconcat(n);
-eroding(n) = strel_shift_erosion, _, strel_shift_erosion : #, _ : # : spray_by_three(n) : tri_mins(n) : nconcat(n);
+dilating(n) = strel_shift_dilation, _, strel_shift_dilation : #, _ : # : spray_by_three(n) : tri_maxs(n) : nconcat(n); // vector io
+eroding(n) = strel_shift_erosion, _, strel_shift_erosion : #, _ : # : spray_by_three(n) : tri_mins(n) : nconcat(n); // vector io
 
-dilation_line(x, y) = serialize : dilating(x) : vectorize(y);
-erosion_line(x, y) = serialize : eroding(x) : vectorize(y);
+dilation_line(x, y) = serialize : dilating(x) : vectorize(y); // matrix io
+erosion_line(x, y) = serialize : eroding(x) : vectorize(y); // matrix io
 
-dilation_column(x, y) = matrix_transpose(y, x) : serialize : dilating(y) : vectorize(x) : matrix_transpose(x, y);
-erosion_column(x, y) = matrix_transpose(y, x) : serialize : eroding(y) : vectorize(x) : matrix_transpose(x, y);
+dilation_column(x, y) = matrix_transpose(y, x) : serialize : dilating(y) : vectorize(x) : matrix_transpose(x, y); 
+erosion_column(x, y) = matrix_transpose(y, x) : serialize : eroding(y) : vectorize(x) : matrix_transpose(x, y); 
 
-dilation_square(x, y) = dilation_line(x, y) : dilation_column(x, y);
-erosion_square(x, y) = erosion_line(x, y) : erosion_column(x, y);
+dilation_square(x, y) = dilation_line(x, y) : dilation_column(x, y); 
+erosion_square(x, y) = erosion_line(x, y) : erosion_column(x, y); 
 
 cross = _, _ <: !, _, _, !;
 
-dilations_line(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_line(x, y))~_), (iter - 1)) : rdtable : serialize;
+dilations_line(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_line(x, y))~_), (iter - 1)) : rdtable;
 
-erosions_line(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_line(x, y))~_), (iter - 1)) : rdtable : serialize;
+erosions_line(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_line(x, y))~_), (iter - 1)) : rdtable;
 
-dilations_column(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_column(x, y))~_), (iter - 1)) : rdtable : serialize;
+dilations_column(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_column(x, y))~_), (iter - 1)) : rdtable;
 
-erosions_column(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_column(x, y))~_), (iter - 1)) : rdtable : serialize;
+erosions_column(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_column(x, y))~_), (iter - 1)) : rdtable;
 
-dilations_square(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_square(x, y))~_), (iter - 1)) : rdtable : serialize;
+dilations_square(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_square(x, y))~_), (iter - 1)) : rdtable;
 
-erosions_square(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_square(x, y))~_), (iter - 1)) : rdtable : serialize;
+erosions_square(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_square(x, y))~_), (iter - 1)) : rdtable;
 
 opening_line(x, y, iter) = erosions_line(x, y, iter) : dilations_line(x, y, iter);
 closing_line(x, y, iter) = dilations_line(x, y, iter) : erosions_line(x, y, iter);
@@ -49,19 +49,16 @@ closing_column(x, y, iter) = dilations_column(x, y, iter) : erosions_column(x, y
 opening_square(x, y, iter) = erosions_square(x, y, iter) : dilations_square(x, y, iter);
 closing_square(x, y, iter) = dilations_square(x, y, iter) : erosions_square(x, y, iter);
 
-and = *;
-threshold(x, low, high) = _ <: (_, (low : vectorize(x)) : >), (_, (high : vectorize(x)) : <) : and;
+threshold(x, y, low, high) = _ <: (_, (low : vectorize(x) : vectorize(y)) : >), (_, (high : vectorize(x) : vectorize(y)) : <) : &;
 
-//licenceplate(x, y) = _ <: (opening_line(x, y, 15), closing_line(x, y, 8) : threshold(x, 1, 50), threshold(x, 150, 255) : and : opening_column(x, y, 4) : opening_line(x, y, 4) : dilations_square(x, y, 2)), _ : and;
+mask_adjusting(x, y, o7, o8, d9, d10) = opening_column(x, y, o7) : opening_line(x, y, o8) : dilations_square(x, y, d9) : dilations_line(x, y, d10);
 
-licenceplate(x, y, o1, c2, t3, t4, t5, t6, o7, o8, d9, d10) = _ <: (opening_line(x, y, o1), closing_line(x, y, c2) : threshold(x, t3, t4), threshold(x, t5, t6) : and : opening_column(x, y, o7) : opening_line(x, y, o8) : dilations_square(x, y, d9) : dilations_line(x, y, d10)), _ : and;
-
-//licenceplate(x, y) = _ <: (opening_line(x, y, 4), closing_line(x, y, 2) : threshold(x, 1, 50), threshold(x, 150, 255) : and : opening_column(x, y, 4) : opening_line(x, y, 4) : dilations_square(x, y, 4)), _ : and;
+licenceplate(x, y, o1, c2, t3, t4, t5, t6, o7, o8, d9, d10) = vectorize(y) <: (opening_line(x, y, o1), closing_line(x, y, c2) : threshold(x, y, t3, t4), threshold(x, y, t5, t6) : & : mask_adjusting(x, y, o7, o8, d9, d10)), _ : * : serialize;
 
 //process = dilations_line(8, 8, 3);
 //process = erosions(8, 8, 3);
 //process = open(8, 8, 2);
 //process = close(8, 8, 5);
-//process = licenceplate(4, 4, 15, 8, 1, 50, 150, 255, 4, 4, 2, 20);
+//process = licenceplate(4, 4, 1, 4, 1, 50, 150, 255, 1, 1, 5, 20);