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

Comparing ray/src/px/ra_pr.c (file contents):
Revision 1.11 by greg, Wed Aug 7 08:36:31 1991 UTC vs.
Revision 2.5 by greg, Sun Feb 27 10:17:12 1994 UTC

# Line 13 | Line 13 | static char SCCSid[] = "$SunId$ LBL";
13  
14   #include  <stdio.h>
15  
16 + #include  <math.h>
17 +
18   #include  "rasterfile.h"
19  
20   #include  "color.h"
21  
22 + #include  "resolu.h"
23 +
24   #include  "pic.h"
25  
26                          /* descriptor for a picture file or frame buffer */
# Line 37 | Line 41 | extern char    *ecalloc(), *emalloc();
41  
42   extern long  ftell();
43  
44 < extern double  atof(), pow();
44 > double  gamcor = 2.2;                   /* gamma correction */
45  
42 double  gamma = 2.0;                    /* gamma correction */
43
46   int  bradj = 0;                         /* brightness adjustment */
47  
48   pic     *inpic, *outpic;
# Line 75 | Line 77 | char  *argv[];
77                                  dither = !dither;
78                                  break;
79                          case 'g':
80 <                                gamma = atof(argv[++i]);
80 >                                gamcor = atof(argv[++i]);
81                                  break;
82                          case 'b':
83                                  greyscale = !greyscale;
# Line 120 | Line 122 | char  *argv[];
122                                  head.ras_depth != 8)
123                          quiterr("incompatible format");
124                                          /* put header */
125 +                newheader("RADIANCE", stdout);
126                  printargs(i, argv, stdout);
127                  fputformat(COLRFMT, stdout);
128                  putchar('\n');
129 <                fputresolu(YMAJOR|YDECR, xmax, ymax, stdout);
129 >                fprtresolu(xmax, ymax, stdout);
130                                          /* convert file */
131                  pr2ra(&head);
132          } else {
# Line 195 | Line 198 | register struct rasterfile  *h;
198                  return(NULL);
199                                          /* check header */
200          if (checkheader(p->fp, COLRFMT, NULL) < 0 ||
201 <                        fgetresolu(&xmax, &ymax, p->fp) != (YMAJOR|YDECR))
201 >                        fgetresolu(&xmax, &ymax, p->fp) < 0)
202                  quiterr("bad picture format");
203          p->nexty = 0;
204          p->bytes_line = 0;              /* variable length lines */
# Line 256 | Line 259 | struct rasterfile  *h;
259                                          /* convert table */
260          for (i = 0; i < h->ras_maplength/3; i++)
261                  setcolr(ctab[i],
262 <                                pow((cmap[0][i]+.5)/256.,gamma),
263 <                                pow((cmap[1][i]+.5)/256.,gamma),
264 <                                pow((cmap[2][i]+.5)/256.,gamma));
262 >                                pow((cmap[0][i]+.5)/256.,gamcor),
263 >                                pow((cmap[1][i]+.5)/256.,gamcor),
264 >                                pow((cmap[2][i]+.5)/256.,gamcor));
265          if (bradj)
266                  shiftcolrs(ctab, 256, bradj);
267                                          /* convert file */
# Line 359 | Line 362 | colormap  map;
362          register int  i, val;
363  
364          for (i = 0; i < 256; i++) {
365 <                val = pow((i+0.5)/256.0, 1.0/gamma) * 256.0;
365 >                val = pow((i+0.5)/256.0, 1.0/gamcor) * 256.0;
366                  map[0][i] = map[1][i] = map[2][i] = val;
367          }
368   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines