Back to index

radiance  4R0+20100331
ranimove.h
Go to the documentation of this file.
00001 /* RCSid $Id: ranimove.h,v 3.6 2004/03/26 21:36:20 schorsch Exp $ */
00002 /*
00003  *  ranimove.h
00004  *
00005  * Radiance object animation program
00006  *
00007  * The main difference between this program and ranimate is that
00008  * ranimove is optimized for object motion, and includes a complete
00009  * blur simulation.  We also have a number of clever schemes
00010  * for optimizing the computation, allowing rendering time
00011  * per frame and noticeable difference threshold to be specified.
00012  * Parallel rendering uses multiple processors on the local host,
00013  * and network rendering is not directly supported.  (However, no
00014  * one says you can't run ranimove on other machines at the
00015  * same time; just be careful not to overlap frames.)
00016  *
00017  * See the ranimove(1) man page for further details.
00018  */
00019 #ifndef _RAD_RANIMOVE_H_
00020 #define _RAD_RANIMOVE_H_
00021 
00022 #include "ray.h"
00023 #include "view.h"
00024 #include "vars.h"
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030                             /* input variables (alphabetical by name) */
00031 #define BASENAME     0             /* output image base name */
00032 #define END          1             /* number of animation frames */
00033 #define EXPOSURE     2             /* how to compute exposure */
00034 #define HIGHQ        3             /* high quality setting */
00035 #define LOWQ         4             /* low quality setting */
00036 #define MBLUR        5             /* motion blur parameter */
00037 #define MOVE         6             /* object movement */
00038 #define OCONV        7             /* oconv options */
00039 #define OCTREEF             8             /* octree file name */
00040 #define RATE         9             /* frame rate (fps) */
00041 #define RESOLUTION   10            /* desired final resolution */
00042 #define RIF          11            /* rad input file */
00043 #define VIEWFILE     12            /* animation frame views */
00044 
00045 #define NV_INIT             13            /* number of variables */
00046 
00047 #define VV_INIT { \
00048               {"BASENAME",  3,     0,     NULL,  onevalue}, \
00049               {"END",              3,     0,     NULL,  intvalue}, \
00050               {"EXPOSURE",  3,     0,     NULL,  onevalue}, \
00051               {"highq",     2,     0,     NULL,  catvalues}, \
00052               {"lowq",      2,     0,     NULL,  catvalues}, \
00053               {"MBLUR",     2,     0,     NULL,  fltvalue}, \
00054               {"move",      2,     0,     NULL,  NULL}, \
00055               {"oconv",     2,     0,     NULL,  catvalues}, \
00056               {"OCTREE",    3,     0,     NULL,  onevalue}, \
00057               {"RATE",      2,     0,     NULL,  fltvalue}, \
00058               {"RESOLUTION",       3,     0,     NULL,  onevalue}, \
00059               {"RIF",              3,     0,     NULL,  onevalue}, \
00060               {"VIEWFILE",  2,     0,     NULL,  onevalue} \
00061        }
00062 
00063 struct ObjMove {
00064        int           parent;              /* parent object index */
00065        char          name[64];     /* object name */
00066        char          xf_file[128]; /* transform file name */
00067        char          spec[512];    /* object file or command */
00068        char          prio_file[128];      /* priority file name */
00069        int           cfm;          /* current frame number */
00070        char          xfs[512];     /* part transform arguments */
00071        MAT4          xfm;          /* part transform matrix */
00072        MAT4          cxfm;         /* combined transform matrix */
00073        MAT4          bxfm;         /* transform to previous frame */
00074        double        prio;         /* part priority */
00075        double        cprio;        /* combined priority */
00076 };
00077 
00078 extern int           silent;              /* run silently? */
00079 
00080 extern int           quickstart;   /* time initial frame as well? */
00081 
00082 extern int           nprocs;              /* number of rendering processes */
00083 
00084 extern int           rtperfrm;     /* seconds to spend per frame */
00085 
00086 extern double        ndthresh;     /* noticeable difference threshold */
00087 extern int           ndtset;              /* did user set ndthresh? */
00088 
00089 extern int           fbeg;         /* starting frame */
00090 extern int           fend;         /* ending frame */
00091 extern int           fcur;         /* current frame being rendered */
00092 
00093 extern char          lorendoptf[]; /* LQ options file */
00094 extern RAYPARAMS     lorendparams; /* LQ rendering parameters */
00095 extern char          hirendoptf[]; /* HQ options file */
00096 extern RAYPARAMS     hirendparams; /* HQ rendering parameters */
00097 extern RAYPARAMS     *curparams;   /* current parameter settings */
00098 extern int           twolevels;    /* low and high quality differ */
00099 
00100 extern double mblur;               /* vflt(MBLUR) */
00101 extern double rate;                /* vflt(RATE) */
00102 
00103 extern char          objtmpf[];    /* object temporary file */
00104 
00105 extern struct ObjMove       *obj_move;    /* object movements */
00106 
00107 extern int           haveprio;     /* high-level saliency specified */
00108 
00109 extern int           gargc;        /* global argc for printargs */
00110 extern char          **gargv;      /* global argv for printargs */
00111 
00112 /*************************************************************************
00113  * Frame rendering stuff (defined in ranimove1.c and ranimove2.c)
00114  */
00115                      /* enumerated accuracy map values */
00116 #define ANOVAL              0      /* unevaluated pixel */
00117 #define ALOWQ        1      /* single low-quality sample */
00118 #define AHIGHQ              2      /* single high-quality sample */
00119 #define AMIN         3      /* start of error lookup table */
00120 #define ADISTANT     255    /* ray went off to infinity */
00121 
00122 extern double acctab[256];  /* accuracy value table */
00123 
00124 extern int    hres, vres;   /* frame resolution (fcur) */
00125 extern double pixaspect;    /* pixel aspect ratio */
00126 
00127 extern VIEW   vw;           /* view for this frame */
00128 extern COLOR  *cbuffer;     /* color at each pixel */
00129 extern float  *zbuffer;     /* depth at each pixel */
00130 extern OBJECT *obuffer;     /* object id at each pixel */
00131 extern short  *xmbuffer;    /* x motion at each pixel */
00132 extern short  *ymbuffer;    /* y motion at each pixel */
00133 extern BYTE   *abuffer;     /* accuracy at each pixel */
00134 extern BYTE   *sbuffer;     /* sample count per pixel */
00135 
00136 extern VIEW   vwprev;              /* last frame's view */
00137 extern COLOR  *cprev;              /* last frame colors */
00138 extern float  *zprev;              /* last frame depth */
00139 extern OBJECT *oprev;              /* last frame objects */
00140 extern BYTE   *aprev;              /* last frame accuracy */
00141 
00142 extern float  *cerrmap;     /* conspicuous error map */
00143 extern int    cerrzero;     /* is all of cerrmap zero? */
00144 extern COLOR  *val2map;     /* value-squared map for variance */
00145 
00146 extern double frm_stop;     /* when to stop rendering this frame */
00147 
00148 extern double hlsmax;              /* maximum high-level saliency */
00149 
00150 #define CSF_SMN             (1./0.82)     /* 1/avg_tracking_efficacy */
00151 
00152 #define outbuffer    cprev  /* used to hold final output */
00153 #define wbuffer             zprev  /* used for final filtering */
00154 
00155 #define fndx(x,y)    ((y)*hres + (x))
00156 
00157 #define MO_UNK              -32768 /* unknown motion value */
00158 
00159 #define FOV_DEG             1.0    /* foveal radius (degrees) */
00160 
00161 #define LOG_E1              (-0.0233)     /* ln(0.977) */
00162 #define errorf(i)    exp(LOG_E1*((i)-AMIN))
00163 #define errori(e)    (int)(log(e)*(1./LOG_E1) + (AMIN+.5))
00164 
00165 #define NSAMPOK             5      /* samples enough for error estimation */
00166 
00167 #define NPINTERP     4      /* number of pixels to interpolate */
00168 
00169 #define ATIDIFF             7      /* error difference for time extrapolation */
00170 
00171        /* ranimove1.c */
00172 extern void   init_frame(void);
00173 extern void filter_frame(void);
00174 extern void send_frame(void);
00175 extern void free_frame(void);
00176 extern void write_map(float *mp, char     *fn);
00177 extern void sample_pos(double      hv[2], int    x, int y, int sn);
00178 extern void comp_frame_error(void);
00179 extern int    getclosest(int       *iarr, int    nc, int       x, int y);
00180 extern int getambcolor(COLOR       clr, int      obj);
00181 extern double sample_wt(int xo, int yo);
00182 extern double estimaterr(COLOR     cs, COLOR     cs2, int      ns, int ns0);
00183 extern double comperr(int   *neigh, int   nc, int       ns0); 
00184 
00185        /* ranimove2.c */
00186 extern int refine_first();
00187 extern void conspicuity(void);
00188 extern int refine_frame(int pass);
00189 
00190        /* ranimove.c */
00191 extern double getTime(void);
00192 extern double obj_prio(OBJECT      obj);
00193 extern int getmove(OBJECT   obj);
00194 extern char * getoctspec(int n);
00195 extern double expspec_val(char *s);
00196 extern char *getexp(int n); /* XXX partly duplicated function */
00197 extern VIEW *getview(int n); /* XXX duplicated function */
00198 double getTime();
00199 /*
00200 int    countviews();
00201 void   setdefaults(),
00202 void setmove(),
00203 setrendparams();
00204 getradfile(),
00205 animate(),
00206 */
00207 
00208 #ifdef __cplusplus
00209 }
00210 #endif
00211 #endif /* _RAD_RANIMOVE_H_ */
00212