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

Comparing ray/src/px/mt160r.c (file contents):
Revision 1.4 by greg, Fri Oct 20 20:35:59 1989 UTC vs.
Revision 1.8 by greg, Mon May 6 13:14:21 1991 UTC

# Line 39 | Line 39 | char  *fname;
39          FILE  *input;
40          int  xres, yres;
41          COLR  scanline[NCOLS];
42        char  sbuf[256];
42          int  i;
43  
44          if (fname == NULL) {
# Line 50 | Line 49 | char  *fname;
49                  return(-1);
50          }
51                                  /* discard header */
52 <        while (fgets(sbuf, sizeof(sbuf), input) != NULL && sbuf[0] != '\n')
53 <                ;
52 >        if (checkheader(input, COLRFMT, NULL) < 0) {
53 >                fprintf(stderr, "%s: not a Radiance picture\n", fname);
54 >                return(-1);
55 >        }
56                                  /* get picture dimensions */
57          if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) {
58                  fprintf(stderr, "%s: bad picture size\n", fname);
# Line 69 | Line 70 | char  *fname;
70                          fprintf(stderr, "%s: read error (y=%d)\n", fname, i);
71                          return(-1);
72                  }
73 <                normcolrs(scanline, xres);
73 >                normcolrs(scanline, xres, 0);
74                  plotscan(scanline, xres, i);
75          }
76  
# Line 117 | Line 118 | COLR  clr;
118   register int  x;
119   {
120          static int  cerr[NCOLS];
121 <        static int  err;
121 >        static int  err, errp;
122          int  b;
123          register int  isblack;
124  
125          b = normbright(clr);
126 +        errp = err;
127          err += b + cerr[x];
128          isblack = err < 128;
129          if (!isblack) err -= 256;
130 <        cerr[x] = err /= 2;
130 >        err /= 3;
131 >        cerr[x] = err + errp;
132          return(isblack);
133   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines