| 1 |
– |
/* Copyright (c) 1997 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 |
|
* Warp colors in Radiance picture to correct for input/output changes. |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
< |
#include <stdio.h> |
| 8 |
> |
#include "paths.h" |
| 9 |
> |
#include "rtio.h" |
| 10 |
> |
#include "resolu.h" |
| 11 |
|
#include "color.h" |
| 12 |
|
#include "warp3d.h" |
| 13 |
|
|
| 14 |
< |
char *progname; /* global argv[0] */ |
| 16 |
< |
|
| 17 |
< |
FILE *infp = stdin; /* input stream */ |
| 14 |
> |
FILE *infp = NULL; /* input stream */ |
| 15 |
|
int xres, yres; /* input picture resolution */ |
| 16 |
|
|
| 17 |
|
WARP3D *cwarp; /* our warp map */ |
| 18 |
|
int iclip = CGAMUT_UPPER; /* input value gamut clipping */ |
| 19 |
|
int oclip = CGAMUT_LOWER; /* output value gamut clipping */ |
| 20 |
|
|
| 21 |
+ |
static void syserror(char *s); |
| 22 |
+ |
static void picwarp(void); |
| 23 |
|
|
| 24 |
< |
main(argc, argv) |
| 25 |
< |
int argc; |
| 26 |
< |
char *argv[]; |
| 24 |
> |
|
| 25 |
> |
int |
| 26 |
> |
main( |
| 27 |
> |
int argc, |
| 28 |
> |
char *argv[] |
| 29 |
> |
) |
| 30 |
|
{ |
| 31 |
< |
static char picfmt[LPICFMT+1] = PICFMT; |
| 31 |
> |
static char picfmt[MAXFMTLEN] = PICFMT; |
| 32 |
|
int cwflags = 0; |
| 33 |
|
int rval; |
| 34 |
|
int i; |
| 35 |
|
|
| 36 |
< |
progname = argv[0]; |
| 36 |
> |
fixargv0(argv[0]); |
| 37 |
> |
infp = stdin; |
| 38 |
|
/* get options */ |
| 39 |
|
for (i = 1; i < argc && argv[i][0] == '-'; i++) |
| 40 |
|
switch (argv[i][1]) { |
| 87 |
|
exit(0); |
| 88 |
|
userr: |
| 89 |
|
fprintf(stderr, |
| 90 |
< |
"Usage: %s [-i][-o][-e|-f] map.cwp [input.pic [output.pic]]\n", |
| 90 |
> |
"Usage: %s [-i][-o][-e|-f] map.cwp [input.hdr [output.hdr]]\n", |
| 91 |
|
progname); |
| 92 |
|
exit(1); |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
|
| 96 |
< |
syserror(s) /* print system error and exit */ |
| 97 |
< |
char *s; |
| 96 |
> |
static void |
| 97 |
> |
syserror( /* print system error and exit */ |
| 98 |
> |
char *s |
| 99 |
> |
) |
| 100 |
|
{ |
| 101 |
|
fprintf(stderr, "%s: ", progname); |
| 102 |
|
perror(s); |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
|
| 107 |
< |
picwarp() /* warp our picture scanlines */ |
| 107 |
> |
static void |
| 108 |
> |
picwarp(void) /* warp our picture scanlines */ |
| 109 |
|
{ |
| 110 |
|
register COLOR *scan; |
| 111 |
|
long ngamut = 0; |
| 147 |
|
} |
| 148 |
|
} |
| 149 |
|
if (ngamut >= (long)xres*yres/100) |
| 150 |
< |
fprintf(stderr, "%s: warning - %d%% of pixels out of gamut\n", |
| 150 |
> |
fprintf(stderr, "%s: warning - %ld%% of pixels out of gamut\n", |
| 151 |
|
progname, 100*ngamut/((long)xres*yres)); |
| 152 |
< |
free((char *)scan); |
| 152 |
> |
free((void *)scan); |
| 153 |
|
} |