| 283 |
|
void *p |
| 284 |
|
) |
| 285 |
|
{ |
| 286 |
< |
char fmt[32]; |
| 286 |
> |
char fmt[MAXFMTLEN]; |
| 287 |
|
|
| 288 |
|
if (isexpos(s)) |
| 289 |
|
exposure *= exposval(s); |
| 290 |
|
else if (formatval(fmt, s)) |
| 291 |
< |
wrongformat = strcmp(fmt, COLRFMT); |
| 292 |
< |
else if (isview(s) && sscanview(&ourview, s) > 0) |
| 293 |
< |
gotview++; |
| 291 |
> |
wrongformat = strcmp(fmt, COLRFMT) && strcmp(fmt, SPECFMT); |
| 292 |
> |
else if (isview(s)) |
| 293 |
> |
gotview += sscanview(&ourview, s); |
| 294 |
> |
else if (isncomp(s)) |
| 295 |
> |
NCSAMP = ncompval(s); |
| 296 |
> |
else if (iswlsplit(s)) |
| 297 |
> |
wlsplitval(WLPART, s); |
| 298 |
|
return(0); |
| 299 |
|
} |
| 300 |
|
|
| 312 |
|
XTextProperty windowName, iconName; |
| 313 |
|
XGCValues xgcv; |
| 314 |
|
char *name; |
| 315 |
< |
register int i; |
| 315 |
> |
int i; |
| 316 |
|
|
| 317 |
|
if (fname != NULL) { |
| 318 |
|
scanpos = (long *)malloc(ymax*sizeof(long)); |
| 422 |
|
char *err |
| 423 |
|
) |
| 424 |
|
{ |
| 425 |
< |
register int es; |
| 425 |
> |
int es; |
| 426 |
|
int cs; |
| 427 |
|
|
| 428 |
< |
if ( (es = err != NULL) ) |
| 428 |
> |
if ( (es = (err != NULL)) ) |
| 429 |
|
fprintf(stderr, "%s: %s: %s\n", progname, |
| 430 |
|
fname==NULL?"<stdin>":fname, err); |
| 431 |
|
if (thedisplay != NULL) |
| 443 |
|
|
| 444 |
|
static int |
| 445 |
|
viscmp( /* compare visual to see which is better, descending */ |
| 446 |
< |
register XVisualInfo *v1, |
| 447 |
< |
register XVisualInfo *v2 |
| 446 |
> |
XVisualInfo *v1, |
| 447 |
> |
XVisualInfo *v2 |
| 448 |
|
) |
| 449 |
|
{ |
| 450 |
|
int bad1 = 0, bad2 = 0; |
| 451 |
< |
register int *rp; |
| 451 |
> |
int *rp; |
| 452 |
|
|
| 453 |
|
if (v1->class == v2->class) { |
| 454 |
|
if ((v1->class == TrueColor) | (v1->class == DirectColor)) { |
| 505 |
|
}; |
| 506 |
|
XVisualInfo *xvi; |
| 507 |
|
int vismatched; |
| 508 |
< |
register int i, j; |
| 508 |
> |
int i, j; |
| 509 |
|
|
| 510 |
|
if (greyscale) { |
| 511 |
|
ourrank = rankings[2]; |
| 676 |
|
RREAL hv[2]; |
| 677 |
|
FVECT rorg, rdir; |
| 678 |
|
COLOR cval; |
| 679 |
< |
register char *cp; |
| 679 |
> |
char *cp; |
| 680 |
|
|
| 681 |
|
bbox.xmin = xpos; bbox.xsiz = 1; |
| 682 |
|
bbox.ymin = ypos; bbox.ysiz = 1; |
| 954 |
|
|
| 955 |
|
static void |
| 956 |
|
colavg( |
| 957 |
< |
register COLR *scn, |
| 958 |
< |
register int n, |
| 957 |
> |
COLR *scn, |
| 958 |
> |
int n, |
| 959 |
|
void *cavg |
| 960 |
|
) |
| 961 |
|
{ |
| 962 |
|
COLOR col; |
| 963 |
|
|
| 964 |
|
while (n--) { |
| 965 |
< |
colr_color(col, *scn++); |
| 965 |
> |
colr_color(col, *scn); |
| 966 |
|
addcolor((COLORV*)cavg, col); |
| 967 |
+ |
scn++; |
| 968 |
|
} |
| 969 |
|
} |
| 970 |
|
|
| 975 |
|
) |
| 976 |
|
{ |
| 977 |
|
double d; |
| 978 |
< |
register int rval; |
| 978 |
> |
int rval; |
| 979 |
|
|
| 980 |
|
setcolor(cavg, 0., 0., 0.); |
| 981 |
< |
rval = dobox(colavg, (void *)cavg); |
| 981 |
> |
rval = dobox(colavg, cavg); |
| 982 |
|
if (rval > 0) { |
| 983 |
|
d = 1./rval; |
| 984 |
|
scalecolor(cavg, d); |
| 989 |
|
|
| 990 |
|
static int |
| 991 |
|
dobox( /* run function over bbox */ |
| 987 |
– |
//void (*f)(), /* function to call for each subscan */ |
| 992 |
|
doboxf_t *f, /* function to call for each subscan */ |
| 993 |
|
void *p /* pointer to private data */ |
| 994 |
|
) |
| 1013 |
|
if (top >= bottom) |
| 1014 |
|
return(0); |
| 1015 |
|
for (y = top; y < bottom; y++) { |
| 1016 |
< |
if (getscan(y) == -1) |
| 1016 |
> |
if (getscan(y) < 0) |
| 1017 |
|
return(-1); |
| 1018 |
|
(*f)(scanline+left, right-left, p); |
| 1019 |
|
} |
| 1073 |
|
tmGlobal = tmInit(flags, stdprims, gamcor); |
| 1074 |
|
if (tmGlobal == NULL) |
| 1075 |
|
goto memerr; |
| 1076 |
< |
if (tmSetSpace(tmGlobal, stdprims, WHTEFFICACY/exposure, NULL)) |
| 1076 |
> |
if (tmSetSpace(tmGlobal, stdprims, WHTEFFICACY/exposure)) |
| 1077 |
|
goto tmerr; |
| 1078 |
|
/* compute picture histogram */ |
| 1079 |
|
for (y = 0; y < ymax; y++) { |
| 1086 |
|
} |
| 1087 |
|
} |
| 1088 |
|
tmCurrent = tmDup(tmGlobal); /* add fixations to duplicate map */ |
| 1089 |
< |
dobox(addfix, (void *)tmCurrent); |
| 1089 |
> |
dobox(addfix, tmCurrent); |
| 1090 |
|
/* (re)compute tone mapping */ |
| 1091 |
|
if (tmComputeMapping(tmCurrent, gamcor, 0., 0.)) |
| 1092 |
|
goto tmerr; |
| 1100 |
|
|
| 1101 |
|
static void |
| 1102 |
|
tmap_colrs( /* apply tone mapping to scanline */ |
| 1103 |
< |
register COLR *scn, |
| 1103 |
> |
COLR *scn, |
| 1104 |
|
int len |
| 1105 |
|
) |
| 1106 |
|
{ |
| 1107 |
< |
register uby8 *ps; |
| 1107 |
> |
uby8 *ps; |
| 1108 |
|
|
| 1109 |
|
if (tmflags == TM_F_LINEAR) { |
| 1110 |
|
if (scale) |
| 1142 |
|
static void |
| 1143 |
|
getmono(void) /* get monochrome data */ |
| 1144 |
|
{ |
| 1145 |
< |
register unsigned char *dp; |
| 1146 |
< |
register int x, err; |
| 1145 |
> |
unsigned char *dp; |
| 1146 |
> |
int x, err; |
| 1147 |
|
int y, errp; |
| 1148 |
|
short *cerr; |
| 1149 |
|
|
| 1168 |
|
cerr[x] = err + errp; |
| 1169 |
|
} |
| 1170 |
|
} |
| 1171 |
< |
free((void *)cerr); |
| 1171 |
> |
free(cerr); |
| 1172 |
|
} |
| 1173 |
|
|
| 1174 |
|
|
| 1182 |
|
static int ynext; |
| 1183 |
|
static char *dp; |
| 1184 |
|
COLR clr; |
| 1185 |
< |
register int err; |
| 1186 |
< |
register int x, ti; |
| 1185 |
> |
int err; |
| 1186 |
> |
int x, ti; |
| 1187 |
|
int errp; |
| 1188 |
|
|
| 1189 |
|
if (iconheight == 0) { /* initialize */ |
| 1230 |
|
getfull(void) /* get full (24-bit) data */ |
| 1231 |
|
{ |
| 1232 |
|
int y; |
| 1233 |
< |
register uint32 *dp; |
| 1234 |
< |
register uint16 *dph; |
| 1235 |
< |
register int x; |
| 1233 |
> |
uint32 *dp; |
| 1234 |
> |
uint16 *dph; |
| 1235 |
> |
int x; |
| 1236 |
|
/* initialize tone mapping */ |
| 1237 |
|
make_tonemap(); |
| 1238 |
|
/* read and convert file */ |
| 1298 |
|
getgrey(void) /* get greyscale data */ |
| 1299 |
|
{ |
| 1300 |
|
int y; |
| 1301 |
< |
register unsigned char *dp; |
| 1302 |
< |
register int x; |
| 1301 |
> |
unsigned char *dp; |
| 1302 |
> |
int x; |
| 1303 |
|
/* initialize tone mapping */ |
| 1304 |
|
make_tonemap(); |
| 1305 |
|
/* read and convert file */ |
| 1357 |
|
|
| 1358 |
|
static void |
| 1359 |
|
scale_rcolors( /* scale color map */ |
| 1360 |
< |
register XRASTER *xr, |
| 1360 |
> |
XRASTER *xr, |
| 1361 |
|
double sf |
| 1362 |
|
) |
| 1363 |
|
{ |
| 1364 |
< |
register int i; |
| 1364 |
> |
int i; |
| 1365 |
|
long maxv; |
| 1366 |
|
|
| 1367 |
|
if (xr->pixels == NULL) |
| 1392 |
|
{ |
| 1393 |
|
static int trunced = -1; /* truncated file? */ |
| 1394 |
|
skipit: |
| 1395 |
< |
if (trunced >= 0 && y >= trunced) { |
| 1396 |
< |
memset(scanline, '\0', xmax*sizeof(COLR)); |
| 1395 |
> |
if (y == cury-1) /* already got it? */ |
| 1396 |
> |
return(0); |
| 1397 |
> |
if ((trunced >= 0) & (y >= trunced)) { |
| 1398 |
> |
memset(scanline, 0, xmax*sizeof(COLR)); |
| 1399 |
|
return(-1); |
| 1400 |
|
} |
| 1401 |
|
if (y != cury) { |
| 1402 |
< |
if (scanpos == NULL || scanpos[y] == -1) |
| 1402 |
> |
if (scanpos == NULL || scanpos[y] < 0) |
| 1403 |
|
return(-1); |
| 1404 |
< |
if (fseek(fin, scanpos[y], 0) == -1) |
| 1404 |
> |
if (fseek(fin, scanpos[y], 0) < 0) |
| 1405 |
|
quiterr("fseek error"); |
| 1406 |
|
cury = y; |
| 1407 |
< |
} else if (scanpos != NULL && scanpos[y] == -1) |
| 1407 |
> |
} else if (scanpos != NULL && scanpos[y] < 0) |
| 1408 |
|
scanpos[y] = ftell(fin); |
| 1409 |
|
|
| 1410 |
< |
if (freadcolrs(scanline, xmax, fin) < 0) { |
| 1410 |
> |
if (fread2colrs(scanline, xmax, fin, NCSAMP, WLPART) < 0) { |
| 1411 |
|
fprintf(stderr, "%s: %s: unfinished picture\n", |
| 1412 |
|
progname, fname==NULL?"<stdin>":fname); |
| 1413 |
|
trunced = y; |