8 |
|
|
9 |
|
#undef NOPROTO |
10 |
|
#define NOPROTO 1 |
11 |
+ |
#ifndef MEM_PTR |
12 |
+ |
#define MEM_PTR char * |
13 |
+ |
#endif |
14 |
|
#include "tonemap.h" |
15 |
+ |
|
16 |
+ |
/* required constants */ |
17 |
+ |
#ifndef M_LN2 |
18 |
+ |
#define M_LN2 0.69314718055994530942 |
19 |
+ |
#endif |
20 |
+ |
#ifndef M_LN10 |
21 |
+ |
#define M_LN10 2.30258509299404568402 |
22 |
+ |
#endif |
23 |
|
/* minimum values and defaults */ |
24 |
|
#define MINGAM 0.75 |
25 |
|
#define DEFGAM 2.2 |
28 |
|
#define MINLDMAX 1. |
29 |
|
#define DEFLDMAX 100. |
30 |
|
|
20 |
– |
/* private flags */ |
21 |
– |
#define TM_F_INITED 010000 /* initialized flag */ |
22 |
– |
#define TM_F_NEEDMAT 020000 /* need matrix conversion */ |
23 |
– |
|
31 |
|
#define BRT2SCALE ((int)(M_LN2*TM_BRTSCALE+.5)) |
32 |
|
|
33 |
|
#define HISTEP 8 /* steps in BRTSCALE for each bin */ |
36 |
|
#define MINLUM (1.125352e-7) /* tmLuminance(MINBRT) */ |
37 |
|
|
38 |
|
#define LMESLOWER (5.62e-3) /* lower mesopic limit */ |
32 |
– |
#define BMESLOWER ((int)(-5.18*TM_BRTSCALE-.5)) |
39 |
|
#define LMESUPPER (5.62) /* upper mesopic limit */ |
40 |
+ |
#if (TM_BRTSCALE==128) |
41 |
+ |
#define BMESLOWER (-663) /* encoded LMESLOWER */ |
42 |
+ |
#define BMESUPPER (221) /* encoded LMESUPPER */ |
43 |
+ |
#else |
44 |
+ |
#define BMESLOWER ((int)(-5.18*TM_BRTSCALE-.5)) |
45 |
|
#define BMESUPPER ((int)(1.73*TM_BRTSCALE+.5)) |
46 |
+ |
#endif |
47 |
|
|
48 |
|
#ifndef int4 |
49 |
|
#define int4 int /* assume 32-bit integers */ |
58 |
|
(int4)(SCO_bf*256.+.5)*(c)[BLU] ) >> 8 ) |
59 |
|
|
60 |
|
#ifndef malloc |
61 |
< |
extern char *malloc(), *calloc(); |
61 |
> |
MEM_PTR malloc(); |
62 |
> |
MEM_PTR calloc(); |
63 |
|
#endif |
64 |
|
extern int tmErrorReturn(); |
65 |
|
|