corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | /// <summary>************************************************************************** |
2 | /// |
||
3 | /// $Id: LookUpTable32LinearSRGBtoSRGB.java,v 1.1 2002/07/25 14:56:47 grosbois Exp $ |
||
4 | /// |
||
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650 |
||
6 | /// $Date $ |
||
7 | /// *************************************************************************** |
||
8 | /// </summary> |
||
9 | using System; |
||
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType; |
||
11 | namespace CSJ2K.Icc.Lut |
||
12 | { |
||
13 | |||
14 | /// <summary> A Linear 32 bit SRGB to SRGB lut |
||
15 | /// |
||
16 | /// </summary> |
||
17 | /// <version> 1.0 |
||
18 | /// </version> |
||
19 | /// <author> Bruce A. Kern |
||
20 | /// </author> |
||
21 | public class LookUpTable32LinearSRGBtoSRGB:LookUpTable32 |
||
22 | { |
||
23 | |||
24 | /// <summary> Factory method for creating the lut.</summary> |
||
25 | /// <param name="wShadowCutoff">size of shadow region |
||
26 | /// </param> |
||
27 | /// <param name="dfShadowSlope">shadow region parameter |
||
28 | /// </param> |
||
29 | /// <param name="ksRGBLinearMaxValue">size of lut |
||
30 | /// </param> |
||
31 | /// <param name="ksRGB8ScaleAfterExp">post shadow region parameter |
||
32 | /// </param> |
||
33 | /// <param name="ksRGBExponent">post shadow region parameter |
||
34 | /// </param> |
||
35 | /// <param name="ksRGB8ReduceAfterEx">post shadow region parameter |
||
36 | /// </param> |
||
37 | /// <returns> the lut |
||
38 | /// </returns> |
||
39 | public static LookUpTable32LinearSRGBtoSRGB createInstance(int inMax, int outMax, double shadowCutoff, double shadowSlope, double scaleAfterExp, double exponent, double reduceAfterExp) |
||
40 | { |
||
41 | return new LookUpTable32LinearSRGBtoSRGB(inMax, outMax, shadowCutoff, shadowSlope, scaleAfterExp, exponent, reduceAfterExp); |
||
42 | } |
||
43 | |||
44 | /// <summary> Construct the lut</summary> |
||
45 | /// <param name="wShadowCutoff">size of shadow region |
||
46 | /// </param> |
||
47 | /// <param name="dfShadowSlope">shadow region parameter |
||
48 | /// </param> |
||
49 | /// <param name="ksRGBLinearMaxValue">size of lut |
||
50 | /// </param> |
||
51 | /// <param name="ksRGB8ScaleAfterExp">post shadow region parameter |
||
52 | /// </param> |
||
53 | /// <param name="ksRGBExponent">post shadow region parameter |
||
54 | /// </param> |
||
55 | /// <param name="ksRGB8ReduceAfterExp">post shadow region parameter |
||
56 | /// </param> |
||
57 | protected internal LookUpTable32LinearSRGBtoSRGB(int inMax, int outMax, double shadowCutoff, double shadowSlope, double scaleAfterExp, double exponent, double reduceAfterExp):base(inMax + 1, outMax) |
||
58 | { |
||
59 | |||
60 | int i = - 1; |
||
61 | // Normalization factor for i. |
||
62 | double normalize = 1.0 / (double) inMax; |
||
63 | |||
64 | // Generate the final linear-sRGB to non-linear sRGB LUT |
||
65 | |||
66 | // calculate where shadow portion of lut ends. |
||
67 | //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" |
||
68 | int cutOff = (int) System.Math.Floor(shadowCutoff * inMax); |
||
69 | |||
70 | // Scale to account for output |
||
71 | shadowSlope *= outMax; |
||
72 | |||
73 | // Our output needs to be centered on zero so we shift it down. |
||
74 | int shift = (outMax + 1) / 2; |
||
75 | |||
76 | for (i = 0; i <= cutOff; i++) |
||
77 | { |
||
78 | //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" |
||
79 | lut[i] = (int) (System.Math.Floor(shadowSlope * (i * normalize) + 0.5) - shift); |
||
80 | } |
||
81 | |||
82 | // Scale values for output. |
||
83 | scaleAfterExp *= outMax; |
||
84 | reduceAfterExp *= outMax; |
||
85 | |||
86 | // Now calculate the rest |
||
87 | for (; i <= inMax; i++) |
||
88 | { |
||
89 | //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" |
||
90 | lut[i] = (int) (System.Math.Floor(scaleAfterExp * System.Math.Pow(i * normalize, exponent) - reduceAfterExp + 0.5) - shift); |
||
91 | } |
||
92 | } |
||
93 | |||
94 | public override System.String ToString() |
||
95 | { |
||
96 | System.Text.StringBuilder rep = new System.Text.StringBuilder("[LookUpTable32LinearSRGBtoSRGB:"); |
||
97 | return rep.Append("]").ToString(); |
||
98 | } |
||
99 | |||
100 | /* end class LookUpTable32LinearSRGBtoSRGB */ |
||
101 | } |
||
102 | } |