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

Comparing ray/src/px/ra_t8.c (file contents):
Revision 2.6 by greg, Sun Feb 27 10:17:23 1994 UTC vs.
Revision 2.7 by greg, Fri Jun 10 12:51:18 1994 UTC

# Line 38 | Line 38 | extern char  *memcpy();
38  
39   #define  taralloc(h)    (BYTE *)emalloc((h)->x*(h)->y)
40  
41 < extern BYTE  clrtab[][3];
41 > BYTE  clrtab[256][3];
42  
43 + extern int      samplefac;
44 +
45   extern char     *ecalloc(), *emalloc();
46  
47   extern long  ftell();
# Line 76 | Line 78 | char  *argv[];
78          setmode(fileno(stdout), O_BINARY);
79   #endif
80          progname = argv[0];
81 +        samplefac = 0;
82  
83          for (i = 1; i < argc; i++)
84                  if (argv[i][0] == '-')
# Line 100 | Line 103 | char  *argv[];
103                          case 'c':
104                                  ncolors = atoi(argv[++i]);
105                                  break;
106 +                        case 'n':
107 +                                samplefac = atoi(argv[++i]);
108 +                                break;
109                          default:
110                                  goto userr;
111                          }
# Line 352 | Line 358 | int  dith;             /* use dithering? */
358  
359          setcolrgam(gamv);
360          fpos = ftell(stdin);
361 <        new_histo();                    /* build histogram */
361 >        if ((samplefac ? neu_init(xmax*ymax) : new_histo(xmax*ymax)) == -1)
362 >                quiterr("cannot initialized histogram");
363          for (y = ymax-1; y >= 0; y--) {
364                  if (freadcolrs(inl, xmax, stdin) < 0)
365                          quiterr("error reading Radiance input");
366                  if (bradj)
367                          shiftcolrs(inl, xmax, bradj);
368                  colrs_gambs(inl, xmax);
369 <                cnt_colrs(inl, xmax);
369 >                if (samplefac)
370 >                        neu_colrs(inl, xmax);
371 >                else
372 >                        cnt_colrs(inl, xmax);
373          }
374          if (fseek(stdin, fpos, 0) == EOF)
375                  quiterr("Radiance input must be from a file");
376 <        new_clrtab(nc);                 /* map colors */
376 >        if (samplefac)                  /* map colors */
377 >                neu_clrtab(nc);
378 >        else
379 >                new_clrtab(nc);
380          for (y = ymax-1; y >= 0; y--) {
381                  if (freadcolrs(inl, xmax, stdin) < 0)
382                          quiterr("error reading Radiance input");
383                  if (bradj)
384                          shiftcolrs(inl, xmax, bradj);
385                  colrs_gambs(inl, xmax);
386 <                if (dith)
387 <                        dith_colrs(tarData+y*xmax, inl, xmax);
386 >                if (samplefac)
387 >                        if (dith)
388 >                                neu_dith_colrs(tarData+y*xmax, inl, xmax);
389 >                        else
390 >                                neu_map_colrs(tarData+y*xmax, inl, xmax);
391                  else
392 <                        map_colrs(tarData+y*xmax, inl, xmax);
392 >                        if (dith)
393 >                                dith_colrs(tarData+y*xmax, inl, xmax);
394 >                        else
395 >                                map_colrs(tarData+y*xmax, inl, xmax);
396          }
397   }
398  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines