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

Comparing ray/src/px/ra_avs.c (file contents):
Revision 2.3 by greg, Fri Jun 4 14:45:59 1993 UTC vs.
Revision 2.9 by greg, Sat Feb 22 02:07:27 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1993 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   *  Convert Radiance file to/from AVS file.
6   */
# Line 13 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10   #ifdef MSDOS
11   #include  <fcntl.h>
12   #endif
13 + #include  <time.h>
14   #include  "color.h"
15   #include  "resolu.h"
16  
17 < extern char  *malloc();
17 > double  gamcor = 2.2;                   /* gamma correction */
18  
21 double  gamma = 2.2;                    /* gamma correction */
22
19   int  bradj = 0;                         /* brightness adjustment */
20  
21   char  *progname;
# Line 41 | Line 37 | char  *argv[];
37                  if (argv[i][0] == '-')
38                          switch (argv[i][1]) {
39                          case 'g':               /* gamma correction */
40 <                                gamma = atof(argv[++i]);
40 >                                gamcor = atof(argv[++i]);
41                                  break;
42                          case 'e':               /* exposure adjustment */
43                                  if (argv[i+1][0] != '+' && argv[i+1][0] != '-')
# Line 65 | Line 61 | char  *argv[];
61                  exit(1);
62          }
63          if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) {
64 <                fprintf(stderr, "can't open output \"%s\"\n",
64 >                fprintf(stderr, "%s: can't open output \"%s\"\n",
65                                  progname, argv[i+1]);
66                  exit(1);
67          }
# Line 73 | Line 69 | char  *argv[];
69          setmode(fileno(stdin), O_BINARY);
70          setmode(fileno(stdout), O_BINARY);
71   #endif
72 <        setcolrgam(gamma);              /* set up gamma correction */
72 >        setcolrgam(gamcor);             /* set up gamma correction */
73          if (reverse) {
74                                          /* get their image resolution */
75                  xmax = getint(4, stdin);
76                  ymax = getint(4, stdin);
77 +                if (feof(stdin))
78 +                        quiterr("empty input file");
79                                          /* put our header */
80 +                newheader("RADIANCE", stdout);
81                  printargs(i, argv, stdout);
82                  fputformat(COLRFMT, stdout);
83                  putchar('\n');
# Line 127 | Line 126 | avs2ra()               /* convert 24-bit scanlines to Radiance pict
126                  quiterr("out of memory in avs2ra");
127                                                  /* convert image */
128          for (y = ymax-1; y >= 0; y--) {
129 <                (void)getc(stdin);                      /* toss alpha */
130 <                scanout[x][RED] = getc(stdin);
131 <                scanout[x][GRN] = getc(stdin);
132 <                scanout[x][BLU] = getc(stdin);
133 <                if (feof(stdin) || ferror(stdin))
129 >                for (x = 0; x < xmax; x++) {
130 >                        (void)getc(stdin);                      /* toss alpha */
131 >                        scanout[x][RED] = getc(stdin);
132 >                        scanout[x][GRN] = getc(stdin);
133 >                        scanout[x][BLU] = getc(stdin);
134 >                }
135 >                if (feof(stdin) | ferror(stdin))
136                          quiterr("error reading AVS image");
137                                                  /* undo gamma */
138                  gambs_colrs(scanout, xmax);
# Line 141 | Line 142 | avs2ra()               /* convert 24-bit scanlines to Radiance pict
142                          quiterr("error writing Radiance picture");
143          }
144                                                  /* free scanline */
145 <        free((char *)scanout);
145 >        free((void *)scanout);
146   }
147  
148  
# Line 171 | Line 172 | ra2avs()               /* convert Radiance scanlines to 24-bit */
172                          quiterr("error writing AVS file");
173          }
174                                                  /* free scanline */
175 <        free((char *)scanin);
175 >        free((void *)scanin);
176   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines