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