1 |
/* Copyright (c) 1997 Regents of the University of California */ |
2 |
|
3 |
/* SCCSid "$SunId$ LBL" */ |
4 |
|
5 |
/* |
6 |
* Private header file for tone mapping routines. |
7 |
*/ |
8 |
|
9 |
#undef NOPROTO |
10 |
#define NOPROTO 1 |
11 |
#include "tonemap.h" |
12 |
/* minimum values and defaults */ |
13 |
#define MINGAM 0.75 |
14 |
#define DEFGAM 2.2 |
15 |
#define MINLDDYN 2. |
16 |
#define DEFLDDYN 32. |
17 |
#define MINLDMAX 1. |
18 |
#define DEFLDMAX 100. |
19 |
|
20 |
/* private flags */ |
21 |
#define TM_F_INITED 010000 /* initialized flag */ |
22 |
#define TM_F_NEEDMAT 020000 /* need matrix conversion */ |
23 |
|
24 |
#define BRT2SCALE ((int)(M_LN2*TM_BRTSCALE+.5)) |
25 |
|
26 |
#define HISTEP 8 /* steps in BRTSCALE for each bin */ |
27 |
|
28 |
#define MINBRT (-16*TM_BRTSCALE) /* minimum usable brightness */ |
29 |
#define MINLUM (1.125352e-7) /* tmLuminance(MINBRT) */ |
30 |
|
31 |
#define LMESLOWER (5.62e-3) /* lower mesopic limit */ |
32 |
#define BMESLOWER ((int)(-5.18*TM_BRTSCALE-.5)) |
33 |
#define LMESUPPER (5.62) /* upper mesopic limit */ |
34 |
#define BMESUPPER ((int)(1.73*TM_BRTSCALE+.5)) |
35 |
|
36 |
#ifndef int4 |
37 |
#define int4 int /* assume 32-bit integers */ |
38 |
#endif |
39 |
/* approximate scotopic lum. */ |
40 |
#define SCO_rf 0.062 |
41 |
#define SCO_gf 0.608 |
42 |
#define SCO_bf 0.330 |
43 |
#define scotlum(c) (SCO_rf*(c)[RED] + SCO_gf*(c)[GRN] + SCO_bf*(c)[BLU]) |
44 |
#define normscot(c) ( ( (int4)(SCO_rf*256.+.5)*(c)[RED] + \ |
45 |
(int4)(SCO_gf*256.+.5)*(c)[GRN] + \ |
46 |
(int4)(SCO_bf*256.+.5)*(c)[BLU] ) >> 8 ) |
47 |
|
48 |
#ifndef malloc |
49 |
extern char *malloc(), *calloc(); |
50 |
#endif |
51 |
extern int tmErrorReturn(); |
52 |
|
53 |
#define returnErr(code) return(tmErrorReturn(funcName,code)) |
54 |
#define returnOK return(TM_E_OK) |
55 |
|
56 |
#define FEQ(a,b) ((a) < (b)+1e-5 && (b) < (a)+1e-5) |
57 |
|
58 |
#define PRIMEQ(p1,p2) (FEQ((p1)[0][0],(p2)[0][0])&&FEQ((p1)[0][1],(p2)[0][2])\ |
59 |
&&FEQ((p1)[1][0],(p2)[1][0])&&FEQ((p1)[1][1],(p2)[1][2])\ |
60 |
&&FEQ((p1)[2][0],(p2)[2][0])&&FEQ((p1)[2][1],(p2)[2][2])\ |
61 |
&&FEQ((p1)[3][0],(p2)[3][0])&&FEQ((p1)[3][1],(p2)[3][2])) |