ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/normcodec.h
Revision: 2.4
Committed: Thu Nov 7 23:20:28 2019 UTC (4 years, 6 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R3
Changes since 2.3: +3 -3 lines
Log Message:
Added ability for pinterp, pmblur2, and vwrays to read 16-bit encoded depth

File Contents

# User Rev Content
1 greg 2.4 /* RCSid $Id: normcodec.h,v 2.3 2019/08/14 21:00:14 greg Exp $ */
2 greg 2.1 /*
3     * Definitions and declarations for 32-bit vector normal encode/decode
4     *
5 greg 2.4 * Include after rtio.h and fvect.h
6 greg 2.1 * 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 greg 2.2 #define HF_HEADIN 0x1 /* expect input header */
21     #define HF_HEADOUT 0x2 /* write header to stdout */
22     #define HF_RESIN 0x4 /* expect resolution string */
23     #define HF_RESOUT 0x8 /* write resolution to stdout */
24     #define HF_STDERR 0x10 /* report errors to stderr */
25     #define HF_ALL 0x1f /* all flags above */
26     #define HF_ENCODE 0x20 /* we are encoding */
27 greg 2.1
28     /* Structure for encoding/decoding normals */
29     typedef struct {
30     FILE *finp; /* input stream */
31     const char *inpname; /* input name */
32 greg 2.3 short format; /* decoded format */
33     short swapped; /* byte-swapped input */
34 greg 2.1 long dstart; /* start of data */
35     long curpos; /* current input position */
36 greg 2.4 short hdrflags; /* header i/o flags */
37 greg 2.1 char inpfmt[MAXFMTLEN]; /* format from header */
38     RESOLU res; /* input resolution */
39     } NORMCODEC;
40    
41     /* Set codec defaults */
42     extern void set_nc_defaults(NORMCODEC *ncp);
43    
44     /* Load/copy header */
45     extern int process_nc_header(NORMCODEC *ncp, int ac, char *av[]);
46    
47     /* Check that we have what we need to decode normals */
48     extern int check_decode_normals(NORMCODEC *ncp);
49    
50     /* Decode next normal from input */
51     extern int decode_normal_next(FVECT nrm, NORMCODEC *ncp);
52    
53     /* Seek to the indicated pixel position */
54     extern int seek_nc_pix(NORMCODEC *ncp, int x, int y);
55    
56     /* Read and decode normal for the given pixel */
57     extern int decode_normal_pix(FVECT nrm, NORMCODEC *ncp, int x, int y);
58    
59     extern char *progname; /* global argv[0] (set by main) */
60    
61     #ifdef __cplusplus
62     }
63     #endif
64     #endif /* _RAD_NORMALCODEC_H_ */