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 */ |
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); |