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

Comparing ray/src/px/oki20c.c (file contents):
Revision 1.5 by greg, Fri Oct 20 13:53:58 1989 UTC vs.
Revision 1.6 by greg, Fri Oct 20 16:44:34 1989 UTC

# Line 45 | Line 45 | char  *fname;
45   {
46          FILE  *input;
47          int  xres, yres;
48 <        COLOR  scanline[NCOLS];
48 >        COLR  scanline[NCOLS];
49          int  i;
50  
51          if (fname == NULL) {
# Line 70 | Line 70 | char  *fname;
70          fputs("\0333\042", stdout);
71                                  /* put out scanlines */
72          for (i = yres-1; i >= 0; i--) {
73 <                if (freadscan(scanline, xres, input) < 0) {
73 >                if (freadcolrs(scanline, xres, input) < 0) {
74                          fprintf(stderr, "%s: read error (y=%d)\n", fname, i);
75                          return(-1);
76                  }
77 +                normscan(scanline, xres);
78                  plotscan(scanline, xres, i);
79          }
80                                  /* advance page */
# Line 85 | Line 86 | char  *fname;
86   }
87  
88  
89 + normscan(scan, len)                     /* normalize a scanline */
90 + register COLR  scan[];
91 + int  len;
92 + {
93 +        register int  i;
94 +
95 +        for (i = 0; i < len; i++)
96 +                colr_norm(scan[i], scan[i]);
97 + }
98 +
99 +
100   plotscan(scan, len, y)                  /* plot a scanline */
101 < COLOR  scan[];
101 > COLR  scan[];
102   int  len;
103   int  y;
104   {
# Line 125 | Line 137 | int  y;
137  
138  
139   colbit(col, x, s)               /* determine bit value for primary at x */
140 < COLOR  col;
140 > COLR  col;
141   register int  x;
142   int  s;
143   {
144 <        static float  cerr[NCOLS][3];
145 <        static double  err[3];
146 <        double  b;
144 >        static int  cerr[NCOLS][3];
145 >        static int  err[3];
146 >        int  b;
147          register int  a, ison;
148  
149          a = sub_add(s);                 /* use additive primary */
150 <        b = colval(col,a);
139 <        if (b > 1.0) b = 1.0;
150 >        b = col[a];
151          err[a] += b + cerr[x][a];
152 <        ison = err[a] < 0.5;
153 <        if (!ison) err[a] -= 1.0;
154 <        cerr[x][a] = err[a] *= 0.5;
152 >        ison = err[a] < 128;
153 >        if (!ison) err[a] -= 256;
154 >        cerr[x][a] = err[a] /= 2;
155          return(ison);
156   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines