1 |
< |
/* Copyright (c) 1997 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1997 Silicon Graphics, Inc. */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
4 |
> |
static char SCCSid[] = "$SunId$ SGI"; |
5 |
|
#endif |
6 |
|
|
7 |
|
/* |
125 |
|
if (rgbinp == -1) |
126 |
|
rgbinp = !rgbout; |
127 |
|
printargs(argc, argv, stdout); /* add to header */ |
128 |
– |
if (expcomp < 0.99 || expcomp > 1.01) |
129 |
– |
fputexpos(expcomp, stdout); |
128 |
|
convert(); /* convert picture */ |
129 |
|
exit(0); |
130 |
|
userr: |
152 |
|
COLORMAT xfm; |
153 |
|
register COLOR *scanin; |
154 |
|
register COLR *scanout; |
155 |
+ |
double ourexp = expcomp; |
156 |
|
int y; |
157 |
|
register int x; |
158 |
|
/* compute transform */ |
159 |
|
if (rgbout) { |
161 |
– |
double mult; |
160 |
|
if (rgbinp) { /* RGBE -> RGBE */ |
161 |
|
comprgb2rgbmat(xfm, inprims, outprims); |
164 |
– |
mult = expcomp; |
162 |
|
} else { /* XYZE -> RGBE */ |
163 |
|
compxyz2rgbmat(xfm, outprims); |
164 |
< |
mult = expcomp/WHTEFFICACY; |
164 |
> |
ourexp *= WHTEFFICACY; |
165 |
|
} |
169 |
– |
for (y = 0; y < 3; y++) |
170 |
– |
for (x = 0; x < 3; x++) |
171 |
– |
xfm[y][x] *= mult; |
166 |
|
} else { |
167 |
|
if (rgbinp) { /* RGBE -> XYZE */ |
168 |
|
comprgb2xyzmat(xfm, inprims); |
169 |
< |
for (y = 0; y < 3; y++) |
176 |
< |
for (x = 0; x < 3; x++) |
177 |
< |
xfm[y][x] *= WHTEFFICACY*expcomp; |
169 |
> |
ourexp /= WHTEFFICACY; |
170 |
|
} else { /* XYZE -> XYZE */ |
171 |
|
for (y = 0; y < 3; y++) |
172 |
|
for (x = 0; x < 3; x++) |
173 |
< |
xfm[y][x] = x==y ? expcomp : 0.; |
173 |
> |
xfm[y][x] = x==y ? 1. : 0.; |
174 |
|
} |
175 |
|
} |
176 |
+ |
for (y = 0; y < 3; y++) |
177 |
+ |
for (x = 0; x < 3; x++) |
178 |
+ |
xfm[y][x] *= expcomp; |
179 |
|
/* get input resolution */ |
180 |
|
if ((order = fgetresolu(&xmax, &ymax, stdin)) < 0) |
181 |
|
quiterr("bad picture format"); |
182 |
|
/* complete output header */ |
183 |
+ |
if (ourexp < 0.99 || ourexp > 1.01) |
184 |
+ |
fputexpos(ourexp, stdout); |
185 |
|
if (rgbout) { |
186 |
|
fputprims(outprims, stdout); |
187 |
|
fputformat(COLRFMT, stdout); |