1 |
|
#!/bin/csh -f |
2 |
+ |
# RCSid $Id$ |
3 |
|
# |
4 |
|
# Combine alternate lines in full frames for field rendering |
5 |
|
# |
8 |
|
# If an odd number of frames is provided, the spare frame at the |
9 |
|
# end is linked to $spare_name for the next run |
10 |
|
# |
11 |
< |
# Written by Greg Ward for Iebele Atelier in August 2005 |
11 |
> |
# Written by Greg Ward for Iebele Abel in August 2005 |
12 |
|
# |
13 |
< |
set spare_name=spare_fieldcomb_frame.pic |
14 |
< |
if ($#argv > 1) then |
15 |
< |
if ("$argv[1]" == "-r") then |
13 |
> |
set spare_name=spare_fieldcomb_frame.hdr |
14 |
> |
set odd_first=0 |
15 |
> |
while ($#argv > 1) |
16 |
> |
switch ($argv[1]) |
17 |
> |
case -r*: |
18 |
|
set remove_orig |
19 |
+ |
breaksw |
20 |
+ |
case -o*: |
21 |
+ |
set odd_first=1 |
22 |
+ |
breaksw |
23 |
+ |
case -e*: |
24 |
+ |
set odd_first=0 |
25 |
+ |
breaksw |
26 |
+ |
case -f*: |
27 |
|
shift argv |
28 |
< |
endif |
29 |
< |
endif |
28 |
> |
set outfile="$argv[1]" |
29 |
> |
breaksw |
30 |
> |
default: |
31 |
> |
if ("$argv[1]" !~ -*) break |
32 |
> |
echo "Unknown option: $argv[1]" |
33 |
> |
exit 1 |
34 |
> |
endsw |
35 |
> |
shift argv |
36 |
> |
end |
37 |
|
if ($#argv < 2) then |
38 |
< |
echo "Usage: $0 [-r] field1.pic field2.pic .." |
38 |
> |
echo "Usage: $0 [-e|-o][-r] [-f combined.hdr] field1.hdr field2.hdr .." |
39 |
|
exit 1 |
40 |
|
endif |
41 |
+ |
if ($?outfile && $#argv > 2) then |
42 |
+ |
echo "Cannot use -f option with more than two input files" |
43 |
+ |
exit 1 |
44 |
+ |
endif |
45 |
|
set f1=$argv[1]:q |
46 |
|
set ext=$f1:e |
47 |
|
set basenm="`echo $f1:q | sed 's/[0-9]*\.'$ext'//'`" |
55 |
|
set curfi=1 |
56 |
|
while ($curfi < $#fields) |
57 |
|
@ nextfi = $curfi + 1 |
58 |
< |
pcomb -e 'ro=ri(fld);go=gi(fld);bo=bi(fld)' \ |
59 |
< |
-e 'odd=.5*y-floor(.5*y)-.25' -e 'fld=if(odd,1,2)' \ |
58 |
> |
if ($curfr < 10) then |
59 |
> |
set fid=000$curfr |
60 |
> |
else if ($curfr < 100) then |
61 |
> |
set fid=00$curfr |
62 |
> |
else if ($curfr < 1000) then |
63 |
> |
set fid=0$curfr |
64 |
> |
else |
65 |
> |
set fid=$curfr |
66 |
> |
endif |
67 |
> |
set outf="${basenm}C$fid.$ext" |
68 |
> |
if ($?outfile) then |
69 |
> |
set outf=$outfile:q |
70 |
> |
endif |
71 |
> |
pcomb -e 'ro=ri(fld); go=gi(fld); bo=bi(fld)' \ |
72 |
> |
-e 'yd=yres-1-y; odd=.5*yd-floor(.5*yd)-.25' \ |
73 |
> |
-e "fld=if(odd,2-$odd_first,1+$odd_first)" \ |
74 |
|
$fields[$curfi]:q $fields[$nextfi]:q \ |
75 |
< |
> "${basenm}C$curfr.$ext" |
75 |
> |
> $outf:q |
76 |
|
if ($?remove_orig) rm $fields[$curfi]:q $fields[$nextfi]:q |
77 |
|
@ curfr++ |
78 |
|
@ curfi = $nextfi + 1 |