ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rcomb.c
(Generate patch)

Comparing ray/src/util/rcomb.c (file contents):
Revision 2.25 by greg, Wed Aug 21 01:09:25 2024 UTC vs.
Revision 2.32 by greg, Thu Jun 19 22:36:53 2025 UTC

# Line 21 | Line 21 | static const char RCSid[] = "$Id$";
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 */
# Line 673 | Line 671 | parent_loop(void)
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                  }
# Line 682 | Line 680 | parent_loop(void)
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                  }
# Line 691 | Line 689 | parent_loop(void)
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) {
# Line 737 | Line 735 | combine_input(void)
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                  }
# Line 785 | Line 783 | combine_input(void)
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  
# Line 821 | Line 819 | output_loop(void)
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++;
# Line 852 | Line 850 | resize_inparr(int n2alloc)
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);
# Line 878 | Line 876 | main(int argc, char *argv[])
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;
# Line 972 | Line 971 | main(int argc, char *argv[])
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;
# Line 992 | Line 992 | main(int argc, char *argv[])
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))
# Line 1036 | Line 1044 | main(int argc, char *argv[])
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines