예제 #1
0
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            InputChannelCount  = iccData[index];
            OutputChannelCount = iccData[index + 1];
            CLUTGridPointCount = iccData[index + 2];
            //1 byte reserved
            //Matrix (4 bytes each)
            Matrix = HighEndianReader.GetMatrix(iccData, index + 4, 3, 3, false, IsLittleEndian);
            //Input
            InputValues = new LUT8[InputChannelCount]; int c = 0;
            for (int i = 0; i < InputChannelCount; i++)
            {
                int dataIndex = index + 40 + Lut8Length * i;
                InputValues[i] = new LUT8(iccData, dataIndex);;
            }
            //CLUT
            byte[] tmp = new byte[16];

            for (int i = 0; i < 16; i++)
            {
                tmp[i] = CLUTGridPointCount;
            }
            CLUTValues = new CLUT8(iccData, index + 40 + (256 * InputChannelCount), InputChannelCount, OutputChannelCount, tmp, IsLittleEndian);
            //Output
            int clut8Length = (int)Math.Pow(CLUTGridPointCount, InputChannelCount) * OutputChannelCount;

            OutputValues = new LUT8[OutputChannelCount]; c = 0;
            for (int i = 0; i < OutputChannelCount; i++)
            {
                OutputValues[i] = new LUT8(iccData, CLUTValues.end + c);
                c += 256;
            }
        }
예제 #2
0
        public override void GetElementData(byte[] iccData, int index, int inputChannel, int outputChannel, bool isLittleEndian)
        {
            this.InputChannelCount  = (ushort)inputChannel;
            this.OutputChannelCount = (ushort)outputChannel;
            //Matrix IxO (4 bytes each)
            MatrixIxO = HighEndianReader.GetMatrix(iccData, index, inputChannel, outputChannel, true, BitConverter.IsLittleEndian);
            //Matrix Ox1 (4 bytes each)

            MatrixOx1 = HighEndianReader.GetMatrix(iccData, index + (4 * inputChannel * outputChannel), outputChannel, true);
        }
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            //Number of Input Channels (1 byte)
            InputChannelCount = iccData[index];
            //Number of Output Channels (1 byte)
            OutputChannelCount = iccData[index + 1];
            //Reserved for padding (2 bytes)
            //Offset to first "B" curve (4 bytes)
            BCurveOffset = (int)HighEndianReader.GetUint32(iccData, index + 4, IsLittleEndian);
            //Offset to matrix (4 bytes)
            MatrixOffset = (int)HighEndianReader.GetUint32(iccData, index + 8, IsLittleEndian);
            MCurveOffset = (int)HighEndianReader.GetUint32(iccData, index + 12, IsLittleEndian);
            //Offset to CLUT (4 bytes)
            CLUTOffset = (int)HighEndianReader.GetUint32(iccData, index + 16, IsLittleEndian);
            //Offset to first "A" curve (4 bytes)
            ACurveOffset = (int)HighEndianReader.GetUint32(iccData, index + 20, IsLittleEndian);

            //Curves
            if (BCurveOffset != 0)
            {
                GetCurve(iccData, ACurveOffset, ref curveB, index, InputChannelCount);
            }
            if (MCurveOffset != 0)
            {
                GetCurve(iccData, ACurveOffset, ref curveM, index, InputChannelCount);
            }
            if (CLUTOffset != 0)
            {
                CLUTValues = CLUT.GetCLUT(iccData, index - 8 + CLUTOffset, false, InputChannelCount, OutputChannelCount);
            }
            if (ACurveOffset != 0)
            {
                GetCurve(iccData, ACurveOffset, ref curveA, index, InputChannelCount);
            }

            //Matrix
            if (MatrixOffset != 0)
            {
                int i = MatrixOffset + index - 8;
                //Matrix 3x3 (4 bytes each)
                Matrix3x3 = HighEndianReader.GetMatrix(iccData, 3, 3, i, false, IsLittleEndian);
                //Matrix 3x1 (4 bytes each)
                Matrix3x1 = HighEndianReader.GetMatrix(iccData, 3, i + 36, false, IsLittleEndian);
            }
        }
예제 #4
0
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            //Channel counts (1 byte each)
            InputChannelCount  = iccData[index];
            OutputChannelCount = iccData[index + 1];
            CLUTGridPointCount = iccData[index + 2];
            //1 byte reserved
            //Matrix (4 bytes each)
            Matrix = HighEndianReader.GetMatrix(iccData, index + 4, 3, 3, false, IsLittleEndian);
            //Number of input table entries
            InputTableEntryCount = HighEndianReader.GetUInt16(iccData, index + 40, IsLittleEndian);
            //Number of output table entries
            OutputTableEntryCount = HighEndianReader.GetUInt16(iccData, index + 42, IsLittleEndian);
            //Input
            InputValues = new LUT16[InputChannelCount]; int c = 0;
            for (int i = 0; i < InputChannelCount; i++)
            {
                int dataIndex = InputTableEntryCount * 2 * i + 44 + index;
                InputValues[i] = new LUT16(iccData, dataIndex, InputTableEntryCount, IsLittleEndian);
                c += InputTableEntryCount * 2;
            }
            //CLUT
            int CLUTLength = (int)Math.Pow(CLUTGridPointCount, InputChannelCount) * OutputChannelCount * 2;

            byte[] tmp = new byte[16];
            for (int i = 0; i < 16; i++)
            {
                tmp[i] = CLUTGridPointCount;
            }
            CLUTValues = new CLUT16(iccData, index + 44 + c, InputChannelCount, OutputChannelCount, tmp);
            //Output
            OutputValues = new LUT16[OutputChannelCount];
            c            = 0;
            for (int i = 0; i < OutputChannelCount; i++)
            {
                OutputValues[i] = new LUT16(iccData, CLUTValues.end + c, OutputTableEntryCount, IsLittleEndian);
                c += OutputTableEntryCount * 2;
            }
        }