ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/tmprivat.h
Revision: 3.5
Committed: Mon Aug 17 17:58:46 1998 UTC (25 years, 8 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Changes since 3.4: +3 -2 lines
Log Message:
took "color.h" include out of tonemap.h and put in tmprivat.h
changed routines so zero-length arrays don't return error

File Contents

# User Rev Content
1 gwlarson 3.5 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2 greg 3.1
3 gwlarson 3.5 /* SCCSid "$SunId$ SGI" */
4 greg 3.1
5     /*
6     * Private header file for tone mapping routines.
7     */
8    
9     #undef NOPROTO
10     #define NOPROTO 1
11 greg 3.4 #ifndef MEM_PTR
12     #define MEM_PTR char *
13     #endif
14 gwlarson 3.5 #include "color.h"
15 greg 3.1 #include "tonemap.h"
16 greg 3.2
17     /* required constants */
18     #ifndef M_LN2
19     #define M_LN2 0.69314718055994530942
20     #endif
21     #ifndef M_LN10
22     #define M_LN10 2.30258509299404568402
23     #endif
24 greg 3.1 /* minimum values and defaults */
25     #define MINGAM 0.75
26     #define DEFGAM 2.2
27     #define MINLDDYN 2.
28     #define DEFLDDYN 32.
29     #define MINLDMAX 1.
30     #define DEFLDMAX 100.
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 greg 3.4 MEM_PTR malloc();
63     MEM_PTR calloc();
64 greg 3.1 #endif
65     extern int tmErrorReturn();
66    
67     #define returnErr(code) return(tmErrorReturn(funcName,code))
68     #define returnOK return(TM_E_OK)
69    
70     #define FEQ(a,b) ((a) < (b)+1e-5 && (b) < (a)+1e-5)
71    
72     #define PRIMEQ(p1,p2) (FEQ((p1)[0][0],(p2)[0][0])&&FEQ((p1)[0][1],(p2)[0][2])\
73     &&FEQ((p1)[1][0],(p2)[1][0])&&FEQ((p1)[1][1],(p2)[1][2])\
74     &&FEQ((p1)[2][0],(p2)[2][0])&&FEQ((p1)[2][1],(p2)[2][2])\
75     &&FEQ((p1)[3][0],(p2)[3][0])&&FEQ((p1)[3][1],(p2)[3][2]))