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

Comparing ray/src/px/aedimage.c (file contents):
Revision 1.3 by greg, Tue Sep 12 13:04:16 1989 UTC vs.
Revision 1.5 by greg, Fri Oct 20 20:35:57 1989 UTC

# Line 105 | Line 105 | main(argc, argv)
105   int  argc;
106   char  *argv[];
107   {
108 <        int  onintr();
109 <        double  atof();
108 >        int  onintr(), checkhead();
109          char  sbuf[256];
110          register int  i;
111          
# Line 141 | Line 140 | char  *argv[];
140                  quitmsg(errmsg);
141          }
142                                  /* get header */
143 <        while (fgets(sbuf, sizeof(sbuf), fin) != NULL && sbuf[0] != '\n')
145 <                if (!strncmp(sbuf, "EXPOSURE=", 9))
146 <                        exposure *= atof(sbuf+9);
147 <
143 >        getheader(fin, checkhead);
144                                  /* get picture dimensions */
145          if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR))
146                  quitmsg("bad picture size");
# Line 170 | Line 166 | userr:
166   }
167  
168  
169 + checkhead(line)                         /* deal with line from header */
170 + char  *line;
171 + {
172 +        if (!strncmp(line, "EXPOSURE=", 9))
173 +                exposure *= atof(line+9);
174 + }
175 +
176 +
177   init()                  /* initialize terminal */
178   {
179          struct sgttyb  flags;
# Line 392 | Line 396 | picreadline3(y, l3)                    /* read in 3-byte scanline */
396   int  y;
397   register rgbpixel  *l3;
398   {
399 <        register BYTE   *l4;
400 <        register int    shift, c;
397 <        int     i;
398 <
399 >        register int    i;
400 >                                                        /* read scanline */
401          getscan(y);
402                                                          /* convert scanline */
403 <        for (l4=scanline[0], i=xmax; i--; l4+=4, l3++) {
404 <                shift = l4[EXP] - COLXS;
405 <                if (shift >= 8) {
406 <                        l3->r = l3->g = l3->b = 255;
407 <                } else if (shift <= -8) {
406 <                        l3->r = l3->g = l3->b = 0;
407 <                } else if (shift > 0) {
408 <                        c = l4[RED] << shift;
409 <                        l3->r = c > 255 ? 255 : c;
410 <                        c = l4[GRN] << shift;
411 <                        l3->g = c > 255 ? 255 : c;
412 <                        c = l4[BLU] << shift;
413 <                        l3->b = c > 255 ? 255 : c;
414 <                } else if (shift < 0) {
415 <                        l3->r = l4[RED] >> -shift;
416 <                        l3->g = l4[GRN] >> -shift;
417 <                        l3->b = l4[BLU] >> -shift;
418 <                } else {
419 <                        l3->r = l4[RED];
420 <                        l3->g = l4[GRN];
421 <                        l3->b = l4[BLU];
422 <                }
403 >        normcolrs(scanline, xmax);
404 >        for (i = 0; i < xmax; i++) {
405 >                l3[i].r = scanline[i][RED];
406 >                l3[i].g = scanline[i][GRN];
407 >                l3[i].b = scanline[i][BLU];
408          }
409   }
410  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines