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

Comparing ray/src/common/colrops.c (file contents):
Revision 2.3 by greg, Tue Sep 8 10:04:33 1992 UTC vs.
Revision 2.7 by greg, Tue Feb 25 02:47:21 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Integer operations on COLR scanlines
6   */
7  
8 + #include "copyright.h"
9 +
10 + #include <math.h>
11   #include "color.h"
12  
13   #define NULL            0
# Line 20 | Line 20 | static BYTE    *g_mant = NULL, *g_nexp = NULL;
20  
21   static BYTE     (*g_bval)[256] = NULL;
22  
23 extern double   pow();
23  
24 <
24 > int
25   setcolrcor(f, a2)               /* set brightness correction */
26   double  (*f)();
27   double  a2;
# Line 44 | Line 43 | double a2;
43   }
44  
45  
46 + int
47   setcolrinv(f, a2)               /* set inverse brightness correction */
48   double  (*f)();
49   double  a2;
# Line 58 | Line 58 | double a2;
58                                          /* compute gamb -> colr mapping */
59          i = 0;
60          mult = 256.0;
61 <        for (j = 255; j > 0; j--) {
62 <                while ((g_mant[j] = mult * (*f)(j/256.0, a2)) < 128) {
61 >        for (j = 256; j--; ) {
62 >                while ((g_mant[j] = mult * (*f)((j+.5)/256.0, a2)) < 128) {
63                          i++;
64                          mult *= 2.0;
65                  }
66                  g_nexp[j] = i;
67          }
68        g_mant[0] = 0;
69        g_nexp[0] = COLXS;
68          return(0);
69   }
70  
71  
72 + int
73   setcolrgam(g)                   /* set gamma conversion */
74   double  g;
75   {
# Line 80 | Line 79 | double g;
79   }
80  
81  
82 + int
83   colrs_gambs(scan, len)          /* convert scanline of colrs to gamma bytes */
84   register COLR   *scan;
85   int     len;
# Line 129 | Line 129 | int    len;
129   }
130  
131  
132 + int
133   gambs_colrs(scan, len)          /* convert gamma bytes to colr scanline */
134   register COLR   *scan;
135   int     len;
# Line 165 | Line 166 | int    len;
166   }
167  
168  
169 + void
170   shiftcolrs(scan, len, adjust)   /* shift a scanline of colors by 2^adjust */
171   register COLR   *scan;
172   register int    len;
# Line 186 | Line 188 | register int   adjust;
188   }
189  
190  
191 + void
192   normcolrs(scan, len, adjust)    /* normalize a scanline of colrs */
193   register COLR  *scan;
194   int  len;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines