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.22 by greg, Mon Nov 27 22:04:45 2023 UTC vs.
Revision 2.25 by greg, Wed Nov 29 18:57:10 2023 UTC

# Line 44 | Line 44 | loadmatrix(ROPMAT *rop)
44                  return(0);
45  
46          rop->mtx = rmx_load(rop->inspec, rop->rmp);
47 <        if (rop->mtx == NULL) {
48 <                fputs(rop->inspec, stderr);
49 <                fputs(": cannot load matrix\n", stderr);
50 <                return(-1);
51 <        }
52 <        return(1);
47 >
48 >        return(!rop->mtx ? -1 : 1);
49   }
50  
51   /* Compute conversion row from spectrum to one channel of RGB */
# Line 96 | Line 92 | sensrow(ROPMAT *rop, int r, double (*sf)(SCOLOR sc, in
92          for (i = nc; i--; ) {
93                  SCOLOR  sclr;
94                  scolorblack(sclr);
95 <                sclr[i] = 1;
95 >                sclr[i] = 1.f;
96                  rop->preop.cmat[r*nc+i] = (*sf)(sclr, nc, rop->mtx->wlpart);
97          }
98   }
# Line 160 | Line 156 | checksymbolic(ROPMAT *rop)
156                          for (i = nc*(dt != DTxyze); i--; )
157                                  rop->preop.cmat[j*nc+i] *= WHTEFFICACY;
158                          break;
159 <                case 'S':
159 >                case 'S':               /* scotopic (il)luminance */
160                          sensrow(rop, j, scolor2scotopic);
161                          for (i = nc; i--; )
162                                  rop->preop.cmat[j*nc+i] *= WHTSCOTOPIC;
163                          break;
164 <                case 'M':
164 >                case 'M':               /* melanopic (il)luminance */
165                          sensrow(rop, j, scolor2melanopic);
166                          for (i = nc; i--; )
167                                  rop->preop.cmat[j*nc+i] *= WHTMELANOPIC;
168                          break;
169 +                case 'A':               /* average component */
170 +                        for (i = nc; i--; )
171 +                                rop->preop.cmat[j*nc+i] = 1./(double)nc;
172 +                        break;
173                  default:
174                          fprintf(stderr, "%s: -c '%c' unsupported\n",
175                                  rop->inspec, rop->preop.csym[j]);
# Line 605 | Line 605 | main(int argc, char *argv[])
605                  SET_FILE_BINARY(stdout);
606          newheader("RADIANCE", stdout);
607          printargs(argc, argv, stdout);
608 <        if (!rmx_write(mres, outfmt, stdout)) {
609 <                fprintf(stderr, "%s: error writing result matrix\n", argv[0]);
610 <                return(1);
611 <        }
612 <        /* rmx_free(mres); free(mop); */
613 <        return(0);
608 >
609 >        return(rmx_write(mres, outfmt, stdout) ? 0 : 1);
610   userr:
611          fprintf(stderr,
612          "Usage: %s [-v][-f[adfc][-t][-s sf .. | -c ce ..][-rf|-rb] m1 [.+*/] .. > mres\n",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines