1 |
/* RCSid $Id: ranimove.h,v 3.5 2003/07/14 22:24:00 schorsch Exp $ */ |
2 |
/* |
3 |
* ranimove.h |
4 |
* |
5 |
* Radiance object animation program |
6 |
* |
7 |
* The main difference between this program and ranimate is that |
8 |
* ranimove is optimized for object motion, and includes a complete |
9 |
* blur simulation. We also have a number of clever schemes |
10 |
* for optimizing the computation, allowing rendering time |
11 |
* per frame and noticeable difference threshold to be specified. |
12 |
* Parallel rendering uses multiple processors on the local host, |
13 |
* and network rendering is not directly supported. (However, no |
14 |
* one says you can't run ranimove on other machines at the |
15 |
* same time; just be careful not to overlap frames.) |
16 |
* |
17 |
* See the ranimove(1) man page for further details. |
18 |
*/ |
19 |
#ifndef _RAD_RANIMOVE_H_ |
20 |
#define _RAD_RANIMOVE_H_ |
21 |
|
22 |
#include "ray.h" |
23 |
#include "view.h" |
24 |
#include "vars.h" |
25 |
|
26 |
#ifdef __cplusplus |
27 |
extern "C" { |
28 |
#endif |
29 |
|
30 |
/* input variables (alphabetical by name) */ |
31 |
#define BASENAME 0 /* output image base name */ |
32 |
#define END 1 /* number of animation frames */ |
33 |
#define EXPOSURE 2 /* how to compute exposure */ |
34 |
#define HIGHQ 3 /* high quality setting */ |
35 |
#define LOWQ 4 /* low quality setting */ |
36 |
#define MBLUR 5 /* motion blur parameter */ |
37 |
#define MOVE 6 /* object movement */ |
38 |
#define OCONV 7 /* oconv options */ |
39 |
#define OCTREEF 8 /* octree file name */ |
40 |
#define RATE 9 /* frame rate (fps) */ |
41 |
#define RESOLUTION 10 /* desired final resolution */ |
42 |
#define RIF 11 /* rad input file */ |
43 |
#define VIEWFILE 12 /* animation frame views */ |
44 |
|
45 |
#define NV_INIT 13 /* number of variables */ |
46 |
|
47 |
#define VV_INIT { \ |
48 |
{"BASENAME", 3, 0, NULL, onevalue}, \ |
49 |
{"END", 3, 0, NULL, intvalue}, \ |
50 |
{"EXPOSURE", 3, 0, NULL, onevalue}, \ |
51 |
{"highq", 2, 0, NULL, catvalues}, \ |
52 |
{"lowq", 2, 0, NULL, catvalues}, \ |
53 |
{"MBLUR", 2, 0, NULL, fltvalue}, \ |
54 |
{"move", 2, 0, NULL, NULL}, \ |
55 |
{"oconv", 2, 0, NULL, catvalues}, \ |
56 |
{"OCTREE", 3, 0, NULL, onevalue}, \ |
57 |
{"RATE", 2, 0, NULL, fltvalue}, \ |
58 |
{"RESOLUTION", 3, 0, NULL, onevalue}, \ |
59 |
{"RIF", 3, 0, NULL, onevalue}, \ |
60 |
{"VIEWFILE", 2, 0, NULL, onevalue} \ |
61 |
} |
62 |
|
63 |
struct ObjMove { |
64 |
int parent; /* parent object index */ |
65 |
char name[64]; /* object name */ |
66 |
char xf_file[128]; /* transform file name */ |
67 |
char spec[512]; /* object file or command */ |
68 |
char prio_file[128]; /* priority file name */ |
69 |
int cfm; /* current frame number */ |
70 |
char xfs[512]; /* part transform arguments */ |
71 |
MAT4 xfm; /* part transform matrix */ |
72 |
MAT4 cxfm; /* combined transform matrix */ |
73 |
MAT4 bxfm; /* transform to previous frame */ |
74 |
double prio; /* part priority */ |
75 |
double cprio; /* combined priority */ |
76 |
}; |
77 |
|
78 |
extern int silent; /* run silently? */ |
79 |
|
80 |
extern int quickstart; /* time initial frame as well? */ |
81 |
|
82 |
extern int nprocs; /* number of rendering processes */ |
83 |
|
84 |
extern int rtperfrm; /* seconds to spend per frame */ |
85 |
|
86 |
extern double ndthresh; /* noticeable difference threshold */ |
87 |
extern int ndtset; /* did user set ndthresh? */ |
88 |
|
89 |
extern int fbeg; /* starting frame */ |
90 |
extern int fend; /* ending frame */ |
91 |
extern int fcur; /* current frame being rendered */ |
92 |
|
93 |
extern char lorendoptf[]; /* LQ options file */ |
94 |
extern RAYPARAMS lorendparams; /* LQ rendering parameters */ |
95 |
extern char hirendoptf[]; /* HQ options file */ |
96 |
extern RAYPARAMS hirendparams; /* HQ rendering parameters */ |
97 |
extern RAYPARAMS *curparams; /* current parameter settings */ |
98 |
extern int twolevels; /* low and high quality differ */ |
99 |
|
100 |
extern double mblur; /* vflt(MBLUR) */ |
101 |
extern double rate; /* vflt(RATE) */ |
102 |
|
103 |
extern char objtmpf[]; /* object temporary file */ |
104 |
|
105 |
extern struct ObjMove *obj_move; /* object movements */ |
106 |
|
107 |
extern int haveprio; /* high-level saliency specified */ |
108 |
|
109 |
extern int gargc; /* global argc for printargs */ |
110 |
extern char **gargv; /* global argv for printargs */ |
111 |
|
112 |
/************************************************************************* |
113 |
* Frame rendering stuff (defined in ranimove1.c and ranimove2.c) |
114 |
*/ |
115 |
/* enumerated accuracy map values */ |
116 |
#define ANOVAL 0 /* unevaluated pixel */ |
117 |
#define ALOWQ 1 /* single low-quality sample */ |
118 |
#define AHIGHQ 2 /* single high-quality sample */ |
119 |
#define AMIN 3 /* start of error lookup table */ |
120 |
#define ADISTANT 255 /* ray went off to infinity */ |
121 |
|
122 |
extern double acctab[256]; /* accuracy value table */ |
123 |
|
124 |
extern int hres, vres; /* frame resolution (fcur) */ |
125 |
extern double pixaspect; /* pixel aspect ratio */ |
126 |
|
127 |
extern VIEW vw; /* view for this frame */ |
128 |
extern COLOR *cbuffer; /* color at each pixel */ |
129 |
extern float *zbuffer; /* depth at each pixel */ |
130 |
extern OBJECT *obuffer; /* object id at each pixel */ |
131 |
extern short *xmbuffer; /* x motion at each pixel */ |
132 |
extern short *ymbuffer; /* y motion at each pixel */ |
133 |
extern BYTE *abuffer; /* accuracy at each pixel */ |
134 |
extern BYTE *sbuffer; /* sample count per pixel */ |
135 |
|
136 |
extern VIEW vwprev; /* last frame's view */ |
137 |
extern COLOR *cprev; /* last frame colors */ |
138 |
extern float *zprev; /* last frame depth */ |
139 |
extern OBJECT *oprev; /* last frame objects */ |
140 |
extern BYTE *aprev; /* last frame accuracy */ |
141 |
|
142 |
extern float *cerrmap; /* conspicuous error map */ |
143 |
extern int cerrzero; /* is all of cerrmap zero? */ |
144 |
extern COLOR *val2map; /* value-squared map for variance */ |
145 |
|
146 |
extern double frm_stop; /* when to stop rendering this frame */ |
147 |
|
148 |
extern double hlsmax; /* maximum high-level saliency */ |
149 |
|
150 |
#define CSF_SMN (1./0.82) /* 1/avg_tracking_efficacy */ |
151 |
|
152 |
#define outbuffer cprev /* used to hold final output */ |
153 |
#define wbuffer zprev /* used for final filtering */ |
154 |
|
155 |
#define fndx(x,y) ((y)*hres + (x)) |
156 |
|
157 |
#define MO_UNK -32768 /* unknown motion value */ |
158 |
|
159 |
#define FOV_DEG 1.0 /* foveal radius (degrees) */ |
160 |
|
161 |
#define LOG_E1 (-0.0233) /* ln(0.977) */ |
162 |
#define errorf(i) exp(LOG_E1*((i)-AMIN)) |
163 |
#define errori(e) (int)(log(e)*(1./LOG_E1) + (AMIN+.5)) |
164 |
|
165 |
#define NSAMPOK 5 /* samples enough for error estimation */ |
166 |
|
167 |
#define NPINTERP 4 /* number of pixels to interpolate */ |
168 |
|
169 |
#define ATIDIFF 7 /* error difference for time extrapolation */ |
170 |
|
171 |
/* ranimove1.c */ |
172 |
extern void init_frame(void); |
173 |
extern void filter_frame(void); |
174 |
extern void send_frame(void); |
175 |
extern void free_frame(void); |
176 |
extern void write_map(float *mp, char *fn); |
177 |
extern void sample_pos(double hv[2], int x, int y, int sn); |
178 |
extern void comp_frame_error(void); |
179 |
extern int getclosest(int *iarr, int nc, int x, int y); |
180 |
extern int getambcolor(COLOR clr, int obj); |
181 |
extern double sample_wt(int xo, int yo); |
182 |
extern double estimaterr(COLOR cs, COLOR cs2, int ns, int ns0); |
183 |
extern double comperr(int *neigh, int nc, int ns0); |
184 |
|
185 |
/* ranimove2.c */ |
186 |
extern int refine_first(); |
187 |
extern void conspicuity(void); |
188 |
extern int refine_frame(int pass); |
189 |
|
190 |
/* ranimove.c */ |
191 |
extern double getTime(void); |
192 |
extern double obj_prio(OBJECT obj); |
193 |
extern int getmove(OBJECT obj); |
194 |
extern char * getoctspec(int n); |
195 |
extern double expspec_val(char *s); |
196 |
extern char *getexp(int n); /* XXX partly duplicated function */ |
197 |
extern VIEW *getview(int n); /* XXX duplicated function */ |
198 |
double getTime(); |
199 |
/* |
200 |
int countviews(); |
201 |
void setdefaults(), |
202 |
void setmove(), |
203 |
setrendparams(); |
204 |
getradfile(), |
205 |
animate(), |
206 |
*/ |
207 |
|
208 |
#ifdef __cplusplus |
209 |
} |
210 |
#endif |
211 |
#endif /* _RAD_RANIMOVE_H_ */ |
212 |
|