ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/normpat.csh
(Generate patch)

Comparing ray/src/px/normpat.csh (file contents):
Revision 1.8 by greg, Tue Jan 8 12:45:06 1991 UTC vs.
Revision 2.7 by greg, Mon Aug 25 04:50:32 2008 UTC

# Line 1 | Line 1
1   #!/bin/csh -f
2 < # SCCSid "$SunId$ LBL"
2 > # RCSid: $Id$
3   #
4   # Normalize a pattern for tiling (-b option blends edges) by removing
5   # lowest frequencies from image (-f option) and reducing to
# Line 35 | Line 35 | while ($#argv > 0)
35   end
36   dofiles:
37   onintr quit
38 < set td=/usr/tmp/np$$
39 < mkdir $td
38 > set td=`mktemp -d /tmp/np.XXXXXX`
39 > goto skipthis
40   cat > $td/coef.fmt << '_EOF_'
41 <   rm=${  $25   };    gm=${  $26   };    bm=${  $27   };
42 <  rcx=${   $1   };   gcx=${   $9   };   bcx=${  $17   };
43 <  rcy=${   $2   };   gcy=${  $10   };   bcy=${  $18   };
44 <  rsx=${   $3   };   gsx=${  $11   };   bsx=${  $19   };
45 <  rsy=${   $4   };   gsy=${  $12   };   bsy=${  $20   };
46 < rcxcy=${   $5   }; gcxcy=${  $13   }; bcxcy=${  $21   };
47 < rcxsy=${   $6   }; gcxsy=${  $14   }; bcxsy=${  $22   };
48 < rsxcy=${   $7   }; gsxcy=${  $15   }; bsxcy=${  $23   };
49 < rsxsy=${   $8   }; gsxsy=${  $16   }; bsxsy=${  $24   };
41 >   rm:${  $25   };    gm:${  $26   };    bm:${  $27   };
42 >  rcx:${   $1   };   gcx:${   $9   };   bcx:${  $17   };
43 >  rcy:${   $2   };   gcy:${  $10   };   bcy:${  $18   };
44 >  rsx:${   $3   };   gsx:${  $11   };   bsx:${  $19   };
45 >  rsy:${   $4   };   gsy:${  $12   };   bsy:${  $20   };
46 > rcxcy:${   $5   }; gcxcy:${  $13   }; bcxcy:${  $21   };
47 > rcxsy:${   $6   }; gcxsy:${  $14   }; bcxsy:${  $22   };
48 > rsxcy:${   $7   }; gsxcy:${  $15   }; bsxcy:${  $23   };
49 > rsxsy:${   $8   }; gsxsy:${  $16   }; bsxsy:${  $24   };
50   '_EOF_'
51   cat > $td/coef.cal << '_EOF_'
52   $1=$3*2*cx; $2=$3*2*cy; $3=$3*2*sx; $4=$3*2*sy;
# Line 58 | Line 58 | $21=$5*4*cx*cy; $22=$5*4*cx*sy; $23=$5*4*sx*cy; $24=$5
58   $25=$3; $26=$4; $27=$5;
59   cx=cos(wx); cy=cos(wy);
60   sx=sin(wx); sy=sin(wy);
61 < wx=2*PI*($1+.5)/xres; wy=2*PI*($2+.5)/yres;
61 > wx=2*PI/xres*($1+.5); wy=2*PI/yres*($2+.5);
62   '_EOF_'
63   cat > $td/fsub.cal << '_EOF_'
64 + PI:3.14159265358979323846;
65   ro=ri(1)*rm/(rm+rcx*cx+rcy*cy+rsx*sx+rsy*sy
66                  +rcxcy*cx*cy+rcxsy*cx*sy+rsxcy*sx*cy+rsxsy*sx*sy);
67   go=gi(1)*gm/(gm+gcx*cx+gcy*cy+gsx*sx+gsy*sy
# Line 69 | Line 70 | bo=bi(1)*bm/(bm+bcx*cx+bcy*cy+bsx*sx+bsy*sy
70                  +bcxcy*cx*cy+bcxsy*cx*sy+bsxcy*sx*cy+bsxsy*sx*sy);
71   cx=cos(wx); cy=cos(wy);
72   sx=sin(wx); sy=sin(wy);
73 < wx=2*PI*(x+.5)/xres; wy=2*PI*(y+.5)/yres;
73 < PI=3.14159265358979323846;
73 > wx=2*PI/xres*(x+.5); wy=2*PI/yres*(y+.5);
74   '_EOF_'
75 + skipthis:
76   foreach f ($*)
77          if ( $?verb ) then
78                  echo $f\:
# Line 86 | Line 87 | $ha
87   w
88   q
89   _EOF_
90 <        set resolu=`getinfo -d < $td/pf | sed 's/-Y \([0-9]*\) +X \([0-9]*\)/\2 \1/'`
90 >        set resolu=`getinfo -d < $td/pf | sed 's/-Y \([1-9][0-9]*\) +X \([1-9][0-9]*\)/\2 \1/'`
91          if ( ! $?dofsub ) then
92                  mv $td/pf $td/hf
93                  goto donefsub
94          endif
95 +        # if ( $?verb ) then
96 +        #       echo computing Fourier coefficients...
97 +        # endif
98 +        # pfilt -1 -x 32 -y 32 $td/pf | pvalue -h \
99 +        #       | rcalc -e 'xres:32;yres:32' -f $td/coef.cal \
100 +        #       | total -m | rcalc -o $td/coef.fmt \
101 +        #       > $td/coef
102          if ( $?verb ) then
103 <                echo computing Fourier coefficients...
96 <        endif
97 <        pfilt -1 -x 32 -y 32 $td/pf | pvalue -h \
98 <                | rcalc -f $td/coef.cal -e 'xres=32;yres=32' \
99 <                | total -m | rcalc -o $td/coef.fmt \
100 <                > $td/coef
101 <        if ( $?verb ) then
102 <                cat $td/coef
103 >                # cat $td/coef
104                  echo removing low frequencies...
105          endif
106 <        pcomb -f $td/fsub.cal -f $td/coef \
107 <                -e "xres=$resolu[1];yres=$resolu[2]" \
108 <                $td/pf > $td/hf
106 >        pgblur -r `ev "sqrt($resolu[1]*$resolu[2])/8"` $td/pf > $td/lf
107 >        pcomb -e 's=1/li(2);ro=s*ri(1);go=s*gi(1);bo=s*bi(1)' \
108 >                        $td/pf $td/lf > $td/hf
109 >        # pcomb -f $td/coef -f $td/fsub.cal $td/pf > $td/hf
110          donefsub:
111          if ( $?blend ) then
112                  if ( $?verb ) then

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines