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 |
|
*/ |
7 |
|
|
8 |
|
#include <stdio.h> |
9 |
|
#include <math.h> |
10 |
< |
#ifdef MSDOS |
11 |
< |
#include <fcntl.h> |
12 |
< |
#endif |
10 |
> |
#include <time.h> |
11 |
> |
|
12 |
> |
#include "platform.h" |
13 |
> |
#include "rtio.h" |
14 |
|
#include "color.h" |
15 |
|
#include "resolu.h" |
16 |
|
|
19 |
– |
extern char *malloc(); |
20 |
– |
|
17 |
|
double gamcor = 2.2; /* gamma correction */ |
18 |
|
|
19 |
|
int bradj = 0; /* brightness adjustment */ |
22 |
|
|
23 |
|
int xmax, ymax; |
24 |
|
|
25 |
+ |
static void quiterr(char *err); |
26 |
+ |
static void avs2ra(void); |
27 |
+ |
static void ra2avs(void); |
28 |
|
|
29 |
< |
main(argc, argv) |
30 |
< |
int argc; |
31 |
< |
char *argv[]; |
29 |
> |
|
30 |
> |
int |
31 |
> |
main( |
32 |
> |
int argc, |
33 |
> |
char *argv[] |
34 |
> |
) |
35 |
|
{ |
34 |
– |
extern long getint(); |
36 |
|
int reverse = 0; |
37 |
|
int i; |
38 |
|
|
70 |
|
progname, argv[i+1]); |
71 |
|
exit(1); |
72 |
|
} |
73 |
< |
#ifdef MSDOS |
74 |
< |
setmode(fileno(stdin), O_BINARY); |
74 |
< |
setmode(fileno(stdout), O_BINARY); |
75 |
< |
#endif |
73 |
> |
SET_FILE_BINARY(stdin); |
74 |
> |
SET_FILE_BINARY(stdout); |
75 |
|
setcolrgam(gamcor); /* set up gamma correction */ |
76 |
|
if (reverse) { |
77 |
|
/* get their image resolution */ |
107 |
|
} |
108 |
|
|
109 |
|
|
110 |
< |
quiterr(err) /* print message and exit */ |
111 |
< |
char *err; |
110 |
> |
static void |
111 |
> |
quiterr( /* print message and exit */ |
112 |
> |
char *err |
113 |
> |
) |
114 |
|
{ |
115 |
|
if (err != NULL) { |
116 |
|
fprintf(stderr, "%s: %s\n", progname, err); |
120 |
|
} |
121 |
|
|
122 |
|
|
123 |
< |
avs2ra() /* convert 24-bit scanlines to Radiance picture */ |
123 |
> |
static void |
124 |
> |
avs2ra(void) /* convert 24-bit scanlines to Radiance picture */ |
125 |
|
{ |
126 |
|
COLR *scanout; |
127 |
|
register int x; |
148 |
|
quiterr("error writing Radiance picture"); |
149 |
|
} |
150 |
|
/* free scanline */ |
151 |
< |
free((char *)scanout); |
151 |
> |
free((void *)scanout); |
152 |
|
} |
153 |
|
|
154 |
|
|
155 |
< |
ra2avs() /* convert Radiance scanlines to 24-bit */ |
155 |
> |
static void |
156 |
> |
ra2avs(void) /* convert Radiance scanlines to 24-bit */ |
157 |
|
{ |
158 |
|
COLR *scanin; |
159 |
|
register int x; |
179 |
|
quiterr("error writing AVS file"); |
180 |
|
} |
181 |
|
/* free scanline */ |
182 |
< |
free((char *)scanin); |
182 |
> |
free((void *)scanin); |
183 |
|
} |