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

Comparing ray/src/px/ra_xyze.c (file contents):
Revision 2.14 by greg, Tue Oct 1 01:16:26 2024 UTC vs.
Revision 2.15 by greg, Tue Oct 1 20:04:44 2024 UTC

# Line 134 | Line 134 | main(int  argc, char  *argv[])
134          getheader(stdin, headline, NULL);
135          if (infmt == InpUNK)
136                  quiterr("unrecognized/missing input file format");
137 +        if (infmt == InpSPEC ? (NCSAMP <= 3) | (NCSAMP > MAXCSAMP) :
138 +                        NCSAMP != 3)
139 +                quiterr("bad number of color components");
140          printargs(argc, argv, stdout);          /* add to header */
141          convert();                              /* convert picture */
142          exit(0);
# Line 161 | Line 164 | static void
164   myreadscan(COLOR *scn, int len)
165   {
166          if (infmt == InpSPEC) {         /* read & convert to XYZ */
167 <                SCOLR   sclr;
168 <                SCOLOR  scol;
167 >                static COLOR    *scomp = NULL;
168 >                SCOLR           sclr;
169 >                SCOLOR          scol;
170 >                COLOR           xyz;
171 >                int             n;
172 >                if (scomp == NULL) {    /* initialize conversion */
173 >                        scomp = (COLOR *)malloc(sizeof(COLOR)*NCSAMP);
174 >                        if (scomp == NULL)
175 >                                quiterr("out of memory in myreadscan");
176 >                        for (n = NCSAMP; n--; )
177 >                                spec_cie(scomp[n],
178 >                                        WLPART[0] + (WLPART[3] - WLPART[0])*(n+1)/NCSAMP,
179 >                                        WLPART[0] + (WLPART[3] - WLPART[0])*n/NCSAMP);
180 >                }
181                  while (len-- > 0) {
182                          if (getbinary(sclr, LSCOLR, 1, stdin) != 1)
183                                  goto readerr;
184                          scolr_scolor(scol, sclr);
185 <                        scolor_cie(*scn++, scol);
185 >                        setcolor(*scn, 0, 0, 0);
186 >                        for (n = NCSAMP; n--; ) {
187 >                                copycolor(xyz, scomp[n]);
188 >                                scalecolor(xyz, scol[n]);
189 >                                addcolor(*scn, xyz);
190 >                        }
191 >                        scn++;
192                  }
193                  return;
194          }                               /* else read as RGBE/XYZE */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines