--- ray/src/common/tmapluv.c 2005/11/15 06:53:00 3.12 +++ ray/src/common/tmapluv.c 2022/01/15 16:57:46 3.17 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: tmapluv.c,v 3.12 2005/11/15 06:53:00 greg Exp $"; +static const char RCSid[] = "$Id: tmapluv.c,v 3.17 2022/01/15 16:57:46 greg Exp $"; #endif /* * Routines for tone-mapping LogLuv encoded pixels. @@ -12,6 +12,7 @@ static const char RCSid[] = "$Id: tmapluv.c,v 3.12 200 #define LOGLUV_PUBLIC 1 #include +#include #include #include #include "tiffio.h" @@ -22,23 +23,23 @@ static const char RCSid[] = "$Id: tmapluv.c,v 3.12 200 #define isuvset(p,uv) uvflgop(p,uv,&) #define setuv(p,uv) uvflgop(p,uv,|=) #define clruv(p,uv) uvflgop(p,uv,&=~) -#define clruvall(p) memset((MEM_PTR)(p)->rgbflg,'\0',sizeof((p)->rgbflg)) +#define clruvall(p) memset((p)->rgbflg,'\0',sizeof((p)->rgbflg)) #ifdef NOPROTO -static MEM_PTR luv32Init(); +static void * luv32Init(); static void luv32NewSpace(); -static MEM_PTR luv24Init(); +static void * luv24Init(); static void luv24NewSpace(); #else -static MEM_PTR luv32Init(TMstruct *); +static void * luv32Init(TMstruct *); static void luv32NewSpace(TMstruct *); -static MEM_PTR luv24Init(TMstruct *); +static void * luv24Init(TMstruct *); static void luv24NewSpace(TMstruct *); #endif typedef struct { int offset; /* computed luminance offset */ - BYTE rgbval[1<<16][3]; /* computed RGB value for given uv */ + uby8 rgbval[1<<16][3]; /* computed RGB value for given uv */ uint32 rgbflg[1<<(16-5)]; /* flags for computed values */ } LUV32DATA; /* LogLuv 32-bit conversion data */ @@ -52,7 +53,7 @@ static int luv32Reg = -1; /* 32-bit package reg. numb typedef struct { int offset; /* computed luminance offset */ - BYTE rgbval[1<<14][3]; /* computed rgb value for uv index */ + uby8 rgbval[1<<14][3]; /* computed rgb value for uv index */ uint32 rgbflg[1<<(14-5)]; /* flags for computed values */ } LUV24DATA; /* LogLuv 24-bit conversion data */ @@ -66,8 +67,8 @@ static int uv14neu = -1; /* neutral index for 14-bit static void uv2rgb(rgb, tms, uvp) /* compute RGB from uv coordinate */ -BYTE rgb[3]; -register TMstruct *tms; +uby8 rgb[3]; +TMstruct *tms; double uvp[2]; { /* Should check that tms->inppri==TM_XYZPRIM beforehand... */ double d, x, y; @@ -98,7 +99,7 @@ TMbright li; /* encoded world luminance */ double uvp[2]; /* world (u',v') -> returned desaturated */ { double scotrat; - register double d; + double d; if (li >= BMESUPPER) return(li); @@ -126,15 +127,15 @@ int tmCvLuv32( /* convert raw 32-bit LogLuv values */ TMstruct *tms, TMbright *ls, -BYTE *cs, +uby8 *cs, uint32 *luvs, int len ) { static const char funcName[] = "tmCvLuv32"; double uvp[2]; - register LUV32DATA *ld; - register int i, j; + LUV32DATA *ld; + int i, j; /* check arguments */ if (tms == NULL) returnErr(TM_E_TMINVAL); @@ -188,15 +189,15 @@ int tmCvLuv24( /* convert raw 24-bit LogLuv values */ TMstruct *tms, TMbright *ls, -BYTE *cs, +uby8 *cs, uint32 *luvs, int len ) { char funcName[] = "tmCvLuv24"; double uvp[2]; - register LUV24DATA *ld; - register int i, j; + LUV24DATA *ld; + int i, j; /* check arguments */ if (tms == NULL) returnErr(TM_E_TMINVAL); @@ -258,7 +259,7 @@ int len static const char funcName[] = "tmCvL16"; static double lastsf; static int offset; - register int i; + int i; /* check arguments */ if (tms == NULL) returnErr(TM_E_TMINVAL); @@ -284,7 +285,7 @@ static void luv32NewSpace(tms) /* initialize 32-bit LogLuv color space */ TMstruct *tms; { - register LUV32DATA *ld; + LUV32DATA *ld; if (tms->inppri != TM_XYZPRIM) { /* panic time! */ fputs("Improper input color space in luv32NewSpace!\n", stderr); @@ -296,18 +297,18 @@ TMstruct *tms; } -static MEM_PTR +static void * luv32Init(tms) /* allocate data for 32-bit LogLuv decoder */ TMstruct *tms; { - register LUV32DATA *ld; + LUV32DATA *ld; ld = (LUV32DATA *)malloc(sizeof(LUV32DATA)); if (ld == NULL) return(NULL); - tms->pd[luv32Reg] = (MEM_PTR)ld; + tms->pd[luv32Reg] = (void *)ld; luv32NewSpace(tms); - return((MEM_PTR)ld); + return((void *)ld); } @@ -315,7 +316,7 @@ static void luv24NewSpace(tms) /* initialize 24-bit LogLuv color space */ TMstruct *tms; { - register LUV24DATA *ld; + LUV24DATA *ld; if (tms->inppri != TM_XYZPRIM) { /* panic time! */ fputs("Improper input color space in luv24NewSpace!\n", stderr); @@ -327,18 +328,18 @@ TMstruct *tms; } -static MEM_PTR +static void * luv24Init(tms) /* allocate data for 24-bit LogLuv decoder */ TMstruct *tms; { - register LUV24DATA *ld; + LUV24DATA *ld; ld = (LUV24DATA *)malloc(sizeof(LUV24DATA)); if (ld == NULL) return(NULL); - tms->pd[luv24Reg] = (MEM_PTR)ld; + tms->pd[luv24Reg] = (void *)ld; if (uv14neu < 0) /* initialize neutral color index */ uv14neu = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER); luv24NewSpace(tms); - return((MEM_PTR)ld); + return((void *)ld); }