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.6 by greg, Sat Jan 25 02:36:25 2020 UTC

# Line 2 | Line 2
2   /*
3   * Definitions and declarations for 16-bit depth encode/decode
4   *
5 < *  Include after stdio.h and fvect.h
5 > *  Include after rtio.h and fvect.h
6   *  Includes view.h
7   */
8  
# 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 >        short           last_dc;                /* last depth-code read */
37 >        short           use_last;               /* use last depth-code next */
38          long            dstart;                 /* start of data */
39          long            curpos;                 /* current input position */
40          double          refdepth;               /* reference depth */
41          char            depth_unit[32];         /* string including units */
42 <        int             hdrflags;               /* header i/o flags */
42 >        short           hdrflags;               /* header i/o flags */
43          char            inpfmt[MAXFMTLEN];      /* format from header */
44 +        short           gotview;                /* got input view? */
45          VIEW            vw;                     /* input view parameters */
42        int             gotview;                /* got input view? */
46          RESOLU          res;                    /* input resolution */
47   } DEPTHCODEC;
48  
49   /* Encode depth as 16-bit signed integer */
50 + #if 1
51   #define depth2code(d, dref) \
52                  ( (d) > (dref) ? (int)(32768.001 - 32768.*(dref)/(d))-1 : \
53                    (d) > .0 ? (int)(32767.*(d)/(dref) - 32768.) : -32768 )
54 + #else
55 + extern int      depth2code(double d, double dref);
56 + #endif
57  
58   /* Decode depth from 16-bit signed integer */
59 + #if 1
60 + #define code2depth(c, dref) \
61 +                ( (c) <= -32768 ? .0 : (c) >= 32767 ? FHUGE : \
62 +                  (c) < -1 ? (dref)*(32768.5 + (c))*(1./32767.) : \
63 +                                (dref)*32768./(32766.5 - (c)) )
64 + #else
65   extern double   code2depth(int c, double dref);
66 + #endif
67  
68   /* Set codec defaults */
69   extern void     set_dc_defaults(DEPTHCODEC *dcp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines