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.10 by greg, Fri Jan 7 20:33:02 2005 UTC vs.
Revision 3.14 by greg, Mon Feb 9 20:48:08 2009 UTC

# Line 12 | Line 12 | static const char      RCSid[] = "$Id$";
12   #define LOGLUV_PUBLIC           1
13  
14   #include <stdio.h>
15 + #include <stdlib.h>
16   #include <string.h>
17   #include <math.h>
17 #include "tiffio.h"
18   #include "tmprivat.h"
19 + #include "tiffio.h"
20   #include "tmaptiff.h"
21  
22   #define uvflgop(p,uv,op)        ((p)->rgbflg[(uv)>>5] op (1L<<((uv)&0x1f)))
# Line 131 | Line 132 | uint32 *luvs,
132   int     len
133   )
134   {
135 <        static char     funcName[] = "tmCvLuv32";
135 >        static const char       funcName[] = "tmCvLuv32";
136          double  uvp[2];
137          register LUV32DATA      *ld;
138          register int    i, j;
# Line 255 | Line 256 | uint16 *l16s,
256   int     len
257   )
258   {
259 <        static char     funcName[] = "tmCvL16";
259 >        static const char       funcName[] = "tmCvL16";
260          static double   lastsf;
261          static int      offset;
262          register int    i;
# Line 266 | Line 267 | int    len
267                  returnErr(TM_E_ILLEGAL);
268                                          /* check scaling offset */
269          if (!FEQ(tms->inpsf, lastsf)) {
270 <                offset = BRT2SCALE(64);
270 <                if (tms->inpsf > 1.0001)
271 <                        offset -= (int)(TM_BRTSCALE*log(tms->inpsf)+.5);
272 <                else if (tms->inpsf < 0.9999)
273 <                        offset -= (int)(TM_BRTSCALE*log(tms->inpsf)-.5);
270 >                offset = BRT2SCALE(64) - tmCvLuminance(tms->inpsf);
271                  lastsf = tms->inpsf;
272          }
273                                          /* convert each pixel */
# Line 295 | Line 292 | TMstruct       *tms;
292                  exit(1);
293          }
294          ld = (LUV32DATA *)tms->pd[luv32Reg];
295 <        ld->offset = BRT2SCALE(64);
299 <        if (tms->inpsf > 1.0001)
300 <                ld->offset -= (int)(TM_BRTSCALE*log(tms->inpsf)+.5);
301 <        else if (tms->inpsf < 0.9999)
302 <                ld->offset -= (int)(TM_BRTSCALE*log(tms->inpsf)-.5);
295 >        ld->offset = BRT2SCALE(64) - tmCvLuminance(tms->inpsf);
296          clruvall(ld);
297   }
298  
# Line 330 | Line 323 | TMstruct *tms;
323                  exit(1);
324          }
325          ld = (LUV24DATA *)tms->pd[luv24Reg];
326 <        ld->offset = BRT2SCALE(12);
334 <        if (tms->inpsf > 1.0001)
335 <                ld->offset -= (int)(TM_BRTSCALE*log(tms->inpsf)+.5);
336 <        else if (tms->inpsf < 0.9999)
337 <                ld->offset -= (int)(TM_BRTSCALE*log(tms->inpsf)-.5);
326 >        ld->offset = BRT2SCALE(12) - tmCvLuminance(tms->inpsf);
327          clruvall(ld);
328   }
329  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines