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

Comparing ray/src/px/pmblur2.c (file contents):
Revision 2.1 by greg, Fri Oct 5 00:59:38 2012 UTC vs.
Revision 2.4 by greg, Fri Oct 5 18:54:40 2012 UTC

# Line 111 | Line 111 | loadprev(int fno)
111          exprev = ih.ev;
112          if (!fgetsresolu(&rs, fp))
113                  goto readerr;
114 +        if (rs.rt != PIXSTANDARD) {
115 +                sprintf(errmsg, "unsupported orientation in picture \"%s\"", fname);
116 +                error(USER, errmsg);
117 +        }
118          if (!imres.xr) {                /* allocate buffers */
119                  imres = rs;
120                  imsum = (COLOR *)ecalloc(imres.xr*imres.yr, sizeof(COLOR));
# Line 146 | Line 150 | readerr:
150   /* Interpolate between two image pixels */
151   /* XXX skipping expensive ray vector calculations for now */
152   static void
153 < interp_pixel(COLOR con, const VIEW *vwn, int xn, int yn, double zn,
154 <                        double pos, int xp, int yp)
153 > interp_pixel(COLOR con, const VIEW *vwn, int xn, int yn, double zval,
154 >                        double pos, int xp, int yp, int interpOK)
155   {
156          const int       hres = scanlen(&imres);
157          RREAL           ipos;
158          FVECT           wprev, wcoor, rdir;
159          int             np, xd, yd, nd;
160          COLOR           cpr;
161 <        double          sf, zval;
161 >        double          sf;
162                                          /* check if off image */
163          if ((xp < 0) | (xp >= hres))
164                  return;
# Line 164 | Line 168 | interp_pixel(COLOR con, const VIEW *vwn, int xn, int y
168          xd = (1.-pos)*xp + pos*xn + .5;
169          yd = (1.-pos)*yp + pos*yn + .5;
170          nd = yd*hres + xd;
171 <                                        /* check interpolated depth */
172 <        zval = (1.-pos)*zprev[np] + pos*zn;
171 >                                        /* check depth */
172 >        if (interpOK)
173 >                zval = (1.-pos)*zprev[np] + pos*zval;
174          if (zval >= zbuf[nd])
175                  return;
176 <        copycolor(imbuf[nd], con);      /* assign interpolated color */
176 >        zbuf[nd] = zval;                /* assign new depth */
177 >        copycolor(imbuf[nd], con);      /* assign new color */
178 >        if (!interpOK)
179 >                return;
180          scalecolor(imbuf[nd], pos);
181          sf = (1.-pos)/exprev;
182          colr_color(cpr, imprev[np]);
183          scalecolor(cpr, sf);
184          addcolor(imbuf[nd], cpr);
177        zbuf[nd] = zval;                /* assign new depth */
185   }
186  
187  
# Line 258 | Line 265 | addframe(double fpos)
265                  error(USER, err);
266          if (!fgetsresolu(&rs, fpimg))
267                  goto readerr;
268 +        if (rs.rt != PIXSTANDARD) {
269 +                sprintf(errmsg, "unsupported orientation in picture \"%s\"", fname);
270 +                error(USER, errmsg);
271 +        }
272          if ((rs.xr != imres.xr) | (rs.yr != imres.yr)) {
273                  sprintf(errmsg, "resolution mismatch for picture \"%s\"", fname);
274                  error(USER, errmsg);
# Line 311 | Line 322 | addframe(double fpos)
322                          scalecolor(cval, sf);
323                          interp_pixel(cval, &fvw, h, n, zscan[h], fpos,
324                                          h + (int)mscan[3*h] - 32768,
325 <                                        n - (int)mscan[3*h+1] + 32768);
325 >                                        n - (int)mscan[3*h+1] + 32768,
326 >                                        mscan[3*h+2]);
327                  }
328          }
329                                          /* fill in missing pixels */
# Line 384 | Line 396 | main(int argc, char *argv[])
396          SET_DEFAULT_BINARY();
397          if (argc != 5)
398                  goto userr;
399 <                                /* get frame range */
400 <        switch (sscanf(argv[1], "%lf,%lf", &fstart, &fend)) {
399 >                                /* get frame range & sampling */
400 >        switch (sscanf(argv[1], "%lf,%lf/%d", &fstart, &fend, &nsamps)) {
401          case 1:
402                  fend = fstart;
403 +                nsamps = 0;
404                  break;
405          case 2:
406 +                nsamps = 0;
407 +                /* fall through */
408 +        case 3:
409                  if (fend < fstart)
410                          goto userr;
411 +                if (fend <= fstart+FTINY)
412 +                        nsamps = 0;
413                  break;
414          default:
415                  goto userr;
416          }
417          if (fstart < 1)
418                  goto userr;
419 <        hdrspec = argv[2];
420 <        zbfspec = argv[3];
403 <        mvospec = argv[4];
404 <        nsamps = (fend - fstart)*12.;
419 >        if (nsamps <= 0)
420 >                nsamps = (fend - fstart)*17.;
421          if (nsamps) {
422 +                if (nsamps > 100) nsamps = 100;
423                  fstep = (fend - fstart)/nsamps;
424          } else {
425                  fstep = 1.;
426                  fstart -= .5;
427                  nsamps = 1;
428          }
429 +        hdrspec = argv[2];
430 +        zbfspec = argv[3];
431 +        mvospec = argv[4];
432                                  /* load and filter each subframe */
433          for (fcur = fstart + .5*fstep; fcur <= fend; fcur += fstep)
434                  addframe(fcur);
# Line 420 | Line 440 | main(int argc, char *argv[])
440          write_average(stdout);
441          return(fflush(stdout) == EOF);
442   userr:
443 <        fprintf(stderr, "Usage: %s f0,f1 HDRspec ZBUFspec MVOspec\n", progname);
443 >        fprintf(stderr, "Usage: %s f0,f1[/n] HDRspec ZBUFspec MVOspec\n", progname);
444          return(1);
445   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines