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

Comparing ray/src/common/tmapluv.c (file contents):
Revision 3.14 by greg, Mon Feb 9 20:48:08 2009 UTC vs.
Revision 3.17 by greg, Sat Jan 15 16:57:46 2022 UTC

# Line 15 | Line 15 | static const char      RCSid[] = "$Id$";
15   #include <stdlib.h>
16   #include <string.h>
17   #include <math.h>
18 #include "tmprivat.h"
18   #include "tiffio.h"
19 + #include "tmprivat.h"
20   #include "tmaptiff.h"
21  
22   #define uvflgop(p,uv,op)        ((p)->rgbflg[(uv)>>5] op (1L<<((uv)&0x1f)))
23   #define isuvset(p,uv)           uvflgop(p,uv,&)
24   #define setuv(p,uv)             uvflgop(p,uv,|=)
25   #define clruv(p,uv)             uvflgop(p,uv,&=~)
26 < #define clruvall(p)             memset((MEM_PTR)(p)->rgbflg,'\0',sizeof((p)->rgbflg))
26 > #define clruvall(p)             memset((p)->rgbflg,'\0',sizeof((p)->rgbflg))
27  
28   #ifdef NOPROTO
29 < static MEM_PTR  luv32Init();
29 > static void *   luv32Init();
30   static void     luv32NewSpace();
31 < static MEM_PTR  luv24Init();
31 > static void *   luv24Init();
32   static void     luv24NewSpace();
33   #else
34 < static MEM_PTR  luv32Init(TMstruct *);
34 > static void *   luv32Init(TMstruct *);
35   static void     luv32NewSpace(TMstruct *);
36 < static MEM_PTR  luv24Init(TMstruct *);
36 > static void *   luv24Init(TMstruct *);
37   static void     luv24NewSpace(TMstruct *);
38   #endif
39  
40   typedef struct {
41          int     offset;                 /* computed luminance offset */
42 <        BYTE    rgbval[1<<16][3];       /* computed RGB value for given uv */
42 >        uby8    rgbval[1<<16][3];       /* computed RGB value for given uv */
43          uint32  rgbflg[1<<(16-5)];      /* flags for computed values */
44   } LUV32DATA;                    /* LogLuv 32-bit conversion data */
45  
# Line 53 | Line 53 | static int     luv32Reg = -1;          /* 32-bit package reg. numb
53  
54   typedef struct {
55          int     offset;                 /* computed luminance offset */
56 <        BYTE    rgbval[1<<14][3];       /* computed rgb value for uv index */
56 >        uby8    rgbval[1<<14][3];       /* computed rgb value for uv index */
57          uint32  rgbflg[1<<(14-5)];      /* flags for computed values */
58   } LUV24DATA;                    /* LogLuv 24-bit conversion data */
59  
# Line 67 | Line 67 | static int     uv14neu = -1;           /* neutral index for 14-bit
67  
68   static void
69   uv2rgb(rgb, tms, uvp)                   /* compute RGB from uv coordinate */
70 < BYTE    rgb[3];
71 < register TMstruct       *tms;
70 > uby8    rgb[3];
71 > TMstruct        *tms;
72   double  uvp[2];
73   {       /* Should check that tms->inppri==TM_XYZPRIM beforehand... */
74          double  d, x, y;
# Line 99 | Line 99 | TMbright       li;             /* encoded world luminance */
99   double  uvp[2];                 /* world (u',v') -> returned desaturated */
100   {
101          double  scotrat;
102 <        register double d;
102 >        double  d;
103  
104          if (li >= BMESUPPER)
105                  return(li);
# Line 127 | Line 127 | int
127   tmCvLuv32(                              /* convert raw 32-bit LogLuv values */
128   TMstruct        *tms,
129   TMbright        *ls,
130 < BYTE    *cs,
130 > uby8    *cs,
131   uint32  *luvs,
132   int     len
133   )
134   {
135          static const char       funcName[] = "tmCvLuv32";
136          double  uvp[2];
137 <        register LUV32DATA      *ld;
138 <        register int    i, j;
137 >        LUV32DATA       *ld;
138 >        int     i, j;
139                                          /* check arguments */
140          if (tms == NULL)
141                  returnErr(TM_E_TMINVAL);
# Line 189 | Line 189 | int
189   tmCvLuv24(                      /* convert raw 24-bit LogLuv values */
190   TMstruct        *tms,
191   TMbright        *ls,
192 < BYTE    *cs,
192 > uby8    *cs,
193   uint32  *luvs,
194   int     len
195   )
196   {
197          char    funcName[] = "tmCvLuv24";
198          double  uvp[2];
199 <        register LUV24DATA      *ld;
200 <        register int    i, j;
199 >        LUV24DATA       *ld;
200 >        int     i, j;
201                                          /* check arguments */
202          if (tms == NULL)
203                  returnErr(TM_E_TMINVAL);
# Line 259 | Line 259 | int    len
259          static const char       funcName[] = "tmCvL16";
260          static double   lastsf;
261          static int      offset;
262 <        register int    i;
262 >        int     i;
263                                          /* check arguments */
264          if (tms == NULL)
265                  returnErr(TM_E_TMINVAL);
# Line 285 | Line 285 | static void
285   luv32NewSpace(tms)              /* initialize 32-bit LogLuv color space */
286   TMstruct        *tms;
287   {
288 <        register LUV32DATA      *ld;
288 >        LUV32DATA       *ld;
289  
290          if (tms->inppri != TM_XYZPRIM) {                /* panic time! */
291                  fputs("Improper input color space in luv32NewSpace!\n", stderr);
# Line 297 | Line 297 | TMstruct       *tms;
297   }
298  
299  
300 < static MEM_PTR
300 > static void *
301   luv32Init(tms)                  /* allocate data for 32-bit LogLuv decoder */
302   TMstruct        *tms;
303   {
304 <        register LUV32DATA      *ld;
304 >        LUV32DATA       *ld;
305  
306          ld = (LUV32DATA *)malloc(sizeof(LUV32DATA));
307          if (ld == NULL)
308                  return(NULL);
309 <        tms->pd[luv32Reg] = (MEM_PTR)ld;
309 >        tms->pd[luv32Reg] = (void *)ld;
310          luv32NewSpace(tms);
311 <        return((MEM_PTR)ld);
311 >        return((void *)ld);
312   }
313  
314  
# Line 316 | Line 316 | static void
316   luv24NewSpace(tms)              /* initialize 24-bit LogLuv color space */
317   TMstruct *tms;
318   {
319 <        register LUV24DATA      *ld;
319 >        LUV24DATA       *ld;
320  
321          if (tms->inppri != TM_XYZPRIM) {                /* panic time! */
322                  fputs("Improper input color space in luv24NewSpace!\n", stderr);
# Line 328 | Line 328 | TMstruct *tms;
328   }
329  
330  
331 < static MEM_PTR
331 > static void *
332   luv24Init(tms)                  /* allocate data for 24-bit LogLuv decoder */
333   TMstruct        *tms;
334   {
335 <        register LUV24DATA      *ld;
335 >        LUV24DATA       *ld;
336  
337          ld = (LUV24DATA *)malloc(sizeof(LUV24DATA));
338          if (ld == NULL)
339                  return(NULL);
340 <        tms->pd[luv24Reg] = (MEM_PTR)ld;
340 >        tms->pd[luv24Reg] = (void *)ld;
341          if (uv14neu < 0)                /* initialize neutral color index */
342                  uv14neu = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);
343          luv24NewSpace(tms);
344 <        return((MEM_PTR)ld);
344 >        return((void *)ld);
345   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines