1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
10 |
|
* 4/23/86 |
11 |
|
*/ |
12 |
|
|
13 |
< |
#include <stdio.h> |
13 |
> |
#include "standard.h" |
14 |
|
|
15 |
|
#include "color.h" |
16 |
|
|
17 |
< |
#define min(a,b) ((a)<(b)?(a):(b)) |
17 |
> |
#include "resolu.h" |
18 |
|
|
19 |
< |
int xres = 0; /* resolution of input */ |
20 |
< |
int yres = 0; |
19 |
> |
#define min(a,b) ((a)<(b)?(a):(b)) |
20 |
|
|
21 |
< |
int uniq = 0; /* unique values? */ |
21 |
> |
RESOLU picres; /* resolution of picture */ |
22 |
|
|
23 |
< |
int original = 0; /* original values? */ |
23 |
> |
int uniq = 0; /* print only unique values? */ |
24 |
|
|
25 |
+ |
int original = 0; /* convert back to original values? */ |
26 |
+ |
|
27 |
|
int dataonly = 0; /* data only format? */ |
28 |
|
|
29 |
|
int brightonly = 0; /* only brightness values? */ |
31 |
|
int reverse = 0; /* reverse conversion? */ |
32 |
|
|
33 |
|
int format = 'a'; /* input/output format */ |
34 |
+ |
char *fmtid = "ascii"; /* format identifier for header */ |
35 |
|
|
36 |
< |
int header = 1; /* do header */ |
36 |
> |
int header = 1; /* do header? */ |
37 |
|
|
38 |
< |
double exposure = 1.0; |
38 |
> |
int resolution = 1; /* put/get resolution string? */ |
39 |
|
|
40 |
+ |
int wrongformat = 0; /* wrong input format? */ |
41 |
+ |
|
42 |
+ |
double gamcor = 1.0; /* gamma correction */ |
43 |
+ |
|
44 |
+ |
int ord[3] = {RED, GRN, BLU}; /* RGB ordering */ |
45 |
+ |
int rord[4]; /* reverse ordering */ |
46 |
+ |
|
47 |
+ |
COLOR exposure = WHTCOLOR; |
48 |
+ |
|
49 |
|
char *progname; |
50 |
|
|
51 |
|
FILE *fin; |
57 |
|
int argc; |
58 |
|
char **argv; |
59 |
|
{ |
49 |
– |
extern double atof(); |
60 |
|
extern int checkhead(); |
61 |
|
int i; |
62 |
|
|
63 |
|
progname = argv[0]; |
64 |
|
|
65 |
|
for (i = 1; i < argc; i++) |
66 |
< |
if (argv[i][0] == '-') |
66 |
> |
if (argv[i][0] == '-' || argv[i][0] == '+') |
67 |
|
switch (argv[i][1]) { |
68 |
< |
case 'h': /* no header */ |
69 |
< |
header = 0; |
68 |
> |
case 'h': /* header */ |
69 |
> |
header = argv[i][0] == '+'; |
70 |
|
break; |
71 |
+ |
case 'H': /* resolution string */ |
72 |
+ |
resolution = argv[i][0] == '+'; |
73 |
+ |
break; |
74 |
|
case 'u': /* unique values */ |
75 |
< |
uniq = 1; |
75 |
> |
uniq = argv[i][0] == '-'; |
76 |
|
break; |
77 |
|
case 'o': /* original values */ |
78 |
< |
original = 1; |
78 |
> |
original = argv[i][0] == '-'; |
79 |
|
break; |
80 |
+ |
case 'g': /* gamma correction */ |
81 |
+ |
gamcor = atof(argv[++i]); |
82 |
+ |
if (argv[i][0] == '+') |
83 |
+ |
gamcor = 1.0/gamcor; |
84 |
+ |
break; |
85 |
+ |
case 'R': /* reverse byte sequence */ |
86 |
+ |
if (argv[i][0] == '-') { |
87 |
+ |
ord[0]=BLU; ord[1]=GRN; ord[2]=RED; |
88 |
+ |
} else { |
89 |
+ |
ord[0]=RED; ord[1]=GRN; ord[2]=BLU; |
90 |
+ |
} |
91 |
+ |
break; |
92 |
|
case 'r': /* reverse conversion */ |
93 |
< |
reverse = 1; |
93 |
> |
reverse = argv[i][0] == '-'; |
94 |
|
break; |
95 |
|
case 'b': /* brightness values */ |
96 |
< |
brightonly = 1; |
96 |
> |
brightonly = argv[i][0] == '-'; |
97 |
|
break; |
98 |
|
case 'd': /* data only (no indices) */ |
99 |
< |
dataonly = 1; |
99 |
> |
dataonly = argv[i][0] == '-'; |
100 |
|
switch (argv[i][2]) { |
101 |
|
case '\0': |
102 |
|
case 'a': /* ascii */ |
103 |
|
format = 'a'; |
104 |
+ |
fmtid = "ascii"; |
105 |
|
break; |
106 |
|
case 'i': /* integer */ |
107 |
+ |
format = 'i'; |
108 |
+ |
fmtid = "ascii"; |
109 |
+ |
break; |
110 |
|
case 'b': /* byte */ |
111 |
+ |
dataonly = 1; |
112 |
+ |
format = 'b'; |
113 |
+ |
fmtid = "byte"; |
114 |
+ |
break; |
115 |
|
case 'f': /* float */ |
116 |
+ |
dataonly = 1; |
117 |
+ |
format = 'f'; |
118 |
+ |
fmtid = "float"; |
119 |
+ |
break; |
120 |
|
case 'd': /* double */ |
121 |
< |
format = argv[i][2]; |
121 |
> |
dataonly = 1; |
122 |
> |
format = 'd'; |
123 |
> |
fmtid = "double"; |
124 |
|
break; |
125 |
|
default: |
126 |
|
goto unkopt; |
127 |
|
} |
128 |
|
break; |
129 |
|
case 'x': /* x resolution */ |
130 |
< |
xres = atoi(argv[++i]); |
130 |
> |
case 'X': /* x resolution */ |
131 |
> |
resolution = 0; |
132 |
> |
if (argv[i][0] == '-') |
133 |
> |
picres.or |= XDECR; |
134 |
> |
picres.xr = atoi(argv[++i]); |
135 |
|
break; |
136 |
|
case 'y': /* y resolution */ |
137 |
< |
yres = atoi(argv[++i]); |
137 |
> |
case 'Y': /* y resolution */ |
138 |
> |
resolution = 0; |
139 |
> |
if (argv[i][0] == '-') |
140 |
> |
picres.or |= YDECR; |
141 |
> |
if (picres.xr == 0) |
142 |
> |
picres.or |= YMAJOR; |
143 |
> |
picres.yr = atoi(argv[++i]); |
144 |
|
break; |
145 |
|
default: |
146 |
|
unkopt: |
151 |
|
} |
152 |
|
else |
153 |
|
break; |
154 |
< |
|
154 |
> |
/* recognize special formats */ |
155 |
> |
if (dataonly && format == 'b') |
156 |
> |
if (brightonly) |
157 |
> |
fmtid = "8-bit_grey"; |
158 |
> |
else |
159 |
> |
fmtid = "24-bit_rgb"; |
160 |
> |
/* assign reverse ordering */ |
161 |
> |
rord[ord[0]] = 0; |
162 |
> |
rord[ord[1]] = 1; |
163 |
> |
rord[ord[2]] = 2; |
164 |
> |
/* get input */ |
165 |
|
if (i == argc) { |
166 |
|
fin = stdin; |
167 |
|
} else if (i == argc-1) { |
178 |
|
set_io(); |
179 |
|
|
180 |
|
if (reverse) { |
181 |
< |
if (header) /* get header */ |
182 |
< |
copyheader(fin, stdout); |
183 |
< |
/* add to header */ |
184 |
< |
printargs(i, argv, stdout); |
185 |
< |
printf("\n"); |
186 |
< |
if (yres <= 0 || xres <= 0) { |
187 |
< |
fprintf(stderr, "%s: missing x and y resolution\n", |
188 |
< |
progname); |
181 |
> |
#ifdef MSDOS |
182 |
> |
setmode(fileno(stdout), O_BINARY); |
183 |
> |
if (format != 'a' && format != 'i') |
184 |
> |
setmode(fileno(fin), O_BINARY); |
185 |
> |
#endif |
186 |
> |
/* get header */ |
187 |
> |
if (header && checkheader(fin, fmtid, stdout) < 0) { |
188 |
> |
fprintf(stderr, "%s: wrong input format\n", progname); |
189 |
|
quit(1); |
190 |
|
} |
191 |
< |
fputresolu(YMAJOR|YDECR, xres, yres, stdout); |
191 |
> |
/* get resolution */ |
192 |
> |
if ((resolution && !fgetsresolu(&picres, fin)) || |
193 |
> |
picres.xr <= 0 || picres.yr <= 0) { |
194 |
> |
fprintf(stderr, "%s: missing resolution\n", progname); |
195 |
> |
quit(1); |
196 |
> |
} |
197 |
> |
/* add to header */ |
198 |
> |
printargs(i, argv, stdout); |
199 |
> |
fputformat(COLRFMT, stdout); |
200 |
> |
putchar('\n'); |
201 |
> |
fputsresolu(&picres, stdout); /* always put resolution */ |
202 |
|
valtopix(); |
203 |
|
} else { |
204 |
+ |
#ifdef MSDOS |
205 |
+ |
setmode(fileno(fin), O_BINARY); |
206 |
+ |
if (format != 'a' && format != 'i') |
207 |
+ |
setmode(fileno(stdout), O_BINARY); |
208 |
+ |
#endif |
209 |
|
/* get header */ |
210 |
< |
getheader(fin, checkhead); |
211 |
< |
|
212 |
< |
if (xres <= 0 || yres <= 0) /* get picture size */ |
213 |
< |
if (fgetresolu(&xres, &yres, fin) != (YMAJOR|YDECR)) { |
214 |
< |
fprintf(stderr, |
215 |
< |
"%s: missing x and y resolution\n", |
216 |
< |
progname); |
217 |
< |
quit(1); |
218 |
< |
} |
210 |
> |
getheader(fin, checkhead, NULL); |
211 |
> |
if (wrongformat) { |
212 |
> |
fprintf(stderr, "%s: input not a Radiance picture\n", |
213 |
> |
progname); |
214 |
> |
quit(1); |
215 |
> |
} |
216 |
> |
if (!fgetsresolu(&picres, fin)) { |
217 |
> |
fprintf(stderr, "%s: missing resolution\n", progname); |
218 |
> |
quit(1); |
219 |
> |
} |
220 |
|
if (header) { |
221 |
|
printargs(i, argv, stdout); |
222 |
< |
printf("\n"); |
222 |
> |
fputformat(fmtid, stdout); |
223 |
> |
putchar('\n'); |
224 |
|
} |
225 |
+ |
if (resolution) /* put resolution */ |
226 |
+ |
fputsresolu(&picres, stdout); |
227 |
|
pixtoval(); |
228 |
|
} |
229 |
|
|
234 |
|
checkhead(line) /* deal with line from header */ |
235 |
|
char *line; |
236 |
|
{ |
237 |
< |
if (header) |
237 |
> |
char fmt[32]; |
238 |
> |
double d; |
239 |
> |
COLOR ctmp; |
240 |
> |
|
241 |
> |
if (isformat(line)) { |
242 |
> |
formatval(fmt, line); |
243 |
> |
wrongformat = strcmp(fmt, COLRFMT); |
244 |
> |
} else if (original && isexpos(line)) { |
245 |
> |
d = 1.0/exposval(line); |
246 |
> |
scalecolor(exposure, d); |
247 |
> |
} else if (original && iscolcor(line)) { |
248 |
> |
colcorval(ctmp, line); |
249 |
> |
setcolor(exposure, colval(exposure,RED)/colval(ctmp,RED), |
250 |
> |
colval(exposure,GRN)/colval(ctmp,GRN), |
251 |
> |
colval(exposure,BLU)/colval(ctmp,BLU)); |
252 |
> |
} else if (header) |
253 |
|
fputs(line, stdout); |
161 |
– |
if (isexpos(line)) |
162 |
– |
exposure *= exposval(line); |
254 |
|
} |
255 |
|
|
256 |
|
|
257 |
|
pixtoval() /* convert picture to values */ |
258 |
|
{ |
259 |
< |
COLOR *scanln; |
259 |
> |
register COLOR *scanln; |
260 |
> |
int dogamma; |
261 |
|
COLOR lastc; |
262 |
+ |
FLOAT hv[2]; |
263 |
|
int y; |
264 |
|
register int x; |
265 |
|
|
266 |
< |
scanln = (COLOR *)malloc(xres*sizeof(COLOR)); |
266 |
> |
scanln = (COLOR *)malloc(scanlen(&picres)*sizeof(COLOR)); |
267 |
|
if (scanln == NULL) { |
268 |
|
fprintf(stderr, "%s: out of memory\n", progname); |
269 |
|
quit(1); |
270 |
|
} |
271 |
+ |
dogamma = gamcor < .95 || gamcor > 1.05; |
272 |
|
setcolor(lastc, 0.0, 0.0, 0.0); |
273 |
< |
for (y = yres-1; y >= 0; y--) { |
274 |
< |
if (freadscan(scanln, xres, fin) < 0) { |
273 |
> |
for (y = 0; y < numscans(&picres); y++) { |
274 |
> |
if (freadscan(scanln, scanlen(&picres), fin) < 0) { |
275 |
|
fprintf(stderr, "%s: read error\n", progname); |
276 |
|
quit(1); |
277 |
|
} |
278 |
< |
for (x = 0; x < xres; x++) { |
278 |
> |
for (x = 0; x < scanlen(&picres); x++) { |
279 |
|
if (uniq) |
280 |
< |
if ( scanln[x][RED] == lastc[RED] && |
281 |
< |
scanln[x][GRN] == lastc[GRN] && |
282 |
< |
scanln[x][BLU] == lastc[BLU] ) |
280 |
> |
if ( colval(scanln[x],RED) == |
281 |
> |
colval(lastc,RED) && |
282 |
> |
colval(scanln[x],GRN) == |
283 |
> |
colval(lastc,GRN) && |
284 |
> |
colval(scanln[x],BLU) == |
285 |
> |
colval(lastc,BLU) ) |
286 |
|
continue; |
287 |
|
else |
288 |
|
copycolor(lastc, scanln[x]); |
289 |
|
if (original) |
290 |
< |
scalecolor(scanln[x], 1.0/exposure); |
291 |
< |
if (!dataonly) |
292 |
< |
printf("%7d %7d ", x, y); |
290 |
> |
multcolor(scanln[x], exposure); |
291 |
> |
if (dogamma) |
292 |
> |
setcolor(scanln[x], |
293 |
> |
pow(colval(scanln[x],RED), 1.0/gamcor), |
294 |
> |
pow(colval(scanln[x],GRN), 1.0/gamcor), |
295 |
> |
pow(colval(scanln[x],BLU), 1.0/gamcor)); |
296 |
> |
if (!dataonly) { |
297 |
> |
pix2loc(hv, &picres, x, y); |
298 |
> |
printf("%7d %7d ", (int)(hv[0]*picres.xr), |
299 |
> |
(int)(hv[1]*picres.yr)); |
300 |
> |
} |
301 |
|
if ((*putval)(scanln[x], stdout) < 0) { |
302 |
|
fprintf(stderr, "%s: write error\n", progname); |
303 |
|
quit(1); |
310 |
|
|
311 |
|
valtopix() /* convert values to a pixel file */ |
312 |
|
{ |
313 |
< |
COLOR *scanln; |
313 |
> |
int dogamma; |
314 |
> |
register COLOR *scanln; |
315 |
|
int y; |
316 |
|
register int x; |
317 |
|
|
318 |
< |
scanln = (COLOR *)malloc(xres*sizeof(COLOR)); |
318 |
> |
scanln = (COLOR *)malloc(scanlen(&picres)*sizeof(COLOR)); |
319 |
|
if (scanln == NULL) { |
320 |
|
fprintf(stderr, "%s: out of memory\n", progname); |
321 |
|
quit(1); |
322 |
|
} |
323 |
< |
for (y = yres-1; y >= 0; y--) { |
324 |
< |
for (x = 0; x < xres; x++) { |
323 |
> |
dogamma = gamcor < .95 || gamcor > 1.05; |
324 |
> |
for (y = 0; y < numscans(&picres); y++) { |
325 |
> |
for (x = 0; x < scanlen(&picres); x++) { |
326 |
|
if (!dataonly) |
327 |
|
fscanf(fin, "%*d %*d"); |
328 |
|
if ((*getval)(scanln[x], fin) < 0) { |
329 |
|
fprintf(stderr, "%s: read error\n", progname); |
330 |
|
quit(1); |
331 |
|
} |
332 |
+ |
if (dogamma) |
333 |
+ |
setcolor(scanln[x], |
334 |
+ |
pow(colval(scanln[x],RED), gamcor), |
335 |
+ |
pow(colval(scanln[x],GRN), gamcor), |
336 |
+ |
pow(colval(scanln[x],BLU), gamcor)); |
337 |
|
} |
338 |
< |
if (fwritescan(scanln, xres, stdout) < 0 |
227 |
< |
|| fflush(stdout) < 0) { |
338 |
> |
if (fwritescan(scanln, scanlen(&picres), stdout) < 0) { |
339 |
|
fprintf(stderr, "%s: write error\n", progname); |
340 |
|
quit(1); |
341 |
|
} |
355 |
|
COLOR col; |
356 |
|
FILE *fp; |
357 |
|
{ |
358 |
< |
double vd[3]; |
358 |
> |
double vd[3]; |
359 |
|
|
360 |
|
if (fscanf(fp, "%lf %lf %lf", &vd[0], &vd[1], &vd[2]) != 3) |
361 |
|
return(-1); |
362 |
< |
setcolor(col, vd[0], vd[1], vd[2]); |
362 |
> |
setcolor(col, vd[rord[RED]], vd[rord[GRN]], vd[rord[BLU]]); |
363 |
|
return(0); |
364 |
|
} |
365 |
|
|
368 |
|
COLOR col; |
369 |
|
FILE *fp; |
370 |
|
{ |
371 |
< |
double vd[3]; |
371 |
> |
double vd[3]; |
372 |
|
|
373 |
|
if (fread((char *)vd, sizeof(double), 3, fp) != 3) |
374 |
|
return(-1); |
375 |
< |
setcolor(col, vd[0], vd[1], vd[2]); |
375 |
> |
setcolor(col, vd[rord[RED]], vd[rord[GRN]], vd[rord[BLU]]); |
376 |
|
return(0); |
377 |
|
} |
378 |
|
|
385 |
|
|
386 |
|
if (fread((char *)vf, sizeof(float), 3, fp) != 3) |
387 |
|
return(-1); |
388 |
< |
setcolor(col, vf[0], vf[1], vf[2]); |
388 |
> |
setcolor(col, vf[rord[RED]], vf[rord[GRN]], vf[rord[BLU]]); |
389 |
|
return(0); |
390 |
|
} |
391 |
|
|
398 |
|
|
399 |
|
if (fscanf(fp, "%d %d %d", &vi[0], &vi[1], &vi[2]) != 3) |
400 |
|
return(-1); |
401 |
< |
setcolor(col,(vi[0]+.5)/256.,(vi[1]+.5)/256.,(vi[2]+.5)/256.); |
401 |
> |
setcolor(col, (vi[rord[RED]]+.5)/256., |
402 |
> |
(vi[rord[GRN]]+.5)/256., (vi[rord[BLU]]+.5)/256.); |
403 |
|
return(0); |
404 |
|
} |
405 |
|
|
412 |
|
|
413 |
|
if (fread((char *)vb, sizeof(BYTE), 3, fp) != 3) |
414 |
|
return(-1); |
415 |
< |
setcolor(col,(vb[0]+.5)/256.,(vb[1]+.5)/256.,(vb[2]+.5)/256.); |
415 |
> |
setcolor(col, (vb[rord[RED]]+.5)/256., |
416 |
> |
(vb[rord[GRN]]+.5)/256., (vb[rord[BLU]]+.5)/256.); |
417 |
|
return(0); |
418 |
|
} |
419 |
|
|
422 |
|
COLOR col; |
423 |
|
FILE *fp; |
424 |
|
{ |
425 |
< |
double vd; |
425 |
> |
double vd; |
426 |
|
|
427 |
|
if (fscanf(fp, "%lf", &vd) != 1) |
428 |
|
return(-1); |
435 |
|
COLOR col; |
436 |
|
FILE *fp; |
437 |
|
{ |
438 |
< |
double vd; |
438 |
> |
double vd; |
439 |
|
|
440 |
|
if (fread((char *)&vd, sizeof(double), 1, fp) != 1) |
441 |
|
return(-1); |
462 |
|
FILE *fp; |
463 |
|
{ |
464 |
|
int vi; |
465 |
< |
double d; |
465 |
> |
double d; |
466 |
|
|
467 |
|
if (fscanf(fp, "%d", &vi) != 1) |
468 |
|
return(-1); |
477 |
|
FILE *fp; |
478 |
|
{ |
479 |
|
BYTE vb; |
480 |
< |
double d; |
480 |
> |
double d; |
481 |
|
|
482 |
|
if (fread((char *)&vb, sizeof(BYTE), 1, fp) != 1) |
483 |
|
return(-1); |
492 |
|
FILE *fp; |
493 |
|
{ |
494 |
|
fprintf(fp, "%15.3e %15.3e %15.3e\n", |
495 |
< |
colval(col,RED), |
496 |
< |
colval(col,GRN), |
497 |
< |
colval(col,BLU)); |
495 |
> |
colval(col,ord[0]), |
496 |
> |
colval(col,ord[1]), |
497 |
> |
colval(col,ord[2])); |
498 |
|
|
499 |
|
return(ferror(fp) ? -1 : 0); |
500 |
|
} |
506 |
|
{ |
507 |
|
float vf[3]; |
508 |
|
|
509 |
< |
vf[0] = colval(col,RED); |
510 |
< |
vf[1] = colval(col,GRN); |
511 |
< |
vf[2] = colval(col,BLU); |
509 |
> |
vf[0] = colval(col,ord[0]); |
510 |
> |
vf[1] = colval(col,ord[1]); |
511 |
> |
vf[2] = colval(col,ord[2]); |
512 |
|
fwrite((char *)vf, sizeof(float), 3, fp); |
513 |
|
|
514 |
|
return(ferror(fp) ? -1 : 0); |
519 |
|
COLOR col; |
520 |
|
FILE *fp; |
521 |
|
{ |
522 |
< |
double vd[3]; |
522 |
> |
double vd[3]; |
523 |
|
|
524 |
< |
vd[0] = colval(col,RED); |
525 |
< |
vd[1] = colval(col,GRN); |
526 |
< |
vd[2] = colval(col,BLU); |
524 |
> |
vd[0] = colval(col,ord[0]); |
525 |
> |
vd[1] = colval(col,ord[1]); |
526 |
> |
vd[2] = colval(col,ord[2]); |
527 |
|
fwrite((char *)vd, sizeof(double), 3, fp); |
528 |
|
|
529 |
|
return(ferror(fp) ? -1 : 0); |
535 |
|
FILE *fp; |
536 |
|
{ |
537 |
|
fprintf(fp, "%d %d %d\n", |
538 |
< |
(int)(colval(col,RED)*256.), |
539 |
< |
(int)(colval(col,GRN)*256.), |
540 |
< |
(int)(colval(col,BLU)*256.)); |
538 |
> |
(int)(colval(col,ord[0])*256.), |
539 |
> |
(int)(colval(col,ord[1])*256.), |
540 |
> |
(int)(colval(col,ord[2])*256.)); |
541 |
|
|
542 |
|
return(ferror(fp) ? -1 : 0); |
543 |
|
} |
550 |
|
register int i; |
551 |
|
BYTE vb[3]; |
552 |
|
|
553 |
< |
i = colval(col,RED)*256.; |
553 |
> |
i = colval(col,ord[0])*256.; |
554 |
|
vb[0] = min(i,255); |
555 |
< |
i = colval(col,GRN)*256.; |
555 |
> |
i = colval(col,ord[1])*256.; |
556 |
|
vb[1] = min(i,255); |
557 |
< |
i = colval(col,BLU)*256.; |
557 |
> |
i = colval(col,ord[2])*256.; |
558 |
|
vb[2] = min(i,255); |
559 |
|
fwrite((char *)vb, sizeof(BYTE), 3, fp); |
560 |
|
|
589 |
|
COLOR col; |
590 |
|
FILE *fp; |
591 |
|
{ |
592 |
< |
double vd; |
592 |
> |
double vd; |
593 |
|
|
594 |
|
vd = bright(col); |
595 |
|
fwrite((char *)&vd, sizeof(double), 1, fp); |