| 19 |
|
#define LDEPTHSTR 9 |
| 20 |
|
#define DEPTH16FMT "16-bit_encoded_depth" |
| 21 |
|
|
| 22 |
< |
#define HF_HEADIN 0x1 |
| 23 |
< |
#define HF_HEADOUT 0x2 |
| 24 |
< |
#define HF_RESIN 0x4 |
| 25 |
< |
#define HF_RESOUT 0x8 |
| 26 |
< |
#define HF_ALL 0xf |
| 27 |
< |
#define HF_ENCODE 0x10 |
| 22 |
> |
#define HF_HEADIN 0x1 /* expect input header */ |
| 23 |
> |
#define HF_HEADOUT 0x2 /* write header to stdout */ |
| 24 |
> |
#define HF_RESIN 0x4 /* expect resolution string */ |
| 25 |
> |
#define HF_RESOUT 0x8 /* write resolution to stdout */ |
| 26 |
> |
#define HF_STDERR 0x10 /* report errors to stderr */ |
| 27 |
> |
#define HF_ALL 0x1f /* all flags above */ |
| 28 |
> |
#define HF_ENCODE 0x20 /* we are encoding */ |
| 29 |
|
|
| 30 |
|
/* Structure for encoding/decoding depths and world points */ |
| 31 |
|
typedef struct { |
| 44 |
|
} DEPTHCODEC; |
| 45 |
|
|
| 46 |
|
/* Encode depth as 16-bit signed integer */ |
| 47 |
+ |
#if 1 |
| 48 |
|
#define depth2code(d, dref) \ |
| 49 |
|
( (d) > (dref) ? (int)(32768.001 - 32768.*(dref)/(d))-1 : \ |
| 50 |
|
(d) > .0 ? (int)(32767.*(d)/(dref) - 32768.) : -32768 ) |
| 51 |
+ |
#else |
| 52 |
+ |
extern int depth2code(double d, double dref); |
| 53 |
+ |
#endif |
| 54 |
|
|
| 55 |
|
/* Decode depth from 16-bit signed integer */ |
| 56 |
+ |
#if 1 |
| 57 |
+ |
#define code2depth(c, dref) \ |
| 58 |
+ |
( (c) <= -32768 ? .0 : (c) >= 32767 ? FHUGE : \ |
| 59 |
+ |
(c) < 0 ? (dref)*(32767.5 + (c))*(1./32767.) : \ |
| 60 |
+ |
(dref)*32768./(32766.5 - (c)) ) |
| 61 |
+ |
#else |
| 62 |
|
extern double code2depth(int c, double dref); |
| 63 |
+ |
#endif |
| 64 |
|
|
| 65 |
|
/* Set codec defaults */ |
| 66 |
|
extern void set_dc_defaults(DEPTHCODEC *dcp); |