parallelization of jpg-conversion to make use of multiple processors
authorpaul <paul@plutz.net>
Tue, 8 Nov 2011 19:27:54 +0000 (19:27 +0000)
committerpaul <paul@plutz.net>
Tue, 8 Nov 2011 19:27:54 +0000 (19:27 +0000)
svn path=/trunk/; revision=7

stereofy.sh

index a97e5b9..51cbfb1 100755 (executable)
@@ -48,19 +48,15 @@ done
 [ -z "$param" ] && param="-$algo$model"
 [ -z "$stereo" ] && stereo="${left}_stereo.jpg"
 
+echo -n preparing...
 geom=$(identify "$left" |sed -rn 's:^.* ([0-9]+x[0-9]+) .*$:\1:gp')
+tmp=$(tempfile -d /tmp -p strfy)
+rm "$tmp"
+mkfifo "$tmp"
 
-echo -n bitmapping...
-stream "$left" "$left.bts"
-stream "$right" "$right.bts"
-
+convert "$left" rgb:- >"$tmp" &
 echo -n anaglyphing...
-anaglyph "$param" "$left.bts" "$right.bts" "$stereo.bts"
-
-if [ $? = 0 ]; then
-  echo -n converting...
-  convert -depth 8 -size "$geom" "rgb:$stereo.bts" "$stereo"
-fi
+convert "$right" rgb:- |anaglyph "$param" "$tmp" /dev/stdin /dev/stdout |convert -depth 8 -size "$geom" rgb:- "$stereo"
 
 echo cleaning...
-rm "$left.bts" "$right.bts" "$stereo.bts" 2>/dev/null
+rm "$tmp"