16 |
|
#include "depthcodec.h" |
17 |
|
|
18 |
|
|
19 |
< |
#if 0 /* defined as macro in depthcodec.h */ |
19 |
> |
#ifndef depth2code |
20 |
|
/* Encode depth as 16-bit signed integer */ |
21 |
|
int |
22 |
|
depth2code(double d, double dref) |
25 |
|
return -32768; |
26 |
|
|
27 |
|
if (d > dref) |
28 |
< |
return (int)(32768 - 32768*dref/d) - 1; |
28 |
> |
return (int)(32768.001 - 32768.*dref/d) - 1; |
29 |
|
|
30 |
< |
return (int)(32767*d/dref - 32768); |
30 |
> |
return (int)(32767.*d/dref - 32768.); |
31 |
|
} |
32 |
|
#endif |
33 |
|
|
34 |
|
|
35 |
+ |
#ifndef code2depth |
36 |
|
/* Decode depth from 16-bit signed integer */ |
37 |
|
double |
38 |
|
code2depth(int c, double dref) |
48 |
|
|
49 |
|
return dref*32768./(32766.5 - c); |
50 |
|
} |
51 |
+ |
#endif |
52 |
|
|
53 |
|
|
54 |
|
/* Set codec defaults */ |