26 |
|
|
27 |
|
char *infn; /* input file name */ |
28 |
|
FILE *infp; /* input stream */ |
29 |
+ |
FILE *mapfp = NULL; /* tone-mapping function stream */ |
30 |
|
VIEW ourview = STDVIEW; /* picture view */ |
31 |
|
int gotview = 0; /* picture has view */ |
32 |
|
double pixaspect = 1.0; /* pixel aspect ratio */ |
114 |
|
if (i+1 >= argc) goto userr; |
115 |
|
ldmin = atof(argv[++i]); |
116 |
|
break; |
117 |
+ |
case 'm': |
118 |
+ |
if (i+1 >= argc) goto userr; |
119 |
+ |
if ((mapfp = fopen(argv[++i], "w")) == NULL) { |
120 |
+ |
fprintf(stderr, |
121 |
+ |
"%s: cannot open for writing\n", |
122 |
+ |
argv[i]); |
123 |
+ |
exit(1); |
124 |
+ |
} |
125 |
+ |
break; |
126 |
|
default: |
127 |
|
goto userr; |
128 |
|
} |
157 |
|
if (outprims != inprims) |
158 |
|
fputprims(outprims, stdout); |
159 |
|
mapimage(); /* map the picture */ |
160 |
+ |
if (mapfp != NULL) /* write out basic mapping */ |
161 |
+ |
putmapping(mapfp); |
162 |
|
exit(0); |
163 |
|
userr: |
164 |
< |
fprintf(stderr, "Usage: %s [-{h|a|v|s|c|l|w}[+-]][-e ev][-p xr yr xg yg xb yb xw yw|-f mbf.cal][-t Ldmax][-b Ldmin] inpic [outpic]\n", |
164 |
> |
fprintf(stderr, "Usage: %s [-{h|a|v|s|c|l|w}[+-]][-e ev][-p xr yr xg yg xb yb xw yw|-f mbf.cal][-t Ldmax][-b Ldmin][-m mapfile] inpic [outpic]\n", |
165 |
|
progname); |
166 |
|
exit(1); |
167 |
|
#undef bool |