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

Comparing ray/src/common/color.h (file contents):
Revision 2.6 by greg, Mon Aug 2 13:51:43 1993 UTC vs.
Revision 2.7 by greg, Wed Jun 29 18:16:56 1994 UTC

# Line 41 | Line 41 | typedef float  COLOR[3];       /* red, green, blue */
41   #define  multcolor(c1,c2)       ((c1)[0]*=(c2)[0],(c1)[1]*=(c2)[1],(c1)[2]*=(c2)[2])
42  
43   #ifdef  NTSC
44 < #define  bright(col)            (.295*(col)[RED]+.636*(col)[GRN]+.070*(col)[BLU])
45 < #define  normbright(c)          (int)((74L*(c)[RED]+164L*(c)[GRN]+18L*(c)[BLU])>>8)
44 > #define  CIE_x_r                0.670           /* standard NTSC primaries */
45 > #define  CIE_y_r                0.330
46 > #define  CIE_x_g                0.210
47 > #define  CIE_y_g                0.710
48 > #define  CIE_x_b                0.140
49 > #define  CIE_y_b                0.080
50 > #define  CIE_x_w                0.333           /* use true white */
51 > #define  CIE_y_w                0.333
52   #else
53 < #define  bright(col)            (.263*(col)[RED]+.655*(col)[GRN]+.082*(col)[BLU])
54 < #define  normbright(c)          (int)((67L*(c)[RED]+168L*(c)[GRN]+21L*(c)[BLU])>>8)
53 > #define  CIE_x_r                0.640           /* nominal CRT primaries */
54 > #define  CIE_y_r                0.330
55 > #define  CIE_x_g                0.290
56 > #define  CIE_y_g                0.600
57 > #define  CIE_x_b                0.150
58 > #define  CIE_y_b                0.060
59 > #define  CIE_x_w                0.333           /* use true white */
60 > #define  CIE_y_w                0.333
61   #endif
62 +
63 + #define CIE_D           (       CIE_x_r*(CIE_y_g - CIE_y_b) + \
64 +                                CIE_x_g*(CIE_y_b - CIE_y_r) + \
65 +                                CIE_x_b*(CIE_y_r - CIE_y_g)     )
66 + #define CIE_C_rD        ( (1./CIE_y_w) * \
67 +                                ( CIE_x_w*(CIE_y_g - CIE_y_b) - \
68 +                                  CIE_y_w*(CIE_x_g - CIE_x_b) + \
69 +                                  CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g     ) )
70 + #define CIE_C_gD        ( (1./CIE_y_w) * \
71 +                                ( CIE_x_w*(CIE_y_b - CIE_y_r) - \
72 +                                  CIE_y_w*(CIE_x_b - CIE_x_r) - \
73 +                                  CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r     ) )
74 + #define CIE_C_bD        ( (1./CIE_y_w) * \
75 +                                ( CIE_x_w*(CIE_y_r - CIE_y_g) - \
76 +                                  CIE_y_w*(CIE_x_r - CIE_x_g) + \
77 +                                  CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r     ) )
78 +
79 + #define CIE_rf          (CIE_y_r*CIE_C_rD/CIE_D)
80 + #define CIE_gf          (CIE_y_g*CIE_C_gD/CIE_D)
81 + #define CIE_bf          (CIE_y_b*CIE_C_bD/CIE_D)
82 +
83 + #define  bright(col)    (CIE_rf*(col)[RED]+CIE_gf*(col)[GRN]+CIE_bf*(col)[BLU])
84 + #define  normbright(c)  ( ( (long)(CIE_rf*256.+.5)*(c)[RED] + \
85 +                            (long)(CIE_gf*256.+.5)*(c)[GRN] + \
86 +                            (long)(CIE_bf*256.+.5)*(c)[BLU] ) >> 8 )
87  
88                                  /* luminous efficacies over visible spectrum */
89   #define  MAXEFFICACY            683.            /* defined maximum at 550 nm */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines