| 14 |
|
#endif |
| 15 |
|
|
| 16 |
|
/**** Argument Macros ****/ |
| 17 |
< |
/* Flags of what to do */ |
| 17 |
> |
/* flags of what to do */ |
| 18 |
|
#define TM_F_HCONTR 01 /* human contrast sensitivity */ |
| 19 |
|
#define TM_F_MESOPIC 02 /* mesopic color sensitivity */ |
| 20 |
|
#define TM_F_LINEAR 04 /* linear brightness mapping */ |
| 66 |
|
#endif |
| 67 |
|
|
| 68 |
|
extern char *tmErrorMessage[]; /* error messages */ |
| 69 |
– |
extern int tmLastError; /* last error incurred by library */ |
| 70 |
– |
extern char *tmLastFunction; /* error-generating function name */ |
| 69 |
|
|
| 70 |
|
typedef short TMbright; /* encoded luminance type */ |
| 71 |
|
|
| 72 |
|
/* basic tone mapping data structure */ |
| 73 |
< |
typedef struct tmStruct { |
| 73 |
> |
typedef struct { |
| 74 |
|
int flags; /* flags of what to do */ |
| 75 |
|
RGBPRIMP monpri; /* monitor RGB primaries */ |
| 76 |
|
double mongam; /* monitor gamma value (approx.) */ |
| 78 |
|
int cdiv[3]; /* computed color divisors */ |
| 79 |
|
RGBPRIMP inppri; /* current input primaries */ |
| 80 |
|
double inpsf; /* current input scalefactor */ |
| 81 |
+ |
MEM_PTR inpdat; /* current input client data */ |
| 82 |
|
COLORMAT cmat; /* color conversion matrix */ |
| 83 |
|
TMbright hbrmin, hbrmax; /* histogram brightness limits */ |
| 84 |
|
int *histo; /* input histogram */ |
| 85 |
|
TMbright mbrmin, mbrmax; /* mapped brightness limits */ |
| 86 |
|
unsigned short *lumap; /* computed luminance map */ |
| 87 |
|
MEM_PTR pd[TM_MAXPKG]; /* pointers to private data */ |
| 88 |
+ |
int lastError; /* last error incurred */ |
| 89 |
+ |
const char *lastFunc; /* error-generating function name */ |
| 90 |
|
} TMstruct; |
| 91 |
|
|
| 92 |
|
/* conversion package functions */ |
| 118 |
|
|
| 119 |
|
/**** Library Function Calls ****/ |
| 120 |
|
|
| 121 |
+ |
extern TMbright |
| 122 |
+ |
tmCvLuminance(double lum); |
| 123 |
+ |
/* |
| 124 |
+ |
Convert a single luminance value to an encoded brightness value. |
| 125 |
+ |
*/ |
| 126 |
|
|
| 127 |
|
extern TMstruct * |
| 128 |
|
tmInit(int flags, RGBPRIMP monpri, double gamval); |
| 137 |
|
*/ |
| 138 |
|
|
| 139 |
|
extern int |
| 140 |
< |
tmSetSpace(TMstruct *tms, RGBPRIMP pri, double sf); |
| 140 |
> |
tmSetSpace(TMstruct *tms, RGBPRIMP pri, double sf, MEM_PTR dat); |
| 141 |
|
/* |
| 142 |
|
Set color primaries and scale factor for incoming scanlines. |
| 143 |
|
|
| 144 |
|
tms - tone mapping structure pointer. |
| 145 |
|
pri - RGB color input primaries (Note 1). |
| 146 |
|
sf - scale factor to get to luminance in cd/m^2. |
| 147 |
+ |
dat - application-specific data (NULL if not needed) |
| 148 |
|
|
| 149 |
|
returns - 0 on success, TM_E_* code on failure. |
| 150 |
|
*/ |
| 182 |
|
tms - tone mapping structure pointer. |
| 183 |
|
expmult - the fixed exposure multiplier to use. |
| 184 |
|
gamval - display gamma response (0. for default). |
| 185 |
+ |
|
| 186 |
|
returns - 0 on success, TM_E_* on error. |
| 187 |
|
*/ |
| 188 |
|
|
| 222 |
|
Duplicate the given tone mapping into a new struct. |
| 223 |
|
|
| 224 |
|
orig - tone mapping structure to duplicate. |
| 225 |
+ |
|
| 226 |
|
returns - pointer to new struct, or NULL on error. |
| 227 |
|
*/ |
| 228 |
|
|