21 |
|
#define M_PI 3.14159265358979323846 |
22 |
|
#endif |
23 |
|
|
24 |
– |
#define MAXCOMP MAXCSAMP /* #components we support */ |
25 |
– |
|
24 |
|
/* Unary matrix operation(s) */ |
25 |
|
typedef struct { |
26 |
|
double cmat[MAXCOMP*MAXCOMP]; /* component transformation */ |
172 |
|
|
173 |
|
/* Use the spectral sensitivity function to compute matrix coefficients */ |
174 |
|
void |
175 |
< |
sensrow(ROPMAT *rop, int r, double (*sf)(SCOLOR sc, int ncs, const float wlpt[4])) |
175 |
> |
sensrow(ROPMAT *rop, int r, double (*sf)(const SCOLOR sc, int ncs, const float wlpt[4])) |
176 |
|
{ |
177 |
|
const int nc = rop->imx.ncomp; |
178 |
|
int i; |
671 |
|
if (!rmx_load_row(mop[i].imx.mtx, &mop[i].imx, mop[i].infp)) { |
672 |
|
if (cur_row > in_nrows) /* unknown #input rows? */ |
673 |
|
break; |
674 |
< |
fprintf(stderr, "%s: parent_loop() load error at row %d\n", |
674 |
> |
fprintf(stderr, "%s: load error at row %d\n", |
675 |
|
mop[i].inspec, cur_row); |
676 |
|
return(0); |
677 |
|
} |
680 |
|
for (i = 0; i < nmats; i++) |
681 |
|
if (writebuf(wfd, mop[i].imx.mtx, rmx_array_size(&mop[i].imx)) |
682 |
|
!= rmx_array_size(&mop[i].imx)) { |
683 |
< |
fprintf(stderr, "%s: parent_loop() write error at row %d\n", |
683 |
> |
fprintf(stderr, "%s: write error at row %d\n", |
684 |
|
mop[i].inspec, cur_row); |
685 |
|
return(0); |
686 |
|
} |
689 |
|
free(cproc); cproc = NULL; nchildren = 0; |
690 |
|
if (i < 0) { |
691 |
|
if (!nowarn) |
692 |
< |
fputs("Warning: lost child in parent_loop()\n", stderr); |
692 |
> |
fputs("Warning: lost child process\n", stderr); |
693 |
|
return(1); |
694 |
|
} |
695 |
|
if (i > 0) { |
735 |
|
if (!rmx_load_row(mop[i].imx.mtx, &mop[i].imx, mop[i].infp)) { |
736 |
|
if (cur_row > in_nrows) /* unknown #input rows? */ |
737 |
|
break; |
738 |
< |
fprintf(stderr, "%s: combine_input() load error at row %d\n", |
738 |
> |
fprintf(stderr, "%s: load error at row %d\n", |
739 |
|
mop[i].inspec, cur_row); |
740 |
|
return(0); |
741 |
|
} |
783 |
|
if (!rmx_write_data(res->rmp->mtx, res->rmp->ncomp, |
784 |
|
res->rmp->ncols, res->rmp->dtype, stdout) || |
785 |
|
(inchild >= 0 && fflush(stdout) == EOF)) { |
786 |
< |
fprintf(stderr, "Conversion/write error at row %d in combine_input()\n", |
786 |
> |
fprintf(stderr, "Conversion/write error at row %d\n", |
787 |
|
cur_row); |
788 |
|
return(0); |
789 |
|
} |
790 |
|
} |
791 |
|
return(inchild >= 0 || fflush(stdout) != EOF); |
792 |
|
multerror: |
793 |
< |
fputs("Unexpected matrix multiply error in combine_input()\n", stderr); |
793 |
> |
fputs("Unexpected matrix multiply error\n", stderr); |
794 |
|
return(0); |
795 |
|
} |
796 |
|
|
819 |
|
if (!rv) /* out of rows? */ |
820 |
|
break; |
821 |
|
if (rv != row_size) { |
822 |
< |
fputs("Read error in output_loop()\n", stderr); |
822 |
> |
fputs("Read error\n", stderr); |
823 |
|
return(0); |
824 |
|
} /* do final conversion */ |
825 |
|
if (!rmx_write_data(mop[nmats].rmp->mtx, mop[nmats].rmp->ncomp, |
826 |
|
mop[nmats].rmp->ncols, mop[nmats].rmp->dtype, stdout)) { |
827 |
< |
fputs("Conversion/write error in output_loop()\n", stderr); |
827 |
> |
fputs("Conversion/write error\n", stderr); |
828 |
|
return(0); |
829 |
|
} |
830 |
|
cur_child++; |
850 |
|
|
851 |
|
if (n2alloc == nall) |
852 |
|
return; |
853 |
< |
for (i = nall; i > n2alloc; i--) { |
853 |
> |
for (i = nall; i-- > n2alloc; ) { |
854 |
|
rmx_reset(&mop[i].imx); |
855 |
|
if (mop[i].rmp != &mop[i].imx) |
856 |
|
rmx_free(mop[i].rmp); |