1 |
– |
/* Copyright (c) 1997 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Condition Radiance picture for display/output |
6 |
+ |
* Added white-balance adjustment 10/01 (GW). |
7 |
|
*/ |
8 |
|
|
9 |
|
#include "pcond.h" |
30 |
|
RESOLU inpres; /* input picture resolution */ |
31 |
|
|
32 |
|
COLOR *fovimg; /* foveal (1 degree) averaged image */ |
33 |
< |
short fvxr, fvyr; /* foveal image resolution */ |
33 |
> |
int fvxr, fvyr; /* foveal image resolution */ |
34 |
> |
float *crfimg; /* contrast reduction factors */ |
35 |
|
short (*fixlst)[2]; /* fixation history list */ |
36 |
|
int nfixations; /* number of fixation points */ |
37 |
< |
float bwhist[HISTRES]; /* luminance histogram */ |
37 |
> |
double bwhist[HISTRES]; /* luminance histogram */ |
38 |
|
double histot; /* total count of histogram */ |
39 |
|
double bwmin, bwmax; /* histogram limits */ |
40 |
|
double bwavg; /* mean brightness */ |
237 |
|
exit(1); |
238 |
|
} |
239 |
|
if (lumf == rgblum) |
240 |
< |
comprgb2xyzmat(inrgb2xyz, inprims); |
240 |
> |
comprgb2xyzWBmat(inrgb2xyz, inprims); |
241 |
|
else if (mbcalfile != NULL) { |
242 |
|
fprintf(stderr, "%s: macbethcal only works with RGB pictures\n", |
243 |
|
progname); |
271 |
|
comphist(); /* generate adaptation histogram */ |
272 |
|
check2do(); /* modify what2do flags */ |
273 |
|
if (what2do&DO_VEIL) |
274 |
< |
compveil(); |
275 |
< |
if (!(what2do&DO_LINEAR) && mkbrmap() < 0) /* make tone map */ |
276 |
< |
what2do |= DO_LINEAR; /* failed! -- use linear scaling */ |
274 |
> |
compveil(); /* compute veil image */ |
275 |
> |
if (!(what2do&DO_LINEAR)) |
276 |
> |
if (mkbrmap() < 0) /* make tone map */ |
277 |
> |
what2do |= DO_LINEAR; /* failed! -- use linear */ |
278 |
> |
#if ADJ_VEIL |
279 |
> |
else if (what2do&DO_VEIL) |
280 |
> |
adjveil(); /* else adjust veil image */ |
281 |
> |
#endif |
282 |
|
if (what2do&DO_LINEAR) { |
283 |
|
if (scalef <= FTINY) { |
284 |
|
if (what2do&DO_HSENS) |
315 |
|
if (fvxr < 2) fvxr = 2; |
316 |
|
fvyr = sqrt(ourview.vn2)/FOVDIA + 0.5; |
317 |
|
if (fvyr < 2) fvyr = 2; |
318 |
< |
if (!(inpres.or & YMAJOR)) { /* picture is rotated? */ |
318 |
> |
if (!(inpres.rt & YMAJOR)) { /* picture is rotated? */ |
319 |
|
y = fvyr; |
320 |
|
fvyr = fvxr; |
321 |
|
fvxr = y; |