| 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 */ |
| 194 |
|
double cf = 1; |
| 195 |
|
int i, j; |
| 196 |
|
/* check suffix => reference file */ |
| 197 |
< |
if (strchr(rop->preop.csym, '.') > rop->preop.csym) |
| 197 |
> |
if (strchr(rop->preop.csym, '.') != NULL) |
| 198 |
|
return(checkreffile(rop)); |
| 199 |
|
|
| 200 |
|
if (nc < 3) { |
| 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); |
| 876 |
|
int stdin_used = 0; |
| 877 |
|
int nproc = 1; |
| 878 |
|
const char *mcat_spec = NULL; |
| 879 |
+ |
int transpose_mcat = 0; |
| 880 |
|
int n2comp = 0; |
| 881 |
|
uby8 comp_ndx[128]; |
| 882 |
|
int i; |
| 971 |
|
mop[nmats].preop.csym = NULL; |
| 972 |
|
break; |
| 973 |
|
case 'm': |
| 975 |
– |
mcat_last = 1; |
| 974 |
|
if (!n) goto userr; |
| 975 |
+ |
mcat_last = 1; |
| 976 |
+ |
transpose_mcat = (argv[i][2] == 't'); |
| 977 |
|
if (argv[++i][0] == '-' && !argv[i][1]) { |
| 978 |
|
if (stdin_used++) goto stdin_error; |
| 979 |
|
mcat_spec = stdin_name; |
| 992 |
|
} |
| 993 |
|
resize_inparr(nmats+1); /* extra matrix at end for result */ |
| 994 |
|
mop[nmats].inspec = "trailing_ops"; |
| 995 |
< |
/* load final concatenation matrix */ |
| 996 |
< |
if (mcat_spec && !(mcat = rmx_load(mcat_spec, RMPnone))) { |
| 997 |
< |
fprintf(stderr, "%s: error loading concatenation matrix: %s\n", |
| 998 |
< |
argv[0], mcat_spec); |
| 999 |
< |
return(1); |
| 995 |
> |
|
| 996 |
> |
if (mcat_spec) { /* load final concatenation matrix? */ |
| 997 |
> |
mcat = rmx_load(mcat_spec); |
| 998 |
> |
if (!mcat) { |
| 999 |
> |
fprintf(stderr, "%s: error loading concatenation matrix: %s\n", |
| 1000 |
> |
argv[0], mcat_spec); |
| 1001 |
> |
return(1); |
| 1002 |
> |
} |
| 1003 |
> |
if (transpose_mcat && !rmx_transpose(mcat)) { |
| 1004 |
> |
fprintf(stderr, "%s: error transposing concatenation matrix: %s\n", |
| 1005 |
> |
argv[0], mcat_spec); |
| 1006 |
> |
return(1); |
| 1007 |
> |
} |
| 1008 |
|
} |
| 1009 |
|
/* get/check inputs, set constants */ |
| 1010 |
|
if (!initialize(&mop[nmats].imx)) |
| 1044 |
|
return(1); |
| 1045 |
|
mop[nmats].rmp->ncols = mcat->ncols; |
| 1046 |
|
} |
| 1047 |
+ |
#if DTrmx_native==DTfloat |
| 1048 |
+ |
if (outfmt == DTdouble) |
| 1049 |
+ |
fprintf(stderr, "%s: warning - writing float result as double\n", argv[0]); |
| 1050 |
+ |
#endif |
| 1051 |
|
newheader("RADIANCE", stdout); /* write output header */ |
| 1052 |
|
if (echoheader) |
| 1053 |
|
output_headinfo(stdout); |