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

Comparing ray/src/common/depthcodec.c (file contents):
Revision 2.2 by greg, Fri Jul 26 17:04:12 2019 UTC vs.
Revision 2.3 by greg, Fri Jul 26 18:52:32 2019 UTC

# Line 16 | Line 16 | static const char RCSid[] = "$Id$";
16   #include "depthcodec.h"
17  
18  
19 < #if 0                   /* defined as macro in depthcodec.h */
19 > #ifndef depth2code
20   /* Encode depth as 16-bit signed integer */
21   int
22   depth2code(double d, double dref)
# Line 25 | Line 25 | depth2code(double d, double dref)
25                  return -32768;
26  
27          if (d > dref)
28 <                return (int)(32768 - 32768*dref/d) - 1;
28 >                return (int)(32768.001 - 32768.*dref/d) - 1;
29  
30 <        return (int)(32767*d/dref - 32768);
30 >        return (int)(32767.*d/dref - 32768.);
31   }
32   #endif
33  
34  
35 + #ifndef code2depth
36   /* Decode depth from 16-bit signed integer */
37   double
38   code2depth(int c, double dref)
# Line 47 | Line 48 | code2depth(int c, double dref)
48          
49          return dref*32768./(32766.5 - c);
50   }
51 + #endif
52  
53  
54   /* Set codec defaults */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines