ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/tonemap.h
(Generate patch)

Comparing ray/src/common/tonemap.h (file contents):
Revision 3.3 by greg, Wed Apr 16 20:28:07 1997 UTC vs.
Revision 3.4 by greg, Fri Apr 18 13:59:48 1997 UTC

# Line 8 | Line 8
8                                  /* required non-system header files */
9   #include        "color.h"
10  
11 +
12   /****    Argument Macros    ****/
13                                  /* Flags of what to do */
14   #define TM_F_HCONTR     01              /* human contrast sensitivity */
# Line 39 | Line 40
40   #define TM_E_TMINVAL    3               /* no valid tone mapping */
41   #define TM_E_TMFAIL     4               /* cannot compute tone mapping */
42   #define TM_E_BADFILE    5               /* cannot open or understand file */
43 + #define TM_E_CODERR1    6               /* code consistency error 1 */
44 + #define TM_E_CODERR2    7               /* code consistency error 2 */
45  
46 +
47   /****    Conversion Constants and Table Sizes    ****/
48  
49   #define TM_BRTSCALE     128             /* brightness scale factor (integer) */
50  
51 < #define TM_GAMTSZ       1024            /* gamma lookup table size */
51 > #define TM_MAXPKG       8               /* maximum number of color formats */
52  
49 /****    Global Data Structures    ****/
53  
54 + /****    Global Data Types and Structures    ****/
55 +
56 + #ifndef MEM_PTR
57 + #define MEM_PTR         void *
58 + #endif
59 +
60   extern char     *tmErrorMessage[];      /* error messages */
61  
62   typedef short   TMbright;               /* encoded luminance type */
# Line 57 | Line 66 | extern struct tmStruct {
66          int             flags;          /* flags of what to do */
67          RGBPRIMP        monpri;         /* monitor RGB primaries */
68          double          mongam;         /* monitor gamma value (approx.) */
60        BYTE            gamb[TM_GAMTSZ];/* gamma lookup table from mongam */
69          COLOR           clf;            /* computed luminance coefficients */
70 <        COLR            clfb;           /* normalized version of clf */
70 >        int             cdiv[3];        /* computed color divisors */
71          RGBPRIMP        inppri;         /* current input primaries */
72          double          inpsf;          /* current input scalefactor */
65        TMbright        inpsfb;         /* encoded version of inpsf */
73          COLORMAT        cmat;           /* color conversion matrix */
74          TMbright        brmin, brmax;   /* input brightness limits */  
75          int             *histo;         /* input histogram */
76          unsigned short  *lumap;         /* computed luminance map */
77          struct tmStruct *tmprev;        /* previous tone mapping */
78 +        MEM_PTR         pd[TM_MAXPKG];  /* pointers to private data */
79   }       *tmTop;                 /* current tone mapping stack */
80 <
80 >
81 >                                /* conversion package functions */
82 > #ifdef  NOPROTO
83 > struct tmPackage {
84 >        MEM_PTR         (*Init)();      /* initialize private data */
85 >        void            (*NewSpace)();  /* new input color space (optional) */
86 >        void            (*Free)();      /* free private data */
87 > };
88 > #else
89 > struct tmPackage {
90 >        MEM_PTR         (*Init)(struct tmStruct *tms);
91 >        int             (*NewSpace)(struct tmStruct *tms);
92 >        void            (*Free)(MEM_PTR pp);
93 > };
94 > #endif
95 >                                /* our list of conversion packages */
96 > extern struct tmPackage *tmPkg[TM_MAXPKG];
97 > extern int      tmNumPkgs;      /* number of registered packages */
98 >
99 >
100   /****    Useful Macros    ****/
101  
102 +                                /* compute luminance from encoded value */
103   #define tmLuminance(li) exp((li)/(double)TM_BRTSCALE)
104  
105 +                                /* does tone mapping need color matrix? */
106 + #define tmNeedMatrix(t) ((t)->monpri != (t)->inppri)
107 +
108 +                                /* register a conversion package */
109 + #define tmRegPkg(pf)    ( tmNumPkgs >= TM_MAXPKG ? -1 : \
110 +                                (tmPkg[tmNumPkgs] = (pf), tmNumPkgs++) )
111 +
112 +                                /* get the specific package's data */
113 + #define tmPkgData(t,i)  ((t)->pd[i]!=NULL ? (t)->pd[i] : (*tmPkg[i]->Init)(t))
114 +
115 +
116   /****    Library Function Calls    ****/
117  
118 < #ifdef NOPROTO
118 > #ifdef  NOPROTO
119  
120   extern struct tmStruct  *tmInit(), *tmPop(), *tmDup();
121   extern void     tmClearHisto(), tmDone();
# Line 267 | Line 306 | tmDone(struct tmStruct *tms);
306   */
307  
308   #endif
309 <
309 >
310 >
311   /****    Notes    ****/
312   /*
313          General:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines