ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/tmprivat.h
Revision: 3.4
Committed: Fri Apr 18 13:59:51 1997 UTC (27 years ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 3.3: +5 -5 lines
Log Message:
added notion of conversion packages with private data

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 greg 3.4 #ifndef MEM_PTR
12     #define MEM_PTR char *
13     #endif
14 greg 3.1 #include "tonemap.h"
15 greg 3.2
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 greg 3.1 /* minimum values and defaults */
24     #define MINGAM 0.75
25     #define DEFGAM 2.2
26     #define MINLDDYN 2.
27     #define DEFLDDYN 32.
28     #define MINLDMAX 1.
29     #define DEFLDMAX 100.
30    
31     #define BRT2SCALE ((int)(M_LN2*TM_BRTSCALE+.5))
32    
33     #define HISTEP 8 /* steps in BRTSCALE for each bin */
34    
35     #define MINBRT (-16*TM_BRTSCALE) /* minimum usable brightness */
36     #define MINLUM (1.125352e-7) /* tmLuminance(MINBRT) */
37    
38     #define LMESLOWER (5.62e-3) /* lower mesopic limit */
39 greg 3.3 #define LMESUPPER (5.62) /* upper mesopic limit */
40     #if (TM_BRTSCALE==128)
41 greg 3.2 #define BMESLOWER (-663) /* encoded LMESLOWER */
42     #define BMESUPPER (221) /* encoded LMESUPPER */
43 greg 3.3 #else
44     #define BMESLOWER ((int)(-5.18*TM_BRTSCALE-.5))
45     #define BMESUPPER ((int)(1.73*TM_BRTSCALE+.5))
46     #endif
47 greg 3.1
48     #ifndef int4
49     #define int4 int /* assume 32-bit integers */
50     #endif
51     /* approximate scotopic lum. */
52     #define SCO_rf 0.062
53     #define SCO_gf 0.608
54     #define SCO_bf 0.330
55     #define scotlum(c) (SCO_rf*(c)[RED] + SCO_gf*(c)[GRN] + SCO_bf*(c)[BLU])
56     #define normscot(c) ( ( (int4)(SCO_rf*256.+.5)*(c)[RED] + \
57     (int4)(SCO_gf*256.+.5)*(c)[GRN] + \
58     (int4)(SCO_bf*256.+.5)*(c)[BLU] ) >> 8 )
59    
60     #ifndef malloc
61 greg 3.4 MEM_PTR malloc();
62     MEM_PTR calloc();
63 greg 3.1 #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]))