| 16 |
|
|
| 17 |
|
#include "platform.h" |
| 18 |
|
#include "rtprocess.h" |
| 19 |
+ |
#include "rtio.h" |
| 20 |
|
#include "color.h" |
| 21 |
|
#include "resolu.h" |
| 22 |
|
#include "pmap.h" |
| 23 |
|
#include "warp3d.h" |
| 24 |
+ |
#include "mx3.h" |
| 25 |
|
|
| 26 |
|
/* MacBeth colors */ |
| 27 |
|
#define DarkSkin 0 |
| 125 |
|
FILE *debugfp = NULL; /* debug output picture */ |
| 126 |
|
char *progname; |
| 127 |
|
|
| 128 |
+ |
static void init(void); |
| 129 |
+ |
static int chartndx(int x, int y, int *np); |
| 130 |
+ |
static void getpicture(void); |
| 131 |
+ |
static void getcolors(void); |
| 132 |
+ |
static void bresp(COLOR y, COLOR x); |
| 133 |
+ |
static void compute(void); |
| 134 |
+ |
static void putmapping(void); |
| 135 |
+ |
static void compsoln(COLOR cin[], COLOR cout[], int n); |
| 136 |
+ |
static void cwarp(void); |
| 137 |
+ |
static int cvtcolor(COLOR cout, COLOR cin); |
| 138 |
+ |
static int cresp(COLOR cout, COLOR cin); |
| 139 |
+ |
static void xyY2RGB(COLOR rgbout, float xyYin[3]); |
| 140 |
+ |
static void picdebug(void); |
| 141 |
+ |
static void clrdebug(void); |
| 142 |
+ |
static void getpos(char *name, int bnds[2], FILE *fp); |
| 143 |
+ |
static void pickchartpos(char *pfn); |
| 144 |
|
|
| 145 |
< |
main(argc, argv) |
| 146 |
< |
int argc; |
| 147 |
< |
char **argv; |
| 145 |
> |
|
| 146 |
> |
int |
| 147 |
> |
main( |
| 148 |
> |
int argc, |
| 149 |
> |
char **argv |
| 150 |
> |
) |
| 151 |
|
{ |
| 152 |
|
int i; |
| 153 |
|
|
| 277 |
|
fprintf(stderr, " or: %s [-d dbg.pic][-i irrad][-m] -c [xyY.dat [output.{cal|cwp}]]\n", |
| 278 |
|
progname); |
| 279 |
|
exit(1); |
| 280 |
+ |
return 1; /* pro forma return */ |
| 281 |
|
} |
| 282 |
|
|
| 283 |
|
|
| 284 |
< |
init() /* initialize */ |
| 284 |
> |
static void |
| 285 |
> |
init(void) /* initialize */ |
| 286 |
|
{ |
| 287 |
|
double quad[4][2]; |
| 288 |
|
register int i; |
| 308 |
|
} |
| 309 |
|
|
| 310 |
|
|
| 311 |
< |
int |
| 312 |
< |
chartndx(x, y, np) /* find color number for position */ |
| 313 |
< |
int x, y; |
| 314 |
< |
int *np; |
| 311 |
> |
static int |
| 312 |
> |
chartndx( /* find color number for position */ |
| 313 |
> |
int x, |
| 314 |
> |
int y, |
| 315 |
> |
int *np |
| 316 |
> |
) |
| 317 |
|
{ |
| 318 |
|
double ipos[3], cpos[3]; |
| 319 |
|
int ix, iy; |
| 342 |
|
} |
| 343 |
|
|
| 344 |
|
|
| 345 |
< |
getpicture() /* load in picture colors */ |
| 345 |
> |
static void |
| 346 |
> |
getpicture(void) /* load in picture colors */ |
| 347 |
|
{ |
| 348 |
|
COLR *scanln; |
| 349 |
|
COLOR pval; |
| 385 |
|
} |
| 386 |
|
|
| 387 |
|
|
| 388 |
< |
getcolors() /* get xyY colors from standard input */ |
| 388 |
> |
static void |
| 389 |
> |
getcolors(void) /* get xyY colors from standard input */ |
| 390 |
|
{ |
| 391 |
|
int gotwhite = 0; |
| 392 |
|
COLOR whiteclr; |
| 434 |
|
} |
| 435 |
|
|
| 436 |
|
|
| 437 |
< |
bresp(y, x) /* piecewise linear interpolation of primaries */ |
| 438 |
< |
COLOR y, x; |
| 437 |
> |
static void |
| 438 |
> |
bresp( /* piecewise linear interpolation of primaries */ |
| 439 |
> |
COLOR y, |
| 440 |
> |
COLOR x |
| 441 |
> |
) |
| 442 |
|
{ |
| 443 |
|
register int i, n; |
| 444 |
|
|
| 455 |
|
} |
| 456 |
|
|
| 457 |
|
|
| 458 |
< |
compute() /* compute color mapping */ |
| 458 |
> |
static void |
| 459 |
> |
compute(void) /* compute color mapping */ |
| 460 |
|
{ |
| 461 |
|
COLOR clrin[24], clrout[24]; |
| 462 |
|
long cflags; |
| 514 |
|
} |
| 515 |
|
|
| 516 |
|
|
| 517 |
< |
putmapping() /* put out color mapping */ |
| 517 |
> |
static void |
| 518 |
> |
putmapping(void) /* put out color mapping */ |
| 519 |
|
{ |
| 520 |
|
static char cchar[3] = {'r', 'g', 'b'}; |
| 521 |
|
register int i, j; |
| 563 |
|
} |
| 564 |
|
|
| 565 |
|
|
| 566 |
< |
compsoln(cin, cout, n) /* solve 3xN system using least-squares */ |
| 567 |
< |
COLOR cin[], cout[]; |
| 568 |
< |
int n; |
| 566 |
> |
static void |
| 567 |
> |
compsoln( /* solve 3xN system using least-squares */ |
| 568 |
> |
COLOR cin[], |
| 569 |
> |
COLOR cout[], |
| 570 |
> |
int n |
| 571 |
> |
) |
| 572 |
|
{ |
| 573 |
|
extern double mx3d_adjoint(), fabs(); |
| 574 |
|
double mat[3][3], invmat[3][3]; |
| 626 |
|
} |
| 627 |
|
|
| 628 |
|
|
| 629 |
< |
cwarp() /* compute color warp map */ |
| 629 |
> |
static void |
| 630 |
> |
cwarp(void) /* compute color warp map */ |
| 631 |
|
{ |
| 632 |
|
register int i; |
| 633 |
|
|
| 643 |
|
} |
| 644 |
|
|
| 645 |
|
|
| 646 |
< |
int |
| 647 |
< |
cvtcolor(cout, cin) /* convert color according to our mapping */ |
| 648 |
< |
COLOR cout, cin; |
| 646 |
> |
static int |
| 647 |
> |
cvtcolor( /* convert color according to our mapping */ |
| 648 |
> |
COLOR cout, |
| 649 |
> |
COLOR cin |
| 650 |
> |
) |
| 651 |
|
{ |
| 652 |
|
COLOR ctmp; |
| 653 |
|
int clipped; |
| 666 |
|
} |
| 667 |
|
|
| 668 |
|
|
| 669 |
< |
int |
| 670 |
< |
cresp(cout, cin) /* transform color according to matrix */ |
| 671 |
< |
COLOR cout, cin; |
| 669 |
> |
static int |
| 670 |
> |
cresp( /* transform color according to matrix */ |
| 671 |
> |
COLOR cout, |
| 672 |
> |
COLOR cin |
| 673 |
> |
) |
| 674 |
|
{ |
| 675 |
|
colortrans(cout, solmat, cin); |
| 676 |
|
return(clipgamut(cout, bright(cout), CGAMUT, colmin, colmax)); |
| 677 |
|
} |
| 678 |
|
|
| 679 |
|
|
| 680 |
< |
xyY2RGB(rgbout, xyYin) /* convert xyY to RGB */ |
| 681 |
< |
COLOR rgbout; |
| 682 |
< |
register float xyYin[3]; |
| 680 |
> |
static void |
| 681 |
> |
xyY2RGB( /* convert xyY to RGB */ |
| 682 |
> |
COLOR rgbout, |
| 683 |
> |
register float xyYin[3] |
| 684 |
> |
) |
| 685 |
|
{ |
| 686 |
|
COLOR ctmp; |
| 687 |
|
double d; |
| 695 |
|
} |
| 696 |
|
|
| 697 |
|
|
| 698 |
< |
picdebug() /* put out debugging picture */ |
| 698 |
> |
static void |
| 699 |
> |
picdebug(void) /* put out debugging picture */ |
| 700 |
|
{ |
| 701 |
|
static COLOR blkcol = BLKCOLOR; |
| 702 |
|
COLOR *scan; |
| 752 |
|
} |
| 753 |
|
|
| 754 |
|
|
| 755 |
< |
clrdebug() /* put out debug picture from color input */ |
| 755 |
> |
static void |
| 756 |
> |
clrdebug(void) /* put out debug picture from color input */ |
| 757 |
|
{ |
| 758 |
|
static COLR blkclr = BLKCOLR; |
| 759 |
|
COLR mbclr[24], cvclr[24], orclr[24]; |
| 823 |
|
} |
| 824 |
|
|
| 825 |
|
|
| 826 |
< |
getpos(name, bnds, fp) /* get boundary position */ |
| 827 |
< |
char *name; |
| 828 |
< |
int bnds[2]; |
| 829 |
< |
FILE *fp; |
| 826 |
> |
static void |
| 827 |
> |
getpos( /* get boundary position */ |
| 828 |
> |
char *name, |
| 829 |
> |
int bnds[2], |
| 830 |
> |
FILE *fp |
| 831 |
> |
) |
| 832 |
|
{ |
| 833 |
|
char buf[64]; |
| 834 |
|
|
| 842 |
|
} |
| 843 |
|
|
| 844 |
|
|
| 845 |
< |
pickchartpos(pfn) /* display picture and pick chart location */ |
| 846 |
< |
char *pfn; |
| 845 |
> |
static void |
| 846 |
> |
pickchartpos( /* display picture and pick chart location */ |
| 847 |
> |
char *pfn |
| 848 |
> |
) |
| 849 |
|
{ |
| 850 |
|
char combuf[PATH_MAX]; |
| 851 |
|
FILE *pfp; |