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

Comparing ray/src/px/pfilt.c (file contents):
Revision 2.14 by greg, Wed May 31 08:50:27 1995 UTC vs.
Revision 2.17 by greg, Mon Apr 1 17:24:44 1996 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1992 Regents of the University of California */
1 > /* Copyright (c) 1996 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 17 | Line 17 | static char SCCSid[] = "$SunId$ LBL";
17  
18   #include  "color.h"
19  
20 + #include  "view.h"
21 +
22   #include  "resolu.h"
23  
24   #include  "paths.h"
# Line 64 | Line 66 | int  correctaspect = 0;                /* aspect ratio correction? *
66  
67   int  wrongformat = 0;
68  
69 + VIEW  ourview = STDVIEW;
70 + int  gotview = 0;
71 + int  wrapfilt = 0;              /* wrap filter horizontally? */
72 +
73   int  xrad;                      /* x search radius */
74   int  yrad;                      /* y search radius */
75   int  xbrad;                     /* x box size */
# Line 267 | Line 273 | char  **argv;
273          }
274          if (!(order & YMAJOR))
275                  inpaspect = 1.0/inpaspect;
276 +                                        /* wrap around for cylindrical view? */
277 +        wrapfilt = gotview && ourview.type == VT_CYL &&
278 +                        ourview.horiz >= 360.-FTINY && order & YMAJOR;
279                                          /* compute output resolution */
280          if (ncols <= 0)
281                  ncols = x_c*xres + .5;
# Line 302 | Line 311 | char  **argv;
311   }
312  
313  
314 + double
315 + rgb_bright(clr)
316 + COLOR  clr;
317 + {
318 +        return(bright(clr));
319 + }
320 +
321 +
322 + double
323 + xyz_bright(clr)
324 + COLOR  clr;
325 + {
326 +        return(clr[CIEY]);
327 + }
328 +
329 +
330 + double  (*ourbright)() = rgb_bright;
331 +
332 +
333   headline(s)                             /* process line from header */
334   char  *s;
335   {
# Line 310 | Line 338 | char  *s;
338          fputs(s, stdout);               /* copy to output */
339          if (isaspect(s))                /* get aspect ratio */
340                  inpaspect *= aspectval(s);
341 <        else if (isexpos(s))
341 >        else if (isexpos(s))            /* get exposure */
342                  hotlvl *= exposval(s);
343 <        else if (isformat(s)) {
344 <                formatval(fmt, s);
345 <                wrongformat = strcmp(fmt, COLRFMT);
346 <        }
343 >        else if (formatval(fmt, s)) {   /* get format */
344 >                wrongformat = 0;
345 >                if (!strcmp(COLRFMT, fmt))
346 >                        ourbright = rgb_bright;
347 >                else if (!strcmp(CIEFMT, fmt))
348 >                        ourbright = xyz_bright;
349 >                else
350 >                        wrongformat = !globmatch(PICFMT, fmt);
351 >        } else if (isview(s) && sscanview(&ourview, s) > 0)
352 >                gotview++;
353   }
354  
355  
# Line 430 | Line 464 | scan2init()                    /* prepare scanline arrays */
464                          rad *= (y_r + x_c)/2.0;
465  
466                  if (thresh > FTINY) {
433                        xrad = CHECKRAD*THRESHRAD*rad/x_c + xbrad;
434                        yrad = CHECKRAD*THRESHRAD*rad/y_r + ybrad;
467                          orad = CHECKRAD*THRESHRAD*rad + 1;
468 +                        xrad = orad/x_c + xbrad;
469 +                        yrad = orad/y_r + ybrad;
470                          obarsize = 2*orad + 1;
471                  } else {
472                          xrad = CHECKRAD*rad/x_c + 1;
# Line 475 | Line 509 | scan2init()                    /* prepare scanline arrays */
509                          fputaspect(d, stdout);
510          }
511                                          /* record exposure */
512 <        d = bright(exposure);
512 >        d = (*ourbright)(exposure);
513          if (!FEQ(d,1.0))
514                  fputexpos(d, stdout);
515                                          /* record color correction */
# Line 502 | Line 536 | int  r;
536          int  ybot;
537          register int  c;
538                                          /* average input scanlines */
539 <        while (nextrow < r+orad && nextrow < nrows) {
539 >        while (nextrow <= r+orad && nextrow < nrows) {
540                  ybot = (long)nextrow*yres/nrows;
541                  for (c = 0; c < ncols; c++) {
542                          dobox(ctmp, (int)((long)c*xres/ncols),ybot, c,nextrow);
543 <                        greybar[nextrow%obarsize][c] = bright(ctmp);
543 >                        greybar[nextrow%obarsize][c] = (*ourbright)(ctmp);
544                  }
545                                          /* and zero output scanline */
546                  bzero((char *)scoutbar[nextrow%obarsize], ncols*sizeof(COLOR));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines