ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/ranimove.h
Revision: 3.1
Committed: Sat Feb 22 02:07:30 2003 UTC (21 years, 1 month ago) by greg
Content type: text/plain
Branch: MAIN
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# Content
1 /* RCSid: $Id$ */
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
20 /* ====================================================================
21 * The Radiance Software License, Version 1.0
22 *
23 * Copyright (c) 1990 - 2002 The Regents of the University of California,
24 * through Lawrence Berkeley National Laboratory. All rights reserved.
25 *
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted provided that the following conditions
28 * are met:
29 *
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 *
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in
35 * the documentation and/or other materials provided with the
36 * distribution.
37 *
38 * 3. The end-user documentation included with the redistribution,
39 * if any, must include the following acknowledgment:
40 * "This product includes Radiance software
41 * (http://radsite.lbl.gov/)
42 * developed by the Lawrence Berkeley National Laboratory
43 * (http://www.lbl.gov/)."
44 * Alternately, this acknowledgment may appear in the software itself,
45 * if and wherever such third-party acknowledgments normally appear.
46 *
47 * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
48 * and "The Regents of the University of California" must
49 * not be used to endorse or promote products derived from this
50 * software without prior written permission. For written
51 * permission, please contact [email protected].
52 *
53 * 5. Products derived from this software may not be called "Radiance",
54 * nor may "Radiance" appear in their name, without prior written
55 * permission of Lawrence Berkeley National Laboratory.
56 *
57 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
58 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
59 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
60 * DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
61 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
62 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
63 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
64 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
65 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
66 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
67 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE.
69 * ====================================================================
70 *
71 * This software consists of voluntary contributions made by many
72 * individuals on behalf of Lawrence Berkeley National Laboratory. For more
73 * information on Lawrence Berkeley National Laboratory, please see
74 * <http://www.lbl.gov/>.
75 */
76
77 #include "ray.h"
78 #include "view.h"
79 #include "vars.h"
80 /* input variables (alphabetical by name) */
81 #define BASENAME 0 /* output image base name */
82 #define END 1 /* number of animation frames */
83 #define EXPOSURE 2 /* how to compute exposure */
84 #define HIGHQ 3 /* high quality setting */
85 #define LOWQ 4 /* low quality setting */
86 #define MBLUR 5 /* motion blur parameter */
87 #define MOVE 6 /* object movement */
88 #define OCONV 7 /* oconv options */
89 #define OCTREEF 8 /* octree file name */
90 #define RATE 9 /* frame rate (fps) */
91 #define RESOLUTION 10 /* desired final resolution */
92 #define RIF 11 /* rad input file */
93 #define VIEWFILE 12 /* animation frame views */
94
95 #define NV_INIT 13 /* number of variables */
96
97 #define VV_INIT { \
98 {"BASENAME", 3, 0, NULL, onevalue}, \
99 {"END", 3, 0, NULL, intvalue}, \
100 {"EXPOSURE", 3, 0, NULL, onevalue}, \
101 {"highq", 2, 0, NULL, catvalues}, \
102 {"lowq", 2, 0, NULL, catvalues}, \
103 {"MBLUR", 2, 0, NULL, fltvalue}, \
104 {"move", 2, 0, NULL, NULL}, \
105 {"oconv", 2, 0, NULL, catvalues}, \
106 {"OCTREE", 3, 0, NULL, onevalue}, \
107 {"RATE", 2, 0, NULL, fltvalue}, \
108 {"RESOLUTION", 3, 0, NULL, onevalue}, \
109 {"RIF", 3, 0, NULL, onevalue}, \
110 {"VIEWFILE", 2, 0, NULL, onevalue} \
111 }
112
113 struct ObjMove {
114 int parent; /* parent object index */
115 char name[64]; /* object name */
116 char xf_file[128]; /* transform file name */
117 char spec[512]; /* object file or command */
118 char prio_file[128]; /* priority file name */
119 int cfm; /* current frame number */
120 char xfs[512]; /* part transform arguments */
121 MAT4 xfm; /* part transform matrix */
122 MAT4 cxfm; /* combined transform matrix */
123 MAT4 bxfm; /* transform to previous frame */
124 double prio; /* part priority */
125 double cprio; /* combined priority */
126 };
127
128 extern int silent; /* run silently? */
129
130 extern int quickstart; /* time initial frame as well? */
131
132 extern int nprocs; /* number of rendering processes */
133
134 extern int rtperfrm; /* seconds to spend per frame */
135
136 extern double ndthresh; /* noticeable difference threshold */
137 extern int ndtset; /* did user set ndthresh? */
138
139 extern int fbeg; /* starting frame */
140 extern int fend; /* ending frame */
141 extern int fcur; /* current frame being rendered */
142
143 extern char lorendoptf[]; /* LQ options file */
144 extern RAYPARAMS lorendparams; /* LQ rendering parameters */
145 extern char hirendoptf[]; /* HQ options file */
146 extern RAYPARAMS hirendparams; /* HQ rendering parameters */
147 extern RAYPARAMS *curparams; /* current parameter settings */
148 extern int twolevels; /* low and high quality differ */
149
150 extern double mblur; /* vflt(MBLUR) */
151 extern double rate; /* vflt(RATE) */
152
153 extern char objtmpf[]; /* object temporary file */
154
155 extern struct ObjMove *obj_move; /* object movements */
156
157 extern int haveprio; /* high-level saliency specified */
158
159 extern int gargc; /* global argc for printargs */
160 extern char **gargv; /* global argv for printargs */
161
162 VIEW *getview();
163 int countviews();
164 int getmove();
165 char *getexp(), *getoctspec(), *getobjname(), *getxf();
166 double expspec_val(), obj_prio();
167 void setdefaults(), setmove(), animate(), getradfile(), setrendparams();
168 void init_frame(), filter_frame(), send_frame(), free_frame();
169 int refine_frame();
170 double getTime();
171
172 /*************************************************************************
173 * Frame rendering stuff (defined in ranimove1.c and ranimove2.c)
174 */
175 /* enumerated accuracy map values */
176 #define ANOVAL 0 /* unevaluated pixel */
177 #define ALOWQ 1 /* single low-quality sample */
178 #define AHIGHQ 2 /* single high-quality sample */
179 #define AMIN 3 /* start of error lookup table */
180 #define ADISTANT 255 /* ray went off to infinity */
181
182 extern double acctab[256]; /* accuracy value table */
183
184 extern int hres, vres; /* frame resolution (fcur) */
185 extern double pixaspect; /* pixel aspect ratio */
186
187 extern VIEW vw; /* view for this frame */
188 extern COLOR *cbuffer; /* color at each pixel */
189 extern float *zbuffer; /* depth at each pixel */
190 extern OBJECT *obuffer; /* object id at each pixel */
191 extern short *xmbuffer; /* x motion at each pixel */
192 extern short *ymbuffer; /* y motion at each pixel */
193 extern BYTE *abuffer; /* accuracy at each pixel */
194 extern BYTE *sbuffer; /* sample count per pixel */
195
196 extern VIEW vwprev; /* last frame's view */
197 extern COLOR *cprev; /* last frame colors */
198 extern float *zprev; /* last frame depth */
199 extern OBJECT *oprev; /* last frame objects */
200 extern BYTE *aprev; /* last frame accuracy */
201
202 extern float *cerrmap; /* conspicuous error map */
203 extern int cerrzero; /* is all of cerrmap zero? */
204 extern COLOR *val2map; /* value-squared map for variance */
205
206 extern double frm_stop; /* when to stop rendering this frame */
207
208 extern double hlsmax; /* maximum high-level saliency */
209
210 #define CSF_SMN (1./0.82) /* 1/avg_tracking_efficacy */
211
212 #define outbuffer cprev /* used to hold final output */
213 #define wbuffer zprev /* used for final filtering */
214
215 #define fndx(x,y) ((y)*hres + (x))
216
217 #define MO_UNK -32768 /* unknown motion value */
218
219 #define FOV_DEG 1.0 /* foveal radius (degrees) */
220
221 #define LOG_E1 (-0.0233) /* ln(0.977) */
222 #define errorf(i) exp(LOG_E1*((i)-AMIN))
223 #define errori(e) (int)(log(e)*(1./LOG_E1) + (AMIN+.5))
224
225 #define NSAMPOK 5 /* samples enough for error estimation */
226
227 #define NPINTERP 4 /* number of pixels to interpolate */
228
229 #define ATIDIFF 7 /* error difference for time extrapolation */
230
231 void write_map(), sample_pos(), comp_frame_error(), conspicuity();
232 int getclosest(), getambcolor(), refine_first();
233 double sample_wt(), estimaterr(), comperr();