| 1 |
– |
/* Copyright (c) 1997 Silicon Graphics, Inc. */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Program to convert between RADIANCE RGBE and XYZE formats |
| 6 |
+ |
* Added white-balance adjustment 10/01 (GW). |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
|
#include <stdio.h> |
| 10 |
+ |
#include <string.h> |
| 11 |
|
#include <math.h> |
| 12 |
+ |
#include <time.h> |
| 13 |
|
#include "color.h" |
| 14 |
|
#include "resolu.h" |
| 15 |
|
|
| 17 |
|
#include <fcntl.h> |
| 18 |
|
#endif |
| 19 |
|
|
| 20 |
– |
extern char *malloc(), *strcpy(); |
| 21 |
– |
|
| 20 |
|
int rgbinp = -1; /* input is RGBE? */ |
| 21 |
|
|
| 22 |
|
int rgbout = 0; /* output should be RGBE? */ |
| 157 |
|
/* compute transform */ |
| 158 |
|
if (rgbout) { |
| 159 |
|
if (rgbinp) { /* RGBE -> RGBE */ |
| 160 |
< |
comprgb2rgbmat(xfm, inprims, outprims); |
| 160 |
> |
comprgb2rgbWBmat(xfm, inprims, outprims); |
| 161 |
|
} else { /* XYZE -> RGBE */ |
| 162 |
< |
compxyz2rgbmat(xfm, outprims); |
| 162 |
> |
compxyz2rgbWBmat(xfm, outprims); |
| 163 |
|
ourexp *= WHTEFFICACY; |
| 164 |
|
} |
| 165 |
|
} else { |
| 166 |
|
if (rgbinp) { /* RGBE -> XYZE */ |
| 167 |
< |
comprgb2xyzmat(xfm, inprims); |
| 167 |
> |
comprgb2xyzWBmat(xfm, inprims); |
| 168 |
|
ourexp /= WHTEFFICACY; |
| 169 |
|
} else { /* XYZE -> XYZE */ |
| 170 |
|
for (y = 0; y < 3; y++) |
| 215 |
|
quiterr("error writing output picture"); |
| 216 |
|
} |
| 217 |
|
/* free scanline */ |
| 218 |
< |
free((char *)scanin); |
| 218 |
> |
free((void *)scanin); |
| 219 |
|
if (scanout != NULL) |
| 220 |
< |
free((char *)scanout); |
| 220 |
> |
free((void *)scanout); |
| 221 |
|
} |