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

Comparing ray/src/px/ra_rgbe.c (file contents):
Revision 2.22 by greg, Tue Jun 11 17:24:01 2024 UTC vs.
Revision 2.24 by greg, Tue Apr 22 04:45:25 2025 UTC

# Line 109 | Line 109 | transfer(                      /* transfer a Radiance picture */
109          if (findframe && findframe < frameno)
110                  return(0);
111                                          /* allocate scanline */
112 <        scanin = (COLR *)tempbuffer(xmax*sizeof(COLR));
112 >        scanin = (COLR *)malloc(xmax*sizeof(COLR));
113          if (scanin == NULL) {
114                  perror(progname);
115                  exit(1);
116          }
117                                          /* skip frame? */
118          if (findframe > frameno) {
119 <                for (y = ymax; y--; )
119 >                if (NCSAMP > 3) {
120 >                        if (fseek(stdin, ymax*xmax*LSCOLR, SEEK_CUR) < 0) {
121 >                                perror(progname);
122 >                                exit(1);
123 >                        }
124 >                } else
125 >                    for (y = ymax; y--; )
126                          if (freadcolrs(scanin, xmax, stdin) < 0) {
127                                  fprintf(stderr,
128                                          "%s: error reading input picture\n",
129                                                  progname);
130                                  exit(1);
131                          }
132 +                free(scanin);
133                  return(1);
134          }
135                                          /* open output file/command */
# Line 170 | Line 177 | transfer(                      /* transfer a Radiance picture */
177          fputresolu(order, xmax, ymax, fp);
178                                          /* transfer picture */
179          for (y = ymax; y--; ) {
180 <                if (freadcolrs(scanin, xmax, stdin) < 0) {
180 >                if (fread2colrs(scanin, xmax, stdin, NCSAMP, WLPART) < 0) {
181                          fprintf(stderr, "%s: error reading input picture\n",
182                                          progname);
183                          exit(1);
# Line 181 | Line 188 | transfer(                      /* transfer a Radiance picture */
188                                  (fwritecolrs(scanin, xmax, fp) < 0))
189                          goto writerr;
190          }
191 <        if (fflush(fp) == EOF)          /* clean up */
191 >        free(scanin);                   /* clean up */
192 >        if (fflush(fp) == EOF)
193                  goto writerr;
194 <        if (oname[0] == '!')
195 <                pclose(fp);
196 <        else if (ospec != NULL)
194 >        if (oname[0] == '!') {
195 >                if (pclose(fp) != 0) {
196 >                        fprintf(stderr, "%s: bad status from \"%s\"\n",
197 >                                        progname, oname);
198 >                        exit(1);
199 >                }
200 >        } else if (ospec != NULL)
201                  fclose(fp);
202          return(1);
203   writerr:
# Line 210 | Line 222 | addhline(                      /* add a line to our info. header */
222                  return(0);
223          }
224          if (formatval(fmt, s)) {
225 <                fmterr += !globmatch(PICFMT, fmt);
225 >                if (!strcmp(fmt, SPECFMT))
226 >                        strcpy(fmt, COLRFMT);
227 >                else
228 >                        fmterr += !globmatch(PICFMT, fmt);
229 >                return(0);
230 >        }
231 >        if (isncomp(s)) {
232 >                NCSAMP = ncompval(s);
233 >                return(NCSAMP - 3);
234 >        }
235 >        if (iswlsplit(s)) {
236 >                wlsplitval(WLPART, s);
237                  return(0);
238          }
239          n = strlen(s);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines