242 |
|
} |
243 |
|
|
244 |
|
|
245 |
+ |
#ifdef PCOND |
246 |
|
int /* run pcond to map picture */ |
247 |
|
dopcond(psp, xp, yp, flags, monpri, gamval, Lddyn, Ldmax, fname) |
248 |
|
BYTE **psp; |
263 |
|
if (setcolrcor(pow, 1./gamval) < 0) |
264 |
|
returnErr(TM_E_NOMEM); |
265 |
|
/* create command */ |
266 |
< |
strcpy(cmdbuf, "pcond "); |
266 |
> |
strcpy(cmdbuf, PCOND); |
267 |
|
if (flags & TM_F_HCONTR) |
268 |
< |
strcat(cmdbuf, "-s "); |
268 |
> |
strcat(cmdbuf, " -s"); |
269 |
|
if (flags & TM_F_MESOPIC) |
270 |
< |
strcat(cmdbuf, "-c "); |
270 |
> |
strcat(cmdbuf, " -c"); |
271 |
|
if (flags & TM_F_LINEAR) |
272 |
< |
strcat(cmdbuf, "-l "); |
272 |
> |
strcat(cmdbuf, " -l"); |
273 |
|
if (flags & TM_F_ACUITY) |
274 |
< |
strcat(cmdbuf, "-a "); |
274 |
> |
strcat(cmdbuf, " -a"); |
275 |
|
if (flags & TM_F_VEIL) |
276 |
< |
strcat(cmdbuf, "-v "); |
276 |
> |
strcat(cmdbuf, " -v"); |
277 |
|
if (flags & TM_F_CWEIGHT) |
278 |
< |
strcat(cmdbuf, "-w "); |
279 |
< |
sprintf(cmdbuf+strlen(cmdbuf), |
280 |
< |
"-p %f %f %f %f %f %f %f %f -d %f -u %f %s", |
281 |
< |
monpri[RED][CIEX], monpri[RED][CIEY], |
282 |
< |
monpri[GRN][CIEX], monpri[GRN][CIEY], |
283 |
< |
monpri[BLU][CIEX], monpri[BLU][CIEY], |
284 |
< |
monpri[WHT][CIEX], monpri[WHT][CIEY], |
285 |
< |
Lddyn, Ldmax, fname); |
278 |
> |
strcat(cmdbuf, " -w"); |
279 |
> |
if (monpri != stdprims) |
280 |
> |
sprintf(cmdbuf+strlen(cmdbuf), " -p %f %f %f %f %f %f %f %f", |
281 |
> |
monpri[RED][CIEX], monpri[RED][CIEY], |
282 |
> |
monpri[GRN][CIEX], monpri[GRN][CIEY], |
283 |
> |
monpri[BLU][CIEX], monpri[BLU][CIEY], |
284 |
> |
monpri[WHT][CIEX], monpri[WHT][CIEY]); |
285 |
> |
sprintf(cmdbuf+strlen(cmdbuf), " -d %f -u %f %s", Lddyn, Ldmax, fname); |
286 |
|
/* start pcond */ |
287 |
|
if ((infp = popen(cmdbuf, "r")) == NULL) |
288 |
|
returnErr(TM_E_BADFILE); |
326 |
|
pclose(infp); |
327 |
|
returnOK; |
328 |
|
} |
329 |
+ |
#endif |
330 |
|
|
331 |
|
|
332 |
|
int /* map a Radiance picture */ |
352 |
|
if (Lddyn < MINLDDYN) Lddyn = DEFLDDYN; |
353 |
|
if (Ldmax < MINLDMAX) Ldmax = DEFLDMAX; |
354 |
|
if (flags & TM_F_BW) monpri = stdprims; |
355 |
+ |
#ifdef PCOND |
356 |
|
/* check for pcond run */ |
357 |
|
if (fp == TM_GETFILE && flags & TM_F_UNIMPL) |
358 |
|
return( dopcond(psp, xp, yp, flags, |
359 |
|
monpri, gamval, Lddyn, Ldmax, fname) ); |
360 |
+ |
#endif |
361 |
|
/* initialize tone mapping */ |
362 |
|
if (tmInit(flags, monpri, gamval) == NULL) |
363 |
|
returnErr(TM_E_NOMEM); |