ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/tmprivat.h
Revision: 3.3
Committed: Thu Apr 17 19:09:33 1997 UTC (27 years ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 3.2: +6 -1 lines
Log Message:
put back old defn's of BMESLOWER and BMESUPPER

File Contents

# User Rev Content
1 greg 3.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 greg 3.2
13     /* required constants */
14     #ifndef M_LN2
15     #define M_LN2 0.69314718055994530942
16     #endif
17     #ifndef M_LN10
18     #define M_LN10 2.30258509299404568402
19     #endif
20 greg 3.1 /* minimum values and defaults */
21     #define MINGAM 0.75
22     #define DEFGAM 2.2
23     #define MINLDDYN 2.
24     #define DEFLDDYN 32.
25     #define MINLDMAX 1.
26     #define DEFLDMAX 100.
27    
28     /* private flags */
29     #define TM_F_INITED 010000 /* initialized flag */
30     #define TM_F_NEEDMAT 020000 /* need matrix conversion */
31    
32     #define BRT2SCALE ((int)(M_LN2*TM_BRTSCALE+.5))
33    
34     #define HISTEP 8 /* steps in BRTSCALE for each bin */
35    
36     #define MINBRT (-16*TM_BRTSCALE) /* minimum usable brightness */
37     #define MINLUM (1.125352e-7) /* tmLuminance(MINBRT) */
38    
39     #define LMESLOWER (5.62e-3) /* lower mesopic limit */
40 greg 3.3 #define LMESUPPER (5.62) /* upper mesopic limit */
41     #if (TM_BRTSCALE==128)
42 greg 3.2 #define BMESLOWER (-663) /* encoded LMESLOWER */
43     #define BMESUPPER (221) /* encoded LMESUPPER */
44 greg 3.3 #else
45     #define BMESLOWER ((int)(-5.18*TM_BRTSCALE-.5))
46     #define BMESUPPER ((int)(1.73*TM_BRTSCALE+.5))
47     #endif
48 greg 3.1
49     #ifndef int4
50     #define int4 int /* assume 32-bit integers */
51     #endif
52     /* approximate scotopic lum. */
53     #define SCO_rf 0.062
54     #define SCO_gf 0.608
55     #define SCO_bf 0.330
56     #define scotlum(c) (SCO_rf*(c)[RED] + SCO_gf*(c)[GRN] + SCO_bf*(c)[BLU])
57     #define normscot(c) ( ( (int4)(SCO_rf*256.+.5)*(c)[RED] + \
58     (int4)(SCO_gf*256.+.5)*(c)[GRN] + \
59     (int4)(SCO_bf*256.+.5)*(c)[BLU] ) >> 8 )
60    
61     #ifndef malloc
62     extern char *malloc(), *calloc();
63     #endif
64     extern int tmErrorReturn();
65    
66     #define returnErr(code) return(tmErrorReturn(funcName,code))
67     #define returnOK return(TM_E_OK)
68    
69     #define FEQ(a,b) ((a) < (b)+1e-5 && (b) < (a)+1e-5)
70    
71     #define PRIMEQ(p1,p2) (FEQ((p1)[0][0],(p2)[0][0])&&FEQ((p1)[0][1],(p2)[0][2])\
72     &&FEQ((p1)[1][0],(p2)[1][0])&&FEQ((p1)[1][1],(p2)[1][2])\
73     &&FEQ((p1)[2][0],(p2)[2][0])&&FEQ((p1)[2][1],(p2)[2][2])\
74     &&FEQ((p1)[3][0],(p2)[3][0])&&FEQ((p1)[3][1],(p2)[3][2]))