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 2.1 by greg, Tue Nov 12 16:05:09 1991 UTC vs.
Revision 2.6 by greg, Sat Feb 22 02:07:28 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  ra_pr.c - program to convert between RADIANCE and pixrect picture format.
6   *
# Line 13 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include  <stdio.h>
12  
13 + #include  <math.h>
14 +
15 + #include  <time.h>
16 +
17   #include  "rasterfile.h"
18  
19   #include  "color.h"
# Line 39 | Line 40 | extern char    *ecalloc(), *emalloc();
40  
41   extern long  ftell();
42  
43 < extern double  atof(), pow();
43 > double  gamcor = 2.2;                   /* gamma correction */
44  
44 double  gamma = 2.2;                    /* gamma correction */
45
45   int  bradj = 0;                         /* brightness adjustment */
46  
47   pic     *inpic, *outpic;
# Line 77 | Line 76 | char  *argv[];
76                                  dither = !dither;
77                                  break;
78                          case 'g':
79 <                                gamma = atof(argv[++i]);
79 >                                gamcor = atof(argv[++i]);
80                                  break;
81                          case 'b':
82                                  greyscale = !greyscale;
# Line 122 | Line 121 | char  *argv[];
121                                  head.ras_depth != 8)
122                          quiterr("incompatible format");
123                                          /* put header */
124 +                newheader("RADIANCE", stdout);
125                  printargs(i, argv, stdout);
126                  fputformat(COLRFMT, stdout);
127                  putchar('\n');
# Line 168 | Line 168 | char  *err;
168   }
169  
170  
171 + void
172   eputs(s)
173   char *s;
174   {
# Line 175 | Line 176 | char *s;
176   }
177  
178  
179 + void
180   quit(code)
181   int code;
182   {
# Line 258 | Line 260 | struct rasterfile  *h;
260                                          /* convert table */
261          for (i = 0; i < h->ras_maplength/3; i++)
262                  setcolr(ctab[i],
263 <                                pow((cmap[0][i]+.5)/256.,gamma),
264 <                                pow((cmap[1][i]+.5)/256.,gamma),
265 <                                pow((cmap[2][i]+.5)/256.,gamma));
263 >                                pow((cmap[0][i]+.5)/256.,gamcor),
264 >                                pow((cmap[1][i]+.5)/256.,gamcor),
265 >                                pow((cmap[2][i]+.5)/256.,gamcor));
266          if (bradj)
267                  shiftcolrs(ctab, 256, bradj);
268                                          /* convert file */
# Line 275 | Line 277 | struct rasterfile  *h;
277                  if (fwritecolrs(scanline, xmax, stdout) < 0)
278                          quiterr("error writing RADIANCE file");
279          }
280 <        free((char *)scanline);
280 >        free((void *)scanline);
281   }
282  
283  
# Line 361 | Line 363 | colormap  map;
363          register int  i, val;
364  
365          for (i = 0; i < 256; i++) {
366 <                val = pow((i+0.5)/256.0, 1.0/gamma) * 256.0;
366 >                val = pow((i+0.5)/256.0, 1.0/gamcor) * 256.0;
367                  map[0][i] = map[1][i] = map[2][i] = val;
368          }
369   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines