| 1 |  | #!/bin/csh -f | 
| 2 | < | # SCCSid "$SunId$ LBL" | 
| 2 | > | # RCSid: $Id$ | 
| 3 |  | set Lmin=.0001          # minimum visible world luminance | 
| 4 |  | set Ldmin=1             # minimum display luminance | 
| 5 |  | set Ldmax=100           # maximum display luminance | 
| 100 |  | while ( 1 ) | 
| 101 |  | # Compute mapping function | 
| 102 |  | sed 's/^.*[     ]//' $tf1 | total -1 -r \ | 
| 103 | < | | rcalc -e '$1=$1/'$totcount | lam $tf1 - \ | 
| 103 | > | | rcalc -e '$1=$1/'$totcount | rlam $tf1 - \ | 
| 104 |  | | tabfunc -i 0 cf > $tf4 | 
| 105 |  | # Compute difference with visible envelope | 
| 106 |  | rcalc -f $tf4 -f $tf3 -e "T:$totcount*Stepsiz" \ | 
| 149 |  | endif | 
| 150 |  | end | 
| 151 |  | # Mung histogram | 
| 152 | < | echo $diffs | tr ' ' '\012' | lam $tf1 - \ | 
| 152 | > | echo $diffs | tr ' ' '\012' | rlam $tf1 - \ | 
| 153 |  | | rcalc -f $tf4 -f $tf3 -e "T:$totcount*Stepsiz" \ | 
| 154 |  | -e 'clfq=floor(T*clamp(Lb($1))+.5)' \ | 
| 155 |  | -e '$1=$1;$2=$3+clfq' > $tf1b |