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

Comparing ray/src/util/rcomb.c (file contents):
Revision 2.27 by greg, Sat Mar 1 01:37:49 2025 UTC vs.
Revision 2.34 by greg, Tue Aug 5 16:40:10 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 64 | Line 62 | int            inchild = -1;                   /* our child ID (-1: parent) */
62  
63   extern int      checksymbolic(ROPMAT *rop);
64  
65 + /* Split input matrices to allow for certain operations */
66   int
67   split_input(ROPMAT *rop)
68   {
# Line 196 | Line 195 | checksymbolic(ROPMAT *rop)
195          double          cf = 1;
196          int             i, j;
197                                          /* check suffix => reference file */
198 <        if (strchr(rop->preop.csym, '.') > rop->preop.csym)
198 >        if (strchr(rop->preop.csym, '.') != NULL)
199                  return(checkreffile(rop));
200  
201          if (nc < 3) {
# Line 302 | Line 301 | checksymbolic(ROPMAT *rop)
301          return(1);
302   }
303  
304 + /* Set up color transform for matrix */
305   int
306   get_component_xfm(ROPMAT *rop)
307   {
# Line 385 | Line 385 | get_component_xfm(ROPMAT *rop)
385          return(1);
386   }
387  
388 + /* Apply the given color transform and/or scaling operation */
389   int
390   apply_op(RMATRIX *dst, const RMATRIX *src, const RUNARYOP *ro)
391   {
# Line 404 | Line 405 | apply_op(RMATRIX *dst, const RMATRIX *src, const RUNAR
405          return(1);
406   }
407  
408 + /* Open the associated input file and load/check header */
409   int
410   open_input(ROPMAT *rop)
411   {
# Line 475 | Line 477 | l_chanin(char *nam)
477          return(mop[mi].rmp->mtx[cur_col*in_ncomp + chan]);
478   }
479  
480 + /* Set up our operations and check consistency */
481   int
482   initialize(RMATRIX *imp)
483   {
# Line 522 | Line 525 | initialize(RMATRIX *imp)
525          return(1);
526   }
527  
528 + /* Copy input header information to output header, indented */
529   void
530   output_headinfo(FILE *fp)
531   {
# Line 545 | Line 549 | output_headinfo(FILE *fp)
549          }
550   }
551  
552 + /* Spawn the indicated number of children and return 1 in parent */
553   int
554   spawned_children(int np)
555   {
# Line 652 | Line 657 | memerror:
657          exit(1);
658   }
659  
660 + /* Run parental feeder loop */
661   int
662   parent_loop(void)
663   {
# Line 701 | Line 707 | parent_loop(void)
707          return(1);                              /* return success! */
708   }
709  
710 + /* Main operation loop, may be run in each child */
711   int
712   combine_input(void)
713   {
# Line 796 | Line 803 | multerror:
803          return(0);
804   }
805  
806 + /* Run output process loop when #processes > 1 */
807   int
808   output_loop(void)
809   {
# Line 835 | Line 843 | output_loop(void)
843          return(fflush(stdout) != EOF);
844   }
845  
846 + /* Check/convert floating-point arguments following this */
847   int
848   get_factors(double da[], int n, char *av[])
849   {
# Line 845 | Line 854 | get_factors(double da[], int n, char *av[])
854          return(ac);
855   }
856  
857 + /* Resize/reallocate the input array as requested */
858   void
859   resize_inparr(int n2alloc)
860   {
# Line 878 | Line 888 | main(int argc, char *argv[])
888          int             stdin_used = 0;
889          int             nproc = 1;
890          const char      *mcat_spec = NULL;
891 +        int             transpose_mcat = 0;
892          int             n2comp = 0;
893          uby8            comp_ndx[128];
894          int             i;
# Line 972 | Line 983 | main(int argc, char *argv[])
983                                  mop[nmats].preop.csym = NULL;
984                                  break;
985                          case 'm':
975                                mcat_last = 1;
986                                  if (!n) goto userr;
987 +                                mcat_last = 1;
988 +                                transpose_mcat = (argv[i][2] == 't');
989                                  if (argv[++i][0] == '-' && !argv[i][1]) {
990                                          if (stdin_used++) goto stdin_error;
991                                          mcat_spec = stdin_name;
# Line 992 | Line 1004 | main(int argc, char *argv[])
1004          }
1005          resize_inparr(nmats+1);         /* extra matrix at end for result */
1006          mop[nmats].inspec = "trailing_ops";
1007 <                                        /* load final concatenation matrix */
1008 <        if (mcat_spec && !(mcat = rmx_load(mcat_spec, RMPnone))) {
1009 <                fprintf(stderr, "%s: error loading concatenation matrix: %s\n",
1010 <                                argv[0], mcat_spec);
1011 <                return(1);
1007 >
1008 >        if (mcat_spec) {                /* load final concatenation matrix? */
1009 >                mcat = rmx_load(mcat_spec);
1010 >                if (!mcat) {
1011 >                        fprintf(stderr, "%s: error loading concatenation matrix: %s\n",
1012 >                                        argv[0], mcat_spec);
1013 >                        return(1);
1014 >                }
1015 >                if (transpose_mcat && !rmx_transpose(mcat)) {
1016 >                        fprintf(stderr, "%s: error transposing concatenation matrix: %s\n",
1017 >                                        argv[0], mcat_spec);
1018 >                        return(1);
1019 >                }
1020          }
1021                                          /* get/check inputs, set constants */
1022          if (!initialize(&mop[nmats].imx))
# Line 1036 | Line 1056 | main(int argc, char *argv[])
1056                          return(1);
1057                  mop[nmats].rmp->ncols = mcat->ncols;
1058          }
1059 + #if DTrmx_native==DTfloat
1060 +        if (outfmt == DTdouble)
1061 +                fprintf(stderr, "%s: warning - writing float result as double\n", argv[0]);
1062 + #endif
1063          newheader("RADIANCE", stdout);  /* write output header */
1064          if (echoheader)
1065                  output_headinfo(stdout);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)