ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pinterp.c
(Generate patch)

Comparing ray/src/px/pinterp.c (file contents):
Revision 2.40 by schorsch, Fri Jan 2 12:47:01 2004 UTC vs.
Revision 2.41 by schorsch, Sun Mar 28 20:33:14 2004 UTC

# Line 68 | Line 68 | char   *progname;
68  
69   int     fillo = F_FORE|F_BACK;          /* selected fill options */
70   int     fillsamp = 0;                   /* sample separation (0 == inf) */
71 extern int      backfill(), rcalfill(); /* fill functions */
72 int     (*fillfunc)() = backfill;       /* selected fill function */
71   COLR    backcolr = BLKCOLR;             /* background color */
72   COLOR   backcolor = BLKCOLOR;           /* background color (float) */
73   double  backz = 0.0;                    /* background z value */
# Line 92 | Line 90 | unsigned short queue[PACKSIZ][2];      /* pending pixels */
90   int     packsiz;                        /* actual packet size */
91   int     queuesiz = 0;                   /* number of pixels pending */
92  
93 < extern double   movepixel();
93 > typedef void fillfunc_t(int x, int y);
94  
95   static gethfunc headline;
96 + static int nextview(FILE *fp);
97 + static void compavgview(void);
98 + static void addpicture(char *pfile, char *zspec);
99 + static int pixform(MAT4 xfmat, VIEW *vw1, VIEW *vw2);
100 + static void addscanline(struct bound *xl, int y,
101 +        COLR *pline, float *zline, struct position *lasty);
102 + static void addpixel(struct position *p0, struct position *p1,
103 +        struct position *p2, COLR pix, double w, double z);
104 + static double movepixel(FVECT pos);
105 + static int getperim(struct bound *xl, struct bound *yl, float *zline, int zfd);
106 + static void backpicture(fillfunc_t *fill, int samp);
107 + static void fillpicture(fillfunc_t *fill);
108 + static int clipaft(void);
109 + static int addblur(void);
110 + static void writepicture(void);
111 + static void writedistance(char *fname);
112 + static fillfunc_t backfill;
113 + static fillfunc_t rcalfill;
114 + static void calstart(char *prog, char *args);
115 + static void caldone(void);
116 + static void clearqueue(void);
117 + static void syserror(char *s);
118  
119 + fillfunc_t *fillfunc = backfill;        /* selected fill function */
120  
121 < main(argc, argv)                        /* interpolate pictures */
122 < int     argc;
123 < char    *argv[];
121 > int
122 > main(                   /* interpolate pictures */
123 >        int     argc,
124 >        char    *argv[]
125 > )
126   {
127   #define  check(ol,al)           if (argv[an][ol] || \
128                                  badarg(argc-an-1,argv+an+1,al)) \
# Line 361 | Line 384 | headline(                              /* process header string */
384   }
385  
386  
387 < nextview(fp)                            /* get and set next view */
388 < FILE    *fp;
387 > static int
388 > nextview(                               /* get and set next view */
389 >        FILE    *fp
390 > )
391   {
392          char    linebuf[256];
393          char    *err;
# Line 399 | Line 424 | FILE   *fp;
424   }
425  
426  
427 < compavgview()                           /* compute average view */
427 > static void
428 > compavgview(void)                               /* compute average view */
429   {
430          register int    i;
431          double  f;
# Line 424 | Line 450 | compavgview()                          /* compute average view */
450   }
451  
452  
453 < addpicture(pfile, zspec)                /* add picture to output */
454 < char    *pfile, *zspec;
453 > static void
454 > addpicture(             /* add picture to output */
455 >        char    *pfile,
456 >        char    *zspec
457 > )
458   {
459          FILE    *pfp;
460          int     zfd;
# Line 522 | Line 551 | char   *pfile, *zspec;
551   }
552  
553  
554 < pixform(xfmat, vw1, vw2)                /* compute view1 to view2 matrix */
555 < register MAT4   xfmat;
556 < register VIEW   *vw1, *vw2;
554 > static int
555 > pixform(                /* compute view1 to view2 matrix */
556 >        register MAT4   xfmat,
557 >        register VIEW   *vw1,
558 >        register VIEW   *vw2
559 > )
560   {
561          double  m4t[4][4];
562  
# Line 563 | Line 595 | register VIEW  *vw1, *vw2;
595   }
596  
597  
598 < addscanline(xl, y, pline, zline, lasty) /* add scanline to output */
599 < struct bound    *xl;
600 < int     y;
601 < COLR    *pline;
602 < float   *zline;
603 < struct position *lasty;         /* input/output */
598 > static void
599 > addscanline(    /* add scanline to output */
600 >        struct bound    *xl,
601 >        int     y,
602 >        COLR    *pline,
603 >        float   *zline,
604 >        struct position *lasty          /* input/output */
605 > )
606   {
607          FVECT   pos;
608          struct position lastx, newpos;
# Line 595 | Line 629 | struct position        *lasty;         /* input/output */
629   }
630  
631  
632 < addpixel(p0, p1, p2, pix, w, z)         /* fill in pixel parallelogram */
633 < struct position *p0, *p1, *p2;
634 < COLR    pix;
635 < double  w;
636 < double  z;
632 > static void
633 > addpixel(               /* fill in pixel parallelogram */
634 >        struct position *p0,
635 >        struct position *p1,
636 >        struct position *p2,
637 >        COLR    pix,
638 >        double  w,
639 >        double  z
640 > )
641   {
642          double  zt = 2.*zeps*p0->z;             /* threshold */
643          COLOR   pval;                           /* converted+weighted pixel */
# Line 672 | Line 710 | double z;
710   }
711  
712  
713 < double
714 < movepixel(pos)                          /* reposition image point */
715 < register FVECT  pos;
713 > static double
714 > movepixel(                              /* reposition image point */
715 >        register FVECT  pos
716 > )
717   {
718          FVECT   pt, tdir, odir;
719          double  d;
# Line 737 | Line 776 | register FVECT pos;
776   }
777  
778  
779 < getperim(xl, yl, zline, zfd)            /* compute overlapping image area */
780 < register struct bound   *xl;
781 < struct bound    *yl;
782 < float   *zline;
783 < int     zfd;
779 > static int
780 > getperim(               /* compute overlapping image area */
781 >        register struct bound   *xl,
782 >        struct bound    *yl,
783 >        float   *zline,
784 >        int     zfd
785 > )
786   {
787          int     step;
788          FVECT   pos;
# Line 821 | Line 862 | int    zfd;
862   }
863  
864  
865 < backpicture(fill, samp)                 /* background fill algorithm */
866 < int     (*fill)();
867 < int     samp;
865 > static void
866 > backpicture(                    /* background fill algorithm */
867 >        fillfunc_t *fill,
868 >        int     samp
869 > )
870   {
871          int     *yback, xback;
872          int     y;
# Line 929 | Line 972 | int    samp;
972   }
973  
974  
975 < fillpicture(fill)               /* paint in empty pixels using fill */
976 < int     (*fill)();
975 > static void
976 > fillpicture(            /* paint in empty pixels using fill */
977 >        fillfunc_t *fill
978 > )
979   {
980          register int    x, y;
981  
# Line 943 | Line 988 | int    (*fill)();
988   }
989  
990  
991 < clipaft()                       /* perform aft clipping as indicated */
991 > static int
992 > clipaft(void)                   /* perform aft clipping as indicated */
993   {
994          register int    x, y;
995          int     adjtest = (ourview.type == VT_PER) & zisnorm;
# Line 979 | Line 1025 | clipaft()                      /* perform aft clipping as indicated */
1025   }
1026  
1027  
1028 < addblur()                               /* add to blurred picture */
1028 > static int
1029 > addblur(void)                           /* add to blurred picture */
1030   {
1031          COLOR   cval;
1032          double  d;
# Line 1019 | Line 1066 | addblur()                              /* add to blurred picture */
1066   }
1067  
1068  
1069 < writepicture()                          /* write out picture (alters buffer) */
1069 > static void
1070 > writepicture(void)                              /* write out picture (alters buffer) */
1071   {
1072          int     y;
1073          register int    x;
# Line 1050 | Line 1098 | writepicture()                         /* write out picture (alters buffer)
1098   }
1099  
1100  
1101 < writedistance(fname)                    /* write out z file (alters buffer) */
1102 < char    *fname;
1101 > static void
1102 > writedistance(                  /* write out z file (alters buffer) */
1103 >        char    *fname
1104 > )
1105   {
1106          int     donorm = normdist & !zisnorm ? 1 :
1107                          (ourview.type == VT_PER) & !normdist & zisnorm ? -1 : 0;
# Line 1083 | Line 1133 | char   *fname;
1133   }
1134  
1135  
1136 < backfill(x, y)                          /* fill pixel with background */
1137 < int     x, y;
1136 > static void
1137 > backfill(                               /* fill pixel with background */
1138 >        int     x,
1139 >        int     y
1140 > )
1141   {
1142          if (averaging) {
1143                  copycolor(sscan(y)[x], backcolor);
# Line 1095 | Line 1148 | int    x, y;
1148   }
1149  
1150  
1151 < calstart(prog, args)                    /* start fill calculation */
1152 < char    *prog, *args;
1151 > static void
1152 > calstart(                    /* start fill calculation */
1153 >        char    *prog,
1154 >        char    *args
1155 > )
1156   {
1157          char    combuf[512];
1158          char    *argv[64];
# Line 1135 | Line 1191 | char   *prog, *args;
1191   }
1192  
1193  
1194 < caldone()                               /* done with calculation */
1194 > static void
1195 > caldone(void)                               /* done with calculation */
1196   {
1197          if (!PDesc.running)
1198                  return;
# Line 1144 | Line 1201 | caldone()                               /* done with c
1201   }
1202  
1203  
1204 < rcalfill(x, y)                          /* fill with ray-calculated pixel */
1205 < int     x, y;
1204 > static void
1205 > rcalfill(                               /* fill with ray-calculated pixel */
1206 >        int     x,
1207 >        int     y
1208 > )
1209   {
1210          if (queuesiz >= packsiz)        /* flush queue if needed */
1211                  clearqueue();
# Line 1156 | Line 1216 | int    x, y;
1216   }
1217  
1218  
1219 < clearqueue()                            /* process queue */
1219 > static void
1220 > clearqueue(void)                                /* process queue */
1221   {
1222          FVECT   orig, dir;
1223          float   fbuf[6*(PACKSIZ+1)];
# Line 1212 | Line 1273 | clearqueue()                           /* process queue */
1273   }
1274  
1275  
1276 < syserror(s)                     /* report error and exit */
1277 < char    *s;
1276 > static void
1277 > syserror(                       /* report error and exit */
1278 >        char    *s
1279 > )
1280   {
1281          perror(s);
1282          exit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines