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

Comparing ray/src/common/depthcodec.h (file contents):
Revision 2.2 by greg, Fri Jul 26 17:04:12 2019 UTC vs.
Revision 2.4 by greg, Wed Aug 14 21:00:14 2019 UTC

# Line 31 | Line 31 | extern "C" {
31   typedef struct {
32          FILE            *finp;                  /* input stream */
33          const char      *inpname;               /* input name */
34 <        int             format;                 /* decoded format */
34 >        short           format;                 /* decoded format */
35 >        short           swapped;                /* byte-swapped input */
36          long            dstart;                 /* start of data */
37          long            curpos;                 /* current input position */
38          double          refdepth;               /* reference depth */
# Line 44 | Line 45 | typedef struct {
45   } DEPTHCODEC;
46  
47   /* Encode depth as 16-bit signed integer */
48 + #if 1
49   #define depth2code(d, dref) \
50                  ( (d) > (dref) ? (int)(32768.001 - 32768.*(dref)/(d))-1 : \
51                    (d) > .0 ? (int)(32767.*(d)/(dref) - 32768.) : -32768 )
52 + #else
53 + extern int      depth2code(double d, double dref);
54 + #endif
55  
56   /* Decode depth from 16-bit signed integer */
57 + #if 1
58 + #define code2depth(c, dref) \
59 +                ( (c) <= -32768 ? .0 : (c) >= 32767 ? FHUGE : \
60 +                  (c) < 0 ? (dref)*(32767.5 + (c))*(1./32767.) : \
61 +                                (dref)*32768./(32766.5 - (c)) )
62 + #else
63   extern double   code2depth(int c, double dref);
64 + #endif
65  
66   /* Set codec defaults */
67   extern void     set_dc_defaults(DEPTHCODEC *dcp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines