1 |
greg |
2.1 |
/* RCSid $Id: depthcodec.h,v 2.3 2019/07/19 00:01:49 greg Exp $ */ |
2 |
|
|
/* |
3 |
|
|
* Definitions and declarations for 32-bit vector normal encode/decode |
4 |
|
|
* |
5 |
|
|
* Include after stdio.h and fvect.h |
6 |
|
|
* Includes resolu.h |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
#ifndef _RAD_NORMALCODEC_H_ |
10 |
|
|
#define _RAD_NORMALCODEC_H_ |
11 |
|
|
|
12 |
|
|
#include "resolu.h" |
13 |
|
|
|
14 |
|
|
#ifdef __cplusplus |
15 |
|
|
extern "C" { |
16 |
|
|
#endif |
17 |
|
|
|
18 |
|
|
#define NORMAL32FMT "32-bit_encoded_normal" |
19 |
|
|
|
20 |
|
|
#define HF_HEADIN 0x1 |
21 |
|
|
#define HF_HEADOUT 0x2 |
22 |
|
|
#define HF_RESIN 0x4 |
23 |
|
|
#define HF_RESOUT 0x8 |
24 |
|
|
#define HF_ALL 0xf |
25 |
|
|
#define HF_ENCODE 0x10 |
26 |
|
|
|
27 |
|
|
/* Structure for encoding/decoding depths and world points */ |
28 |
|
|
typedef struct { |
29 |
|
|
FILE *finp; /* input stream */ |
30 |
|
|
const char *inpname; /* input name */ |
31 |
|
|
int format; /* decoded format */ |
32 |
|
|
long dstart; /* start of data */ |
33 |
|
|
long curpos; /* current input position */ |
34 |
|
|
int hdrflags; /* header i/o flags */ |
35 |
|
|
char inpfmt[MAXFMTLEN]; /* format from header */ |
36 |
|
|
RESOLU res; /* input resolution */ |
37 |
|
|
} NORMCODEC; |
38 |
|
|
|
39 |
|
|
/* Set codec defaults */ |
40 |
|
|
extern void set_nc_defaults(NORMCODEC *ncp); |
41 |
|
|
|
42 |
|
|
/* Load/copy header */ |
43 |
|
|
extern int process_nc_header(NORMCODEC *ncp, int ac, char *av[]); |
44 |
|
|
|
45 |
|
|
/* Check that we have what we need to decode depths */ |
46 |
|
|
extern int check_decode_normals(NORMCODEC *ncp); |
47 |
|
|
|
48 |
|
|
/* Decode next normal from input */ |
49 |
|
|
extern int decode_normal_next(FVECT nrm, NORMCODEC *ncp); |
50 |
|
|
|
51 |
|
|
/* Seek to the indicated pixel position */ |
52 |
|
|
extern int seek_nc_pix(NORMCODEC *ncp, int x, int y); |
53 |
|
|
|
54 |
|
|
/* Read and decode depth for the given pixel */ |
55 |
|
|
extern int decode_normal_pix(FVECT nrm, NORMCODEC *ncp, int x, int y); |
56 |
|
|
|
57 |
|
|
extern char *progname; /* global argv[0] (set by main) */ |
58 |
|
|
|
59 |
|
|
#ifdef __cplusplus |
60 |
|
|
} |
61 |
|
|
#endif |
62 |
|
|
#endif /* _RAD_NORMALCODEC_H_ */ |