9 |
|
|
10 |
|
#include "copyright.h" |
11 |
|
|
12 |
– |
#include <stdio.h> |
12 |
|
#include <stdlib.h> |
14 |
– |
#include <string.h> |
13 |
|
#include <math.h> |
16 |
– |
#include <time.h> |
14 |
|
|
15 |
|
#ifdef PCOND |
16 |
< |
#include "rtprocess.h" |
16 |
> |
#include "paths.h" |
17 |
|
#endif |
18 |
|
#include "tmprivat.h" |
19 |
+ |
#include "rtio.h" |
20 |
|
#include "resolu.h" |
21 |
|
|
22 |
|
#define GAMTSZ 4096 |
23 |
|
|
24 |
|
typedef struct { |
25 |
< |
BYTE gamb[GAMTSZ]; /* gamma lookup table */ |
25 |
> |
uby8 gamb[GAMTSZ]; /* gamma lookup table */ |
26 |
|
int clfb[3]; /* encoded tm->clf */ |
27 |
|
int32 cmatb[3][3]; /* encoded color transform */ |
28 |
|
TMbright inpsfb; /* encoded tm->inpsf */ |
44 |
|
tmCvColrs( /* convert RGBE/XYZE colors */ |
45 |
|
TMstruct *tms, |
46 |
|
TMbright *ls, |
47 |
< |
BYTE *cs, |
47 |
> |
uby8 *cs, |
48 |
|
COLR *scan, |
49 |
|
int len |
50 |
|
) |
149 |
|
void *vrh |
150 |
|
) |
151 |
|
{ |
152 |
< |
char fmt[32]; |
152 |
> |
char fmt[MAXFMTLEN]; |
153 |
|
struct radhead *rh = vrh; |
154 |
|
|
155 |
|
if (formatval(fmt, s)) { |
178 |
|
tmLoadPicture( /* convert Radiance picture */ |
179 |
|
TMstruct *tms, |
180 |
|
TMbright **lpp, |
181 |
< |
BYTE **cpp, |
181 |
> |
uby8 **cpp, |
182 |
|
int *xp, |
183 |
|
int *yp, |
184 |
|
char *fname, |
222 |
|
if (*lpp == NULL) |
223 |
|
goto done; |
224 |
|
if (cpp != TM_NOCHROMP) { |
225 |
< |
*cpp = (BYTE *)malloc(3*sizeof(BYTE) * *xp * *yp); |
225 |
> |
*cpp = (uby8 *)malloc(3*sizeof(uby8) * *xp * *yp); |
226 |
|
if (*cpp == NULL) |
227 |
|
goto done; |
228 |
|
} |
259 |
|
#ifdef PCOND |
260 |
|
static int /* run pcond to map picture */ |
261 |
|
dopcond(psp, xp, yp, flags, monpri, gamval, Lddyn, Ldmax, fname) |
262 |
< |
BYTE **psp; |
262 |
> |
uby8 **psp; |
263 |
|
int *xp, *yp; |
264 |
|
int flags; |
265 |
|
RGBPRIMP monpri; |
271 |
|
char cmdbuf[1024]; |
272 |
|
FILE *infp; |
273 |
|
COLR *scan; |
274 |
< |
BYTE *rp; |
274 |
> |
uby8 *rp; |
275 |
|
int y; |
276 |
|
int x; |
277 |
|
/* set up gamma correction */ |
310 |
|
/* allocate arrays */ |
311 |
|
scan = (COLR *)malloc(sizeof(COLR) * *xp); |
312 |
|
if (flags & TM_F_BW) |
313 |
< |
rp = (BYTE *)malloc(sizeof(BYTE) * *xp * *yp); |
313 |
> |
rp = (uby8 *)malloc(sizeof(uby8) * *xp * *yp); |
314 |
|
else |
315 |
< |
rp = (BYTE *)malloc(3*sizeof(BYTE) * *xp * *yp); |
315 |
> |
rp = (uby8 *)malloc(3*sizeof(uby8) * *xp * *yp); |
316 |
|
if (((*psp = rp) == NULL) | (scan == NULL)) { |
317 |
|
pclose(infp); |
318 |
|
returnErr(TM_E_NOMEM); |
346 |
|
|
347 |
|
int /* map a Radiance picture */ |
348 |
|
tmMapPicture(psp, xp, yp, flags, monpri, gamval, Lddyn, Ldmax, fname, fp) |
349 |
< |
BYTE **psp; |
349 |
> |
uby8 **psp; |
350 |
|
int *xp, *yp; |
351 |
|
int flags; |
352 |
|
RGBPRIMP monpri; |
355 |
|
FILE *fp; |
356 |
|
{ |
357 |
|
char *funcName = fname==NULL ? "tmMapPicture" : fname; |
358 |
< |
TMstruct *tms; |
359 |
< |
BYTE *cp; |
358 |
> |
TMstruct *tms = NULL; |
359 |
> |
uby8 *cp; |
360 |
|
TMbright *lp; |
361 |
|
int err; |
362 |
|
/* check arguments */ |
386 |
|
} |
387 |
|
/* allocate space for result */ |
388 |
|
if (flags & TM_F_BW) { |
389 |
< |
*psp = (BYTE *)malloc(sizeof(BYTE) * *xp * *yp); |
389 |
> |
*psp = (uby8 *)malloc(sizeof(uby8) * *xp * *yp); |
390 |
|
if (*psp == NULL) { |
391 |
|
free((MEM_PTR)lp); |
392 |
|
tmDone(tms); |