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

Comparing ray/src/util/rmtxcomb.c (file contents):
Revision 2.2 by greg, Tue Dec 5 20:05:36 2023 UTC vs.
Revision 2.5 by greg, Fri Dec 8 00:12:31 2023 UTC

# Line 89 | Line 89 | checkreffile(ROPMAT *rop)
89                  fclose(fp);
90                  curRF = rop->preop.csym;
91          }
92 <        if ((refm.ncomp == 3) & (refm.dtype != DTspec)) {
92 >        if (refm.ncomp == 3) {
93                  rop->preop.csym = (refm.dtype == DTxyze) ? "XYZ" : "RGB";
94                  return(checksymbolic(rop));
95          }
# Line 343 | Line 343 | get_component_xfm(ROPMAT *rop)
343                  if (!split_input(rop))          /* get our own struct */
344                          return(0);
345                  rop->rmp->ncomp = rop->preop.clen / rop->imx.ncomp;
346 <                if ((rop->rmp->ncomp > 3) & (rop->rmp->dtype <= DTspec))
346 >                if ((rop->rmp->ncomp > 3) & (rop->rmp->dtype <= DTspec)) {
347                          rop->rmp->dtype = DTfloat;      /* probably not actual spectrum */
348 +                        memcpy(rop->rmp->wlpart, WLPART, sizeof(rop->rmp->wlpart));
349 +                }
350          } else if (rop->preop.nsf > 0) {        /* else use scalar(s)? */
351                  if (rop->preop.nsf == 1) {
352                          for (i = rop->rmp->ncomp; --i; )
# Line 362 | Line 364 | get_component_xfm(ROPMAT *rop)
364   static int
365   apply_op(RMATRIX *dst, const RMATRIX *src, const RUNARYOP *ro)
366   {
365 /*
366        if (!dst | !src | !ro || (dst->nrows != src->nrows) |
367                        (dst->ncols != src->ncols))
368                return(0);
369 */
367          if (ro->clen > 0) {
368                  RMATRIX *res = rmx_transform(src, dst->ncomp, ro->cmat);
369                  if (!res) {
370                          fputs("Error in call to rmx_transform()\n", stderr);
371                          return(0);
372                  }
373 <                if (dst->mtx) free(dst->mtx);
374 <                dst->mtx = res->mtx; res->mtx = NULL;
373 >                if (!rmx_transfer_data(dst, res, 0))
374 >                        return(0);
375                  rmx_free(res);
376          } else if (dst != src)
377                  memcpy(dst->mtx, src->mtx,
# Line 552 | Line 549 | combine_input(ROPMAT *res, FILE *fout)
549                          goto memerror;
550          }
551          if (mcat && mcat_last &&
552 <                        !(tmp = rmx_new(1, res->imx.ncols, res->rmp->ncomp)))
552 >                        !(tmp = rmx_alloc(1, res->imx.ncols, res->rmp->ncomp)))
553                  goto memerror;
554          res->imx.nrows = 1;
555          if (!rmx_prepare(&res->imx))
# Line 609 | Line 606 | combine_input(ROPMAT *res, FILE *fout)
606                  mres = rmx_multiply(tmp, mcat);
607                  if (!mres)
608                          goto multerror;
609 <                if (res->rmp->mtx) free(res->rmp->mtx);
610 <                res->rmp->mtx = mres->mtx; mres->mtx = NULL;
609 >                if (!rmx_transfer_data(res->rmp, mres, 0))
610 >                        return(0);
611              } else /* mcat && !mcat_last */ {
612                  mres = rmx_multiply(&res->imx, mcat);
613                  if (!mres)
# Line 797 | Line 794 | main(int argc, char *argv[])
794          mop[nmats].inspec = "trailing_ops";
795                                          /* load final concatenation matrix */
796          if (mcat_spec && !(mcat = rmx_load(mcat_spec, RMPnone))) {
797 <                fprintf(stderr, "%s: error loading concatenation matrix: %s",
797 >                fprintf(stderr, "%s: error loading concatenation matrix: %s\n",
798                                  argv[0], mcat_spec);
799                  return(1);
800          }
# Line 835 | Line 832 | main(int argc, char *argv[])
832                                          argv[0], mcat_spec);
833                          return(1);
834                  }
835 +                if (!split_input(&mop[nmats]))
836 +                        return(1);
837                  mop[nmats].rmp->ncols = mcat->ncols;
838          }
839          newheader("RADIANCE", stdout);  /* write output header */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines