197 |
|
if (i < argc) { /* open picture file */ |
198 |
|
fname = argv[i]; |
199 |
|
fin = fopen(fname, "r"); |
200 |
< |
if (fin == NULL) { |
201 |
< |
sprintf(errmsg, "cannot open file \"%s\"", fname); |
202 |
< |
quiterr(errmsg); |
203 |
< |
} |
200 |
> |
if (fin == NULL) |
201 |
> |
quiterr("cannot open picture file"); |
202 |
|
} |
203 |
|
/* get header */ |
204 |
|
getheader(fin, headline, NULL); |
672 |
|
case '@': /* adaptation level */ |
673 |
|
if (avgbox(cval) == -1) |
674 |
|
return(-1); |
675 |
< |
comp = com=='@' |
676 |
< |
? 106./pow(1.219+pow(luminance(cval)/exposure,.4),2.5)/exposure |
677 |
< |
: .5/bright(cval) ; |
675 |
> |
comp = bright(cval); |
676 |
> |
if (comp < 1e-20) { |
677 |
> |
XBell(thedisplay, 0); |
678 |
> |
return(-1); |
679 |
> |
} |
680 |
> |
if (com == '@') |
681 |
> |
comp = 106./exposure/ |
682 |
> |
pow(1.219+pow(comp*WHTEFFICACY/exposure,.4),2.5); |
683 |
> |
else |
684 |
> |
comp = .5/comp; |
685 |
|
comp = log(comp)/.69315 - scale; |
686 |
|
n = comp < 0 ? comp-.5 : comp+.5 ; /* round */ |
687 |
|
if (n == 0) |