| 59 |
|
|
| 60 |
|
char errmsg[128]; |
| 61 |
|
|
| 62 |
< |
COLR *inline; |
| 62 |
> |
COLR *inl; |
| 63 |
|
|
| 64 |
|
pixel *tarData; |
| 65 |
|
|
| 124 |
|
quiterr(errmsg); |
| 125 |
|
} |
| 126 |
|
/* put header */ |
| 127 |
< |
printargs(argc, argv, stdout); |
| 127 |
> |
printargs(i, argv, stdout); |
| 128 |
|
putchar('\n'); |
| 129 |
|
fputresolu(YMAJOR|YDECR, xmax, ymax, stdout); |
| 130 |
|
/* convert file */ |
| 304 |
|
h->dataBits = 8; |
| 305 |
|
h->imType = 0; |
| 306 |
|
/* allocate scanline */ |
| 307 |
< |
inline = (COLR *)emalloc(xmax*sizeof(COLR)); |
| 307 |
> |
inl = (COLR *)emalloc(xmax*sizeof(COLR)); |
| 308 |
|
/* allocate targa data */ |
| 309 |
|
tarData = taralloc(h); |
| 310 |
|
|
| 368 |
|
if (inpic->bytes_line == 0) { |
| 369 |
|
if (inpic->pos.y[y] == 0) { |
| 370 |
|
while (inpic->nexty < y) { |
| 371 |
< |
if (freadcolrs(inline, xmax, inpic->fp) < 0) |
| 371 |
> |
if (freadcolrs(inl, xmax, inpic->fp) < 0) |
| 372 |
|
quiterr("read error in picreadline3"); |
| 373 |
|
inpic->pos.y[++inpic->nexty] = ftell(inpic->fp); |
| 374 |
|
} |
| 378 |
|
quiterr("seek error in picreadline3"); |
| 379 |
|
} else if (inpic->bytes_line == 0 && inpic->pos.y[inpic->nexty] == 0) |
| 380 |
|
inpic->pos.y[inpic->nexty] = ftell(inpic->fp); |
| 381 |
< |
if (freadcolrs(inline, xmax, inpic->fp) < 0) /* read scanline */ |
| 381 |
> |
if (freadcolrs(inl, xmax, inpic->fp) < 0) /* read scanline */ |
| 382 |
|
quiterr("read error in picreadline3"); |
| 383 |
|
inpic->nexty = y+1; |
| 384 |
|
/* convert scanline */ |
| 385 |
< |
normcolrs(inline, xmax, 0); |
| 385 |
> |
normcolrs(inl, xmax, 0); |
| 386 |
|
for (i = 0; i < xmax; i++) { |
| 387 |
< |
l3[i].r = inline[i][RED]; |
| 388 |
< |
l3[i].g = inline[i][GRN]; |
| 389 |
< |
l3[i].b = inline[i][BLU]; |
| 387 |
> |
l3[i].r = inl[i][RED]; |
| 388 |
> |
l3[i].g = inl[i][GRN]; |
| 389 |
> |
l3[i].b = inl[i][BLU]; |
| 390 |
|
} |
| 391 |
|
} |
| 392 |
|
|
| 465 |
|
register int i, val; |
| 466 |
|
|
| 467 |
|
for (i = 0; i < 256; i++) { |
| 468 |
< |
val = pow(i/256.0, 1.0/gamma) * 256.0; |
| 468 |
> |
val = pow((i+0.5)/256.0, 1.0/gamma) * 256.0; |
| 469 |
|
map[0][i] = map[1][i] = map[2][i] = val; |
| 470 |
|
} |
| 471 |
|
} |