--- ray/src/common/tonemap.h 1997/04/18 13:59:48 3.4 +++ ray/src/common/tonemap.h 1997/11/17 13:54:35 3.7 @@ -58,6 +58,8 @@ #endif extern char *tmErrorMessage[]; /* error messages */ +extern int tmLastError; /* last error incurred by library */ +extern char *tmLastFunction; /* error-generating function name */ typedef short TMbright; /* encoded luminance type */ @@ -71,8 +73,9 @@ extern struct tmStruct { RGBPRIMP inppri; /* current input primaries */ double inpsf; /* current input scalefactor */ COLORMAT cmat; /* color conversion matrix */ - TMbright brmin, brmax; /* input brightness limits */ + TMbright hbrmin, hbrmax; /* histogram brightness limits */ int *histo; /* input histogram */ + TMbright mbrmin, mbrmax; /* mapped brightness limits */ unsigned short *lumap; /* computed luminance map */ struct tmStruct *tmprev; /* previous tone mapping */ MEM_PTR pd[TM_MAXPKG]; /* pointers to private data */ @@ -195,7 +198,9 @@ tmAddHisto(TMbright *ls, int len, int wt); extern int tmComputeMapping(double gamval, double Lddyn, double Ldmax); /* - Compute tone mapping function. + Compute tone mapping function. This mapping will be used + in subsequent calls to tmMapPixels() until a new tone mapping + is computed. I.e., calls to tmAddHisto() have no immediate effect. gamval - display gamma response (0. for default). Lddyn - the display's dynamic range (0. for default). @@ -222,6 +227,8 @@ tmLoadPicture(TMbright **lpp, BYTE **cpp, int *xp, int char *fname, FILE *fp); /* Load Radiance picture and convert to tone mapping representation. + Memory for the luminance and chroma arrays is allocated using + malloc(3), and should be freed with free(3) when no longer needed. Calls tmSetSpace() to calibrate input color space. lpp - returned array of encoded luminances, English ordering. @@ -243,6 +250,8 @@ tmMapPicture(BYTE **psp, int *xp, int *yp, int flags, If fp is TM_GETFILE and (flags&TM_F_UNIMPL)!=0, tmMapPicture() calls pcond to perform the actual conversion, which takes longer but gives access to all the TM_F_* features. + Memory for the final pixel array is allocated using malloc(3), + and should be freed with free(3) when it is no longer needed. psp - returned array of tone mapped pixels, English ordering. xp, yp - returned picture dimensions. @@ -316,7 +325,7 @@ tmDone(struct tmStruct *tms); pixel values to chroma and luminance encodings, which can be passed to tmAddHisto() to put into the tone mapping histogram. This histogram is then used along with the display parameters - by tmComputMapping() to compute the luminance mapping function. + by tmComputeMapping() to compute the luminance mapping function. (Colors are tone-mapped as they are converted if TM_F_MESOPIC is set.) The encoded chroma and luminance values may then be passed to tmMapPixels() to apply the computed tone mapping in