43 |
|
} DEPTHCODEC; |
44 |
|
|
45 |
|
/* Encode depth as 16-bit signed integer */ |
46 |
< |
extern short depth2code(double d, double dref); |
46 |
> |
#define depth2code(d, dref) \ |
47 |
> |
( (d) > (dref) ? (int)(32768. - 32768.*(dref)/(d))-1 : \ |
48 |
> |
(d) > .0 ? (int)(32767.*(d)/(dref) - 32768.) : -32768 ) |
49 |
|
|
50 |
|
/* Decode depth from 16-bit signed integer */ |
51 |
< |
extern double code2depth(short c, double dref); |
51 |
> |
extern double code2depth(int c, double dref); |
52 |
|
|
53 |
|
/* Set codec defaults */ |
54 |
|
extern void set_dc_defaults(DEPTHCODEC *dcp); |
59 |
|
/* Check that we have what we need to decode depths */ |
60 |
|
extern int check_decode_depths(DEPTHCODEC *dcp); |
61 |
|
|
62 |
< |
/* Decode next depth pixel */ |
62 |
> |
/* Decode next depth pixel from input */ |
63 |
|
extern double decode_depth_next(DEPTHCODEC *dcp); |
64 |
|
|
65 |
|
/* Seek to the indicated pixel position */ |
71 |
|
/* Check that we have what we need to decode world positions */ |
72 |
|
extern int check_decode_worldpos(DEPTHCODEC *dcp); |
73 |
|
|
74 |
< |
/* Compute world position from depth */ |
74 |
> |
/* Compute world position from pixel position and depth */ |
75 |
|
extern int compute_worldpos(FVECT wpos, DEPTHCODEC *dcp, |
76 |
|
int x, int y, double d); |
77 |
|
|
78 |
< |
/* Decode the next world position */ |
78 |
> |
/* Decode the next world position from input */ |
79 |
|
int decode_worldpos_next(FVECT wpos, DEPTHCODEC *dcp); |
80 |
|
|
81 |
< |
/* Read and decode the world position at the given pixel */ |
81 |
> |
/* Decode depth and compute world position for the given pixel */ |
82 |
|
extern int get_worldpos_pix(FVECT wpos, DEPTHCODEC *dcp, int x, int y); |
83 |
|
|
84 |
|
extern char *progname; /* global argv[0] (set by main) */ |