ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/normcodec.h
Revision: 2.2
Committed: Fri Jul 26 17:04:12 2019 UTC (4 years, 9 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.1: +8 -7 lines
Log Message:
Added control for stderr output

File Contents

# User Rev Content
1 greg 2.2 /* RCSid $Id: normcodec.h,v 2.1 2019/07/26 16:18:06 greg Exp $ */
2 greg 2.1 /*
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 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     int format; /* decoded format */
33     long dstart; /* start of data */
34     long curpos; /* current input position */
35     int hdrflags; /* header i/o flags */
36     char inpfmt[MAXFMTLEN]; /* format from header */
37     RESOLU res; /* input resolution */
38     } NORMCODEC;
39    
40     /* Set codec defaults */
41     extern void set_nc_defaults(NORMCODEC *ncp);
42    
43     /* Load/copy header */
44     extern int process_nc_header(NORMCODEC *ncp, int ac, char *av[]);
45    
46     /* Check that we have what we need to decode normals */
47     extern int check_decode_normals(NORMCODEC *ncp);
48    
49     /* Decode next normal from input */
50     extern int decode_normal_next(FVECT nrm, NORMCODEC *ncp);
51    
52     /* Seek to the indicated pixel position */
53     extern int seek_nc_pix(NORMCODEC *ncp, int x, int y);
54    
55     /* Read and decode normal for the given pixel */
56     extern int decode_normal_pix(FVECT nrm, NORMCODEC *ncp, int x, int y);
57    
58     extern char *progname; /* global argv[0] (set by main) */
59    
60     #ifdef __cplusplus
61     }
62     #endif
63     #endif /* _RAD_NORMALCODEC_H_ */