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

Comparing ray/src/px/ra_gif.c (file contents):
Revision 2.3 by greg, Fri May 20 11:44:19 1994 UTC vs.
Revision 2.4 by greg, Fri Jun 10 12:51:27 1994 UTC

# Line 33 | Line 33 | extern long  ftell();
33  
34   long  picstart;
35  
36 < extern BYTE  clrtab[][3];
36 > BYTE  clrtab[256][3];
37  
38 + extern int  samplefac;
39 +
40   extern int  getgifpix();
41  
42   COLR    *scanln;
# Line 67 | Line 69 | char  *argv[];
69          setmode(fileno(stdout), O_BINARY);
70   #endif
71          progname = argv[0];
72 +        samplefac = 0;
73  
74          for (i = 1; i < argc; i++)
75                  if (argv[i][0] == '-')
# Line 88 | Line 91 | char  *argv[];
91                                          goto userr;
92                                  bradj = atoi(argv[++i]);
93                                  break;
94 +                        case 'n':
95 +                                samplefac = atoi(argv[++i]);
96 +                                break;
97                          default:
98                                  goto userr;
99                          }
# Line 162 | Line 168 | int  y;
168                  shiftcolrs(scanln, xmax, bradj);
169          colrs_gambs(scanln, xmax);
170          if (pixscan != NULL)
171 <                dith_colrs(pixscan, scanln, xmax);
171 >                if (samplefac)
172 >                        neu_dith_colrs(pixscan, scanln, xmax);
173 >                else
174 >                        dith_colrs(pixscan, scanln, xmax);
175   }
176  
177  
# Line 171 | Line 180 | int    nc;
180   {
181          register int    i;
182  
183 <        new_histo();
183 >        if ((samplefac ? neu_init(xmax*ymax) : new_histo(xmax*ymax)) == -1)
184 >                goto memerr;
185          for (i = 0; i < ymax; i++) {
186                  getrow(i);
187 <                cnt_colrs(scanln, xmax);
187 >                if (samplefac)
188 >                        neu_colrs(scanln, xmax);
189 >                else
190 >                        cnt_colrs(scanln, xmax);
191          }
192 <        new_clrtab(nc);
192 >        if (samplefac)
193 >                neu_clrtab(nc);
194 >        else
195 >                new_clrtab(nc);
196          for (i = 0; i < nc; i++) {
197                  rmap[i] = clrtab[i][RED];
198                  gmap[i] = clrtab[i][GRN];
199                  bmap[i] = clrtab[i][BLU];
200          }
201 <        if (dither && (pixscan = (BYTE *)malloc(xmax)) == NULL) {
202 <                fprintf(stderr, "%s: out of memory\n", progname);
203 <                exit(1);
204 <        }
201 >        if (dither && (pixscan = (BYTE *)malloc(xmax)) == NULL)
202 >                goto memerr;
203 >        return;
204 > memerr:
205 >        fprintf(stderr, "%s: out of memory\n", progname);
206 >        exit(1);
207   }
208  
209  
# Line 213 | Line 231 | int  x, y;
231                  return(normbright(scanln[x]));
232          if (pixscan != NULL)
233                  return(pixscan[x]);
234 <        return(map_pixel(scanln[x]));
234 >        return(samplefac ? neu_map_pixel(scanln[x]) : map_pixel(scanln[x]));
235   }
236  
237  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines