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

Comparing ray/src/util/rmtxop.c (file contents):
Revision 2.31 by greg, Tue Dec 19 00:39:03 2023 UTC vs.
Revision 2.35 by greg, Fri Nov 8 17:52:26 2024 UTC

# Line 7 | Line 7 | static const char RCSid[] = "$Id$";
7  
8   #include <errno.h>
9   #include "rtio.h"
10 #include "resolu.h"
10   #include "rmatrix.h"
11   #include "platform.h"
12  
# Line 35 | Line 34 | typedef struct {
34   int     verbose = 0;                    /* verbose reporting? */
35  
36   /* Load matrix */
37 < static int
37 > int
38   loadmatrix(ROPMAT *rop)
39   {
40          if (rop->mtx != NULL)           /* already loaded? */
# Line 46 | Line 45 | loadmatrix(ROPMAT *rop)
45          return(!rop->mtx ? -1 : 1);
46   }
47  
48 < static int      checksymbolic(ROPMAT *rop);
48 > extern int      checksymbolic(ROPMAT *rop);
49  
50   /* Check/set transform based on a reference input file */
51 < static int
51 > int
52   checkreffile(ROPMAT *rop)
53   {
54          static const char       *curRF = NULL;
# Line 108 | Line 107 | checkreffile(ROPMAT *rop)
107   }
108  
109   /* Compute conversion row from spectrum to one channel of RGB */
110 < static void
110 > void
111   rgbrow(ROPMAT *rop, int r, int p)
112   {
113          const int       nc = rop->mtx->ncomp;
# Line 125 | Line 124 | rgbrow(ROPMAT *rop, int r, int p)
124   }
125  
126   /* Compute conversion row from spectrum to one channel of XYZ */
127 < static void
127 > void
128   xyzrow(ROPMAT *rop, int r, int p)
129   {
130          const int       nc = rop->mtx->ncomp;
# Line 142 | Line 141 | xyzrow(ROPMAT *rop, int r, int p)
141   }
142  
143   /* Use the spectral sensitivity function to compute matrix coefficients */
144 < static void
145 < sensrow(ROPMAT *rop, int r, double (*sf)(SCOLOR sc, int ncs, const float wlpt[4]))
144 > void
145 > sensrow(ROPMAT *rop, int r, double (*sf)(const SCOLOR sc, int ncs, const float wlpt[4]))
146   {
147          const int       nc = rop->mtx->ncomp;
148          int             i;
# Line 157 | Line 156 | sensrow(ROPMAT *rop, int r, double (*sf)(SCOLOR sc, in
156   }
157  
158   /* Check/set symbolic transform */
159 < static int
159 > int
160   checksymbolic(ROPMAT *rop)
161   {
162          const int       nc = rop->mtx->ncomp;
# Line 256 | Line 255 | checksymbolic(ROPMAT *rop)
255                  }
256          }
257                                          /* return recommended output type */
258 <        if (!strcmp(rop->preop.csym, "XYZ")) {
258 >        if (!strcasecmp(rop->preop.csym, "XYZ")) {
259                  if (dt <= DTspec)
260                          return(DTxyze);
261 <        } else if (!strcmp(rop->preop.csym, "RGB")) {
261 >        } else if (!strcasecmp(rop->preop.csym, "RGB")) {
262                  if (dt <= DTspec)
263                          return(DTrgbe);
264          } else if (dt == DTspec)
# Line 268 | Line 267 | checksymbolic(ROPMAT *rop)
267   }
268  
269   /* Get matrix and perform unary operations */
270 < static RMATRIX *
270 > RMATRIX *
271   loadop(ROPMAT *rop)
272   {
273          int     outtype = 0;
# Line 368 | Line 367 | failure:
367   }
368  
369   /* Execute binary operation, free matrix arguments and return new result */
370 < static RMATRIX *
370 > RMATRIX *
371   binaryop(const char *inspec, RMATRIX *mleft, int op, RMATRIX *mright)
372   {
373          RMATRIX *mres = NULL;
# Line 445 | Line 444 | binaryop(const char *inspec, RMATRIX *mleft, int op, R
444   }
445  
446   /* Perform matrix operations from left to right */
447 < static RMATRIX *
447 > RMATRIX *
448   op_left2right(ROPMAT *mop)
449   {
450          RMATRIX *mleft = loadop(mop);
# Line 461 | Line 460 | op_left2right(ROPMAT *mop)
460   }
461  
462   /* Perform matrix operations from right to left */
463 < static RMATRIX *
463 > RMATRIX *
464   op_right2left(ROPMAT *mop)
465   {
466          RMATRIX *mright;
# Line 490 | Line 489 | op_right2left(ROPMAT *mop)
489                                                  : (mop)->mtx->ncols)
490  
491   /* Should we prefer concatenating from rightmost matrix towards left? */
492 < static int
492 > int
493   prefer_right2left(ROPMAT *mop)
494   {
495          int     mri = 0;
# Line 517 | Line 516 | prefer_right2left(ROPMAT *mop)
516          return(t_ncols(mop+mri) < t_nrows(mop));
517   }
518  
519 < static int
519 > int
520   get_factors(double da[], int n, char *av[])
521   {
522          int     ac;
# Line 527 | Line 526 | get_factors(double da[], int n, char *av[])
526          return(ac);
527   }
528  
529 < static ROPMAT *
529 > ROPMAT *
530   resize_moparr(ROPMAT *mop, int n2alloc)
531   {
532          int     nmats = 0;
# Line 535 | Line 534 | resize_moparr(ROPMAT *mop, int n2alloc)
534  
535          while (mop[nmats++].binop)
536                  ;
537 <        for (i = nmats; i > n2alloc; i--)
537 >        for (i = nmats; i >= n2alloc; i--)
538                  rmx_free(mop[i].mtx);
539          mop = (ROPMAT *)realloc(mop, n2alloc*sizeof(ROPMAT));
540          if (mop == NULL) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines