/// ************************************************************************** /// /// $Id: LookUpTable16LinearSRGBtoSRGB.java,v 1.1 2002/07/25 14:56:47 grosbois Exp $ /// /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650 /// $Date $ /// *************************************************************************** /// using System; using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType; namespace CSJ2K.Icc.Lut { /// A Linear 16 bit SRGB to SRGB lut /// /// /// 1.0 /// /// Bruce A. Kern /// public class LookUpTable16LinearSRGBtoSRGB:LookUpTable16 { /// Factory method for creating the lut. /// size of shadow region /// /// shadow region parameter /// /// size of lut /// /// post shadow region parameter /// /// post shadow region parameter /// /// post shadow region parameter /// /// the lut /// public static LookUpTable16LinearSRGBtoSRGB createInstance(int wShadowCutoff, double dfShadowSlope, int ksRGBLinearMaxValue, double ksRGB8ScaleAfterExp, double ksRGBExponent, double ksRGB8ReduceAfterEx) { return new LookUpTable16LinearSRGBtoSRGB(wShadowCutoff, dfShadowSlope, ksRGBLinearMaxValue, ksRGB8ScaleAfterExp, ksRGBExponent, ksRGB8ReduceAfterEx); } /// Construct the lut /// size of shadow region /// /// shadow region parameter /// /// size of lut /// /// post shadow region parameter /// /// post shadow region parameter /// /// post shadow region parameter /// protected internal LookUpTable16LinearSRGBtoSRGB(int wShadowCutoff, double dfShadowSlope, int ksRGBLinearMaxValue, double ksRGB8ScaleAfterExp, double ksRGBExponent, double ksRGB8ReduceAfterExp):base(ksRGBLinearMaxValue + 1, (short) 0) { int i = - 1; //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'" double dfNormalize = 1.0 / (float) ksRGBLinearMaxValue; // Generate the final linear-sRGB to non-linear sRGB LUT for (i = 0; i <= wShadowCutoff; i++) { //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'" lut[i] = (byte) System.Math.Floor(dfShadowSlope * (double) i + 0.5); } // Now calculate the rest for (; i <= ksRGBLinearMaxValue; i++) { //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'" lut[i] = (byte) System.Math.Floor(ksRGB8ScaleAfterExp * System.Math.Pow((double) i * dfNormalize, ksRGBExponent) - ksRGB8ReduceAfterExp + 0.5); } } /* end class LookUpTable16LinearSRGBtoSRGB */ } }