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.26 by greg, Sat Jun 7 05:09:46 2025 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines