58 |
|
#endif |
59 |
|
|
60 |
|
extern char *tmErrorMessage[]; /* error messages */ |
61 |
+ |
extern int tmLastError; /* last error incurred by library */ |
62 |
+ |
extern char *tmLastFunction; /* error-generating function name */ |
63 |
|
|
64 |
|
typedef short TMbright; /* encoded luminance type */ |
65 |
|
|
73 |
|
RGBPRIMP inppri; /* current input primaries */ |
74 |
|
double inpsf; /* current input scalefactor */ |
75 |
|
COLORMAT cmat; /* color conversion matrix */ |
76 |
< |
TMbright brmin, brmax; /* input brightness limits */ |
76 |
> |
TMbright hbrmin, hbrmax; /* histogram brightness limits */ |
77 |
|
int *histo; /* input histogram */ |
78 |
+ |
TMbright mbrmin, mbrmax; /* mapped brightness limits */ |
79 |
|
unsigned short *lumap; /* computed luminance map */ |
80 |
|
struct tmStruct *tmprev; /* previous tone mapping */ |
81 |
|
MEM_PTR pd[TM_MAXPKG]; /* pointers to private data */ |
198 |
|
extern int |
199 |
|
tmComputeMapping(double gamval, double Lddyn, double Ldmax); |
200 |
|
/* |
201 |
< |
Compute tone mapping function. |
201 |
> |
Compute tone mapping function. This mapping will be used |
202 |
> |
in subsequent calls to tmMapPixels() until a new tone mapping |
203 |
> |
is computed. I.e., calls to tmAddHisto() have no immediate effect. |
204 |
|
|
205 |
|
gamval - display gamma response (0. for default). |
206 |
|
Lddyn - the display's dynamic range (0. for default). |
227 |
|
char *fname, FILE *fp); |
228 |
|
/* |
229 |
|
Load Radiance picture and convert to tone mapping representation. |
230 |
+ |
Memory for the luminance and chroma arrays is allocated using |
231 |
+ |
malloc(3), and should be freed with free(3) when no longer needed. |
232 |
|
Calls tmSetSpace() to calibrate input color space. |
233 |
|
|
234 |
|
lpp - returned array of encoded luminances, English ordering. |
250 |
|
If fp is TM_GETFILE and (flags&TM_F_UNIMPL)!=0, tmMapPicture() |
251 |
|
calls pcond to perform the actual conversion, which takes |
252 |
|
longer but gives access to all the TM_F_* features. |
253 |
+ |
Memory for the final pixel array is allocated using malloc(3), |
254 |
+ |
and should be freed with free(3) when it is no longer needed. |
255 |
|
|
256 |
|
psp - returned array of tone mapped pixels, English ordering. |
257 |
|
xp, yp - returned picture dimensions. |
325 |
|
pixel values to chroma and luminance encodings, which can |
326 |
|
be passed to tmAddHisto() to put into the tone mapping histogram. |
327 |
|
This histogram is then used along with the display parameters |
328 |
< |
by tmComputMapping() to compute the luminance mapping function. |
328 |
> |
by tmComputeMapping() to compute the luminance mapping function. |
329 |
|
(Colors are tone-mapped as they are converted if TM_F_MESOPIC |
330 |
|
is set.) The encoded chroma and luminance values may then be |
331 |
|
passed to tmMapPixels() to apply the computed tone mapping in |