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

Comparing ray/src/px/clrtab.c (file contents):
Revision 2.2 by greg, Tue Oct 13 09:07:51 1992 UTC vs.
Revision 2.4 by greg, Fri Feb 5 09:45:40 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1992 Regents of the University of California */
1 > /* Copyright (c) 1993 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 32 | Line 32 | static int     CLRCUBE[3][2] = {0,NRED,0,NGRN,0,NBLU};
32                                  /* maximum propagated error during dithering */
33   #define MAXERR          20
34                                  /* define CLOSEST to get closest colors */
35 < #define CLOSEST         1
35 > #ifndef CLOSEST
36 > #ifdef SPEED
37 > #if  SPEED > 8
38 > #define CLOSEST         1       /* this step takes a little longer */
39 > #endif
40 > #endif
41 > #endif
42  
43  
44   new_histo()             /* clear our histogram */
# Line 279 | Line 285 | int    n;
285                  neigh[i][0] = i;                /* identity is terminator */
286          }
287                                          /* make neighbor lists */
288 <        for (r = 0; r < NRED-1; r++)
289 <            for (g = 0; g < NGRN-1; g++)
290 <                for (b = 0; b < NBLU-1; b++) {
291 <                    if (histo[r][g][b] != histo[r+1][g][b])
288 >        for (r = 0; r < NRED; r++)
289 >            for (g = 0; g < NGRN; g++)
290 >                for (b = 0; b < NBLU; b++) {
291 >                    if (r < NRED-1 && histo[r][g][b] != histo[r+1][g][b])
292                          addneigh(neigh, histo[r][g][b], histo[r+1][g][b]);
293 <                    if (histo[r][g][b] != histo[r][g+1][b])
293 >                    if (g < NGRN-1 && histo[r][g][b] != histo[r][g+1][b])
294                          addneigh(neigh, histo[r][g][b], histo[r][g+1][b]);
295 <                    if (histo[r][g][b] != histo[r][g][b+1])
295 >                    if (b < NBLU-1 && histo[r][g][b] != histo[r][g][b+1])
296                          addneigh(neigh, histo[r][g][b], histo[r][g][b+1]);
297                  }
298                                          /* assign closest values */
# Line 335 | Line 341 | dist(col, r, g, b)             /* find distance from clrtab entry
341   register BYTE   col[3];
342   int     r, g, b;
343   {
344 <        register unsigned       tmp;
344 >        register int    tmp;
345          register unsigned       sum;
346          
347          tmp = col[RED]*NRED/256 - r;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines