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.2 by greg, Fri Oct 5 02:07:10 2012 UTC vs.
Revision 2.5 by greg, Sat Oct 13 05:18:18 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 200 | Line 207 | neigh_zmin(const float *zb, int n)
207   }
208  
209  
210 < /* Fill in missing pixels from immediate neighbors */
210 > /* Expand foreground pixels to mitigate aliasing/fill errors */
211   static void
212   fill_missing(void)
213   {
214          int     n, m;
215  
216          for (n = imres.xr*imres.yr; n--; )
217 <                if (zbuf[n] >= .9*FHUGE &&
211 <                                zbuf[m = neigh_zmin(zbuf,n)] < .9*FHUGE)
217 >                if (zbuf[n] > 1.25*zbuf[m = neigh_zmin(zbuf,n)])
218                          copycolor(imbuf[n], imbuf[m]);
219   }
220  
# Line 258 | Line 264 | addframe(double fpos)
264                  error(USER, err);
265          if (!fgetsresolu(&rs, fpimg))
266                  goto readerr;
267 +        if (rs.rt != PIXSTANDARD) {
268 +                sprintf(errmsg, "unsupported orientation in picture \"%s\"", fname);
269 +                error(USER, errmsg);
270 +        }
271          if ((rs.xr != imres.xr) | (rs.yr != imres.yr)) {
272                  sprintf(errmsg, "resolution mismatch for picture \"%s\"", fname);
273                  error(USER, errmsg);
# Line 311 | Line 321 | addframe(double fpos)
321                          scalecolor(cval, sf);
322                          interp_pixel(cval, &fvw, h, n, zscan[h], fpos,
323                                          h + (int)mscan[3*h] - 32768,
324 <                                        n - (int)mscan[3*h+1] + 32768);
324 >                                        n - (int)mscan[3*h+1] + 32768,
325 >                                        mscan[3*h+2]);
326                  }
327          }
328                                          /* fill in missing pixels */
# Line 387 | Line 398 | main(int argc, char *argv[])
398                                  /* get frame range & sampling */
399          switch (sscanf(argv[1], "%lf,%lf/%d", &fstart, &fend, &nsamps)) {
400          case 1:
390                nsamps = 0;
401                  fend = fstart;
402 +                nsamps = 0;
403                  break;
404          case 2:
405                  nsamps = 0;
# Line 396 | Line 407 | main(int argc, char *argv[])
407          case 3:
408                  if (fend < fstart)
409                          goto userr;
410 +                if (fend <= fstart+FTINY)
411 +                        nsamps = 0;
412                  break;
413          default:
414                  goto userr;
# Line 426 | Line 439 | main(int argc, char *argv[])
439          write_average(stdout);
440          return(fflush(stdout) == EOF);
441   userr:
442 <        fprintf(stderr, "Usage: %s f0,f1 HDRspec ZBUFspec MVOspec\n", progname);
442 >        fprintf(stderr, "Usage: %s f0,f1[/n] HDRspec ZBUFspec MVOspec\n", progname);
443          return(1);
444   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines