├── .gitignore
├── CSJ2K
├── CSJ2K.csproj
├── Color
│ ├── ChannelDefinitionMapper.cs
│ ├── ColorSpace.cs
│ ├── ColorSpaceException.cs
│ ├── ColorSpaceMapper.cs
│ ├── EnumeratedColorSpaceMapper.cs
│ ├── EsRgbColorSpaceMapper.cs
│ ├── PalettizedColorSpaceMapper.cs
│ ├── Resampler.cs
│ ├── SYccColorSpaceMapper.cs
│ └── boxes
│ │ ├── ChannelDefinitionBox.cs
│ │ ├── ColorSpecificationBox.cs
│ │ ├── ComponentMappingBox.cs
│ │ ├── ImageHeaderBox.cs
│ │ ├── JP2Box.cs
│ │ └── PaletteBox.cs
├── Icc
│ ├── ICCMatrixBasedInputProfile.cs
│ ├── ICCMonochromeInputProfile.cs
│ ├── ICCProfile.cs
│ ├── ICCProfileException.cs
│ ├── ICCProfileInvalidException.cs
│ ├── ICCProfileNotFoundException.cs
│ ├── ICCProfiler.cs
│ ├── Lut
│ │ ├── LookUpTable.cs
│ │ ├── LookUpTable16.cs
│ │ ├── LookUpTable16Gamma.cs
│ │ ├── LookUpTable16Interp.cs
│ │ ├── LookUpTable16LinearSRGBtoSRGB.cs
│ │ ├── LookUpTable32.cs
│ │ ├── LookUpTable32Gamma.cs
│ │ ├── LookUpTable32Interp.cs
│ │ ├── LookUpTable32LinearSRGBtoSRGB.cs
│ │ ├── LookUpTable8.cs
│ │ ├── LookUpTable8Gamma.cs
│ │ ├── LookUpTable8Interp.cs
│ │ ├── LookUpTableFP.cs
│ │ ├── LookUpTableFPGamma.cs
│ │ ├── LookUpTableFPInterp.cs
│ │ ├── MatrixBasedTransformException.cs
│ │ ├── MatrixBasedTransformTosRGB.cs
│ │ ├── MonochromeTransformException.cs
│ │ └── MonochromeTransformTosRGB.cs
│ ├── MatrixBasedRestrictedProfile.cs
│ ├── MonochromeInputRestrictedProfile.cs
│ ├── RestrictedICCProfile.cs
│ ├── Tags
│ │ ├── ICCCurveType.cs
│ │ ├── ICCCurveTypeReverse.cs
│ │ ├── ICCDataType.cs
│ │ ├── ICCMeasurementType.cs
│ │ ├── ICCSignatureType.cs
│ │ ├── ICCTag.cs
│ │ ├── ICCTagTable.cs
│ │ ├── ICCTextDescriptionType.cs
│ │ ├── ICCTextType.cs
│ │ ├── ICCViewType.cs
│ │ ├── ICCXYZType.cs
│ │ └── ICCXYZTypeReverse.cs
│ └── Types
│ │ ├── ICCDateTime.cs
│ │ ├── ICCProfileHeader.cs
│ │ ├── ICCProfileVersion.cs
│ │ └── XYZNumber.cs
├── J2kImage.cs
├── J2kSetup.cs
├── Properties
│ └── AssemblyInfo.cs
├── README.md
├── Util
│ ├── BitmapImage.cs
│ ├── BitmapImageCreator.cs
│ ├── BitmapImageSource.cs
│ ├── DotnetFileInfo.cs
│ ├── DotnetFileInfoCreator.cs
│ ├── DotnetFileStreamCreator.cs
│ ├── DotnetMsgLogger.cs
│ ├── EndianBinaryReader.cs
│ ├── EndianBinaryWriter.cs
│ ├── FileInfoFactory.cs
│ ├── FileStreamFactory.cs
│ ├── IDefaultable.cs
│ ├── IFileInfo.cs
│ ├── IFileInfoCreator.cs
│ ├── IFileStreamCreator.cs
│ ├── IImage.cs
│ ├── IImageCreator.cs
│ ├── ImageBase.cs
│ ├── ImageFactory.cs
│ ├── PortableImage.cs
│ ├── PortableImageSource.cs
│ └── SupportClass.cs
└── j2k
│ ├── IntegerSpec.cs
│ ├── JJ2KExceptionHandler.cs
│ ├── JJ2KInfo.cs
│ ├── ModuleSpec.cs
│ ├── NoNextElementException.cs
│ ├── StringSpec.cs
│ ├── codestream
│ ├── CBlkCoordInfo.cs
│ ├── CoordInfo.cs
│ ├── CorruptedCodestreamException.cs
│ ├── HeaderInfo.cs
│ ├── Markers.cs
│ ├── PrecCoordInfo.cs
│ ├── PrecInfo.cs
│ ├── ProgressionType.cs
│ ├── reader
│ │ ├── BitstreamReaderAgent.cs
│ │ ├── CBlkInfo.cs
│ │ ├── FileBitstreamReaderAgent.cs
│ │ ├── HeaderDecoder.cs
│ │ ├── PktDecoder.cs
│ │ ├── PktHeaderBitReader.cs
│ │ ├── PktInfo.cs
│ │ └── TagTreeDecoder.cs
│ └── writer
│ │ ├── BitOutputBuffer.cs
│ │ ├── CodestreamWriter.cs
│ │ ├── FileCodestreamWriter.cs
│ │ ├── HeaderEncoder.cs
│ │ ├── PktEncoder.cs
│ │ └── TagTreeEncoder.cs
│ ├── decoder
│ └── DecoderSpecs.cs
│ ├── encoder
│ └── EncoderSpecs.cs
│ ├── entropy
│ ├── CBlkSizeSpec.cs
│ ├── CodedCBlk.cs
│ ├── PrecinctSizeSpec.cs
│ ├── Progression.cs
│ ├── ProgressionSpec.cs
│ ├── StdEntropyCoderOptions.cs
│ ├── decoder
│ │ ├── ByteInputBuffer.cs
│ │ ├── ByteToBitInput.cs
│ │ ├── CodedCBlkDataSrcDec.cs
│ │ ├── DecLyrdCBlk.cs
│ │ ├── EntropyDecoder.cs
│ │ ├── MQDecoder.cs
│ │ └── StdEntropyDecoder.cs
│ └── encoder
│ │ ├── BitToByteOutput.cs
│ │ ├── ByteOutputBuffer.cs
│ │ ├── CBlkRateDistStats.cs
│ │ ├── CodedCBlkDataSrcEnc.cs
│ │ ├── EBCOTLayer.cs
│ │ ├── EBCOTRateAllocator.cs
│ │ ├── EntropyCoder.cs
│ │ ├── LayersInfo.cs
│ │ ├── MQCoder.cs
│ │ ├── PostCompRateAllocator.cs
│ │ └── StdEntropyCoder.cs
│ ├── fileformat
│ ├── FileFormatBoxes.cs
│ ├── reader
│ │ └── FileFormatReader.cs
│ └── writer
│ │ └── FileFormatWriter.cs
│ ├── image
│ ├── BlkImgDataSrc.cs
│ ├── CompTransfSpec.cs
│ ├── Coord.cs
│ ├── DataBlk.cs
│ ├── DataBlkFloat.cs
│ ├── DataBlkInt.cs
│ ├── ImgData.cs
│ ├── ImgDataAdapter.cs
│ ├── ImgDataConverter.cs
│ ├── ImgDataJoiner.cs
│ ├── Tiler.cs
│ ├── forwcomptransf
│ │ ├── ForwCompTransf.cs
│ │ └── ForwCompTransfSpec.cs
│ ├── input
│ │ ├── ImgReader.cs
│ │ ├── ImgReaderPGM.cs
│ │ ├── ImgReaderPGX.cs
│ │ └── ImgReaderPPM.cs
│ ├── invcomptransf
│ │ └── InvCompTransf.cs
│ └── output
│ │ ├── ImgWriter.cs
│ │ ├── ImgWriterPGM.cs
│ │ ├── ImgWriterPGX.cs
│ │ └── ImgWriterPPM.cs
│ ├── io
│ ├── BEBufferedRandomAccessFile.cs
│ ├── BinaryDataInput.cs
│ ├── BinaryDataOutput.cs
│ ├── BufferedRandomAccessFile.cs
│ ├── EndianType.cs
│ └── RandomAccessIO.cs
│ ├── quantization
│ ├── GuardBitsSpec.cs
│ ├── QuantStepSizeSpec.cs
│ ├── QuantTypeSpec.cs
│ ├── QuantizationType.cs
│ ├── dequantizer
│ │ ├── CBlkQuantDataSrcDec.cs
│ │ ├── Dequantizer.cs
│ │ ├── DequantizerParams.cs
│ │ ├── StdDequantizer.cs
│ │ └── StdDequantizerParams.cs
│ └── quantizer
│ │ ├── CBlkQuantDataSrcEnc.cs
│ │ ├── Quantizer.cs
│ │ └── StdQuantizer.cs
│ ├── roi
│ ├── MaxShiftSpec.cs
│ ├── ROIDeScaler.cs
│ └── encoder
│ │ ├── ArbROIMaskGenerator.cs
│ │ ├── ROI.cs
│ │ ├── ROIMaskGenerator.cs
│ │ ├── ROIScaler.cs
│ │ ├── RectROIMaskGenerator.cs
│ │ ├── SubbandROIMask.cs
│ │ └── SubbandRectROIMask.cs
│ ├── util
│ ├── ArrayUtil.cs
│ ├── CodestreamManipulator.cs
│ ├── FacilityManager.cs
│ ├── IMsgLogger.cs
│ ├── ISRandomAccessIO.cs
│ ├── MathUtil.cs
│ ├── MsgPrinter.cs
│ ├── ParameterList.cs
│ ├── ProgressWatch.cs
│ ├── StreamMsgLogger.cs
│ └── StringFormatException.cs
│ └── wavelet
│ ├── FilterTypes.cs
│ ├── Subband.cs
│ ├── WTDecompSpec.cs
│ ├── WTFilterSpec.cs
│ ├── WaveletFilter.cs
│ ├── WaveletTransform.cs
│ ├── analysis
│ ├── AnWTFilter.cs
│ ├── AnWTFilterFloat.cs
│ ├── AnWTFilterFloatLift9x7.cs
│ ├── AnWTFilterInt.cs
│ ├── AnWTFilterIntLift5x3.cs
│ ├── AnWTFilterSpec.cs
│ ├── CBlkWTData.cs
│ ├── CBlkWTDataFloat.cs
│ ├── CBlkWTDataInt.cs
│ ├── CBlkWTDataSrc.cs
│ ├── ForwWT.cs
│ ├── ForwWTDataProps.cs
│ ├── ForwWTFull.cs
│ ├── ForwardWT.cs
│ └── SubbandAn.cs
│ └── synthesis
│ ├── CBlkWTDataSrcDec.cs
│ ├── InvWT.cs
│ ├── InvWTAdapter.cs
│ ├── InvWTData.cs
│ ├── InvWTFull.cs
│ ├── InverseWT.cs
│ ├── MultiResImgData.cs
│ ├── MultiResImgDataAdapter.cs
│ ├── SubbandSyn.cs
│ ├── SynWTFilter.cs
│ ├── SynWTFilterFloat.cs
│ ├── SynWTFilterFloatLift9x7.cs
│ ├── SynWTFilterInt.cs
│ ├── SynWTFilterIntLift5x3.cs
│ └── SynWTFilterSpec.cs
├── GRB
├── CRC32.cs
├── Enum
│ ├── AssembleIdentifier.cs
│ ├── Instrument.cs
│ ├── PayloadType.cs
│ └── SystemEnvironment.cs
├── EnumHelpers.cs
├── GRB.csproj
├── Headers
│ ├── GRBGenericHeader.cs
│ ├── GRBImageHeader.cs
│ └── SecondHeader.cs
├── MSDU.cs
├── Product
│ ├── ABIMeta.cs
│ ├── ImageSize.cs
│ ├── Product.cs
│ └── Products.cs
├── Properties
│ └── AssemblyInfo.cs
├── Tools.cs
└── packages.config
├── ImageTools
├── IMTools.csproj
├── Image16.cs
├── ImageAssembler.cs
└── Properties
│ └── AssemblyInfo.cs
├── LICENSE
├── LibraryTest
├── LibraryTest.csproj
├── LibraryTest.csproj.user
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
├── README.md
├── bb2cadu.py
├── bbframe_stream.py
├── grbdump.sln
├── grbdump.userprefs
├── grbdump
├── ChannelManager.cs
├── Connector.cs
├── Demuxer.cs
├── FileHandler.cs
├── FileHandlerManager.cs
├── GRBData.cs
├── MSDUInfo.cs
├── MSDUManager.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── UDPConnector.cs
├── grbdump.csproj
└── packages.config
├── jp2png.py
├── packet.bin
├── stream.py
└── stream_udp.py
/.gitignore:
--------------------------------------------------------------------------------
1 | packages
2 | **/bin
3 | **/obj
4 |
--------------------------------------------------------------------------------
/CSJ2K/Color/ColorSpaceException.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ColorSpaceException.java,v 1.1 2002/07/25 14:52:00 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | namespace CSJ2K.Color
11 | {
12 |
13 | /// This exception is thrown when the content of an
14 | /// image contains an incorrect colorspace box
15 | ///
16 | ///
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 |
24 | public class ColorSpaceException:System.Exception
25 | {
26 |
27 | /// Contruct with message
28 | /// returned by getMessage()
29 | ///
30 | public ColorSpaceException(System.String msg):base(msg)
31 | {
32 | }
33 |
34 |
35 | /// Empty constructor
36 | public ColorSpaceException()
37 | {
38 | }
39 |
40 | /* end class ColorSpaceException */
41 | }
42 | }
--------------------------------------------------------------------------------
/CSJ2K/Color/boxes/ImageHeaderBox.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ImageHeaderBox.java,v 1.1 2002/07/25 14:50:47 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ColorSpaceException = CSJ2K.Color.ColorSpaceException;
11 | using ParameterList = CSJ2K.j2k.util.ParameterList;
12 | using RandomAccessIO = CSJ2K.j2k.io.RandomAccessIO;
13 | using ICCProfile = CSJ2K.Icc.ICCProfile;
14 | namespace CSJ2K.Color.Boxes
15 | {
16 |
17 | /// This class models the Image Header box contained in a JP2
18 | /// image. It is a stub class here since for colormapping the
19 | /// knowlege of the existance of the box in the image is sufficient.
20 | ///
21 | ///
22 | /// 1.0
23 | ///
24 | /// Bruce A. Kern
25 | ///
26 | public sealed class ImageHeaderBox:JP2Box
27 | {
28 |
29 | internal long height;
30 | internal long width;
31 | internal int nc;
32 | internal short bpc;
33 | internal short c;
34 | internal bool unk;
35 | internal bool ipr;
36 |
37 |
38 | /// Construct an ImageHeaderBox from an input image.
39 | /// RandomAccessIO jp2 image
40 | ///
41 | /// offset to the start of the box in the image
42 | ///
43 | /// ColorSpaceException
44 | ///
45 | public ImageHeaderBox(RandomAccessIO in_Renamed, int boxStart):base(in_Renamed, boxStart)
46 | {
47 | readBox();
48 | }
49 |
50 | /// Return a suitable String representation of the class instance.
51 | public override System.String ToString()
52 | {
53 | System.Text.StringBuilder rep = new System.Text.StringBuilder("[ImageHeaderBox ").Append(eol).Append(" ");
54 | rep.Append("height= ").Append(System.Convert.ToString(height)).Append(", ");
55 | rep.Append("width= ").Append(System.Convert.ToString(width)).Append(eol).Append(" ");
56 |
57 | rep.Append("nc= ").Append(System.Convert.ToString(nc)).Append(", ");
58 | rep.Append("bpc= ").Append(System.Convert.ToString(bpc)).Append(", ");
59 | rep.Append("c= ").Append(System.Convert.ToString(c)).Append(eol).Append(" ");
60 |
61 | rep.Append("image colorspace is ").Append(new System.Text.StringBuilder(unk == true?"known":"unknown").ToString());
62 | rep.Append(", the image ").Append(new System.Text.StringBuilder(ipr == true?"contains ":"does not contain ").ToString()).Append("intellectual property").Append("]");
63 |
64 | return rep.ToString();
65 | }
66 |
67 | /// Analyze the box content.
68 | internal void readBox()
69 | {
70 | byte[] bfr = new byte[14];
71 | in_Renamed.seek(dataStart);
72 | in_Renamed.readFully(bfr, 0, 14);
73 |
74 | height = ICCProfile.getInt(bfr, 0);
75 | width = ICCProfile.getInt(bfr, 4);
76 | nc = ICCProfile.getShort(bfr, 8);
77 | bpc = (short) (bfr[10] & 0x00ff);
78 | c = (short) (bfr[11] & 0x00ff);
79 | unk = bfr[12] == 0?true:false;
80 | ipr = bfr[13] == 1?true:false;
81 | }
82 |
83 | /* end class ImageHeaderBox */
84 | static ImageHeaderBox()
85 | {
86 | {
87 | type = 69686472;
88 | }
89 | }
90 | }
91 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/ICCMatrixBasedInputProfile.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCMatrixBasedInputProfile.java,v 1.1 2002/07/25 14:56:54 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ColorSpace = CSJ2K.Color.ColorSpace;
11 | using ColorSpaceException = CSJ2K.Color.ColorSpaceException;
12 | using RandomAccessIO = CSJ2K.j2k.io.RandomAccessIO;
13 | namespace CSJ2K.Icc
14 | {
15 |
16 | /// This class enables an application to construct an 3 component ICCProfile
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 |
24 | public class ICCMatrixBasedInputProfile:ICCProfile
25 | {
26 |
27 | /// Factory method to create ICCMatrixBasedInputProfile based on a
28 | /// suppled profile file.
29 | ///
30 | /// contains a disk based ICCProfile.
31 | ///
32 | /// the ICCMatrixBasedInputProfile
33 | ///
34 | ///
35 | ///
36 | ///
37 | ///
38 | public static ICCMatrixBasedInputProfile createInstance(ColorSpace csm)
39 | {
40 | return new ICCMatrixBasedInputProfile(csm);
41 | }
42 |
43 | /// Construct an ICCMatrixBasedInputProfile based on a
44 | /// suppled profile file.
45 | ///
46 | /// contains a disk based ICCProfile.
47 | ///
48 | ///
49 | ///
50 | ///
51 | ///
52 | protected internal ICCMatrixBasedInputProfile(ColorSpace csm):base(csm)
53 | {
54 | }
55 |
56 | /* end class ICCMatrixBasedInputProfile */
57 | }
58 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/ICCMonochromeInputProfile.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCMonochromeInputProfile.java,v 1.1 2002/07/25 14:56:54 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ColorSpace = CSJ2K.Color.ColorSpace;
11 | using ColorSpaceException = CSJ2K.Color.ColorSpaceException;
12 | using RandomAccessIO = CSJ2K.j2k.io.RandomAccessIO;
13 | namespace CSJ2K.Icc
14 | {
15 |
16 | /// The monochrome ICCProfile.
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 | public class ICCMonochromeInputProfile:ICCProfile
24 | {
25 |
26 | /// Return the ICCProfile embedded in the input image
27 | /// jp2 image with embedded profile
28 | ///
29 | /// ICCMonochromeInputProfile
30 | ///
31 | ///
32 | ///
33 | ///
34 | ///
35 | public static ICCMonochromeInputProfile createInstance(ColorSpace csm)
36 | {
37 | return new ICCMonochromeInputProfile(csm);
38 | }
39 |
40 | /// Construct a ICCMonochromeInputProfile corresponding to the profile file
41 | /// disk based ICCMonochromeInputProfile
42 | ///
43 | /// theICCMonochromeInputProfile
44 | ///
45 | ///
46 | ///
47 | ///
48 | ///
49 | protected internal ICCMonochromeInputProfile(ColorSpace csm):base(csm)
50 | {
51 | }
52 |
53 | /* end class ICCMonochromeInputProfile */
54 | }
55 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/ICCProfileException.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCProfileException.java,v 1.2 2002/08/08 14:08:13 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | namespace CSJ2K.Icc
11 | {
12 |
13 | /// This exception is thrown when the content of a profile
14 | /// is incorrect.
15 | ///
16 | ///
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 | public class ICCProfileException:System.Exception
24 | {
25 |
26 | /// Contruct with message
27 | /// returned by getMessage()
28 | ///
29 | public ICCProfileException(System.String msg):base(msg)
30 | {
31 | }
32 |
33 |
34 | /// Empty constructor
35 | public ICCProfileException()
36 | {
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/ICCProfileInvalidException.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCProfileInvalidException.java,v 1.1 2002/07/25 14:56:55 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | namespace CSJ2K.Icc
11 | {
12 |
13 | /// This exception is thrown when the content of an an icc profile
14 | /// is in someway incorrect.
15 | ///
16 | ///
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 |
24 | public class ICCProfileInvalidException:ICCProfileException
25 | {
26 |
27 | /// Contruct with message
28 | /// returned by getMessage()
29 | ///
30 | internal ICCProfileInvalidException(System.String msg):base(msg)
31 | {
32 | }
33 |
34 |
35 | /// Empty constructor
36 | internal ICCProfileInvalidException():base("icc profile is invalid")
37 | {
38 | }
39 |
40 | /* end class ICCProfileInvalidException */
41 | }
42 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/ICCProfileNotFoundException.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCProfileNotFoundException.java,v 1.1 2002/07/25 14:56:55 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | namespace CSJ2K.Icc
11 | {
12 |
13 | /// This exception is thrown when an image contains no icc profile.
14 | /// is incorrect.
15 | ///
16 | ///
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 |
24 | public class ICCProfileNotFoundException:ICCProfileException
25 | {
26 |
27 | /// Contruct with message
28 | /// returned by getMessage()
29 | ///
30 | internal ICCProfileNotFoundException(System.String msg):base(msg)
31 | {
32 | }
33 |
34 |
35 | /// Empty constructor
36 | internal ICCProfileNotFoundException():base("no icc profile in image")
37 | {
38 | }
39 |
40 | /* end class ICCProfileNotFoundException */
41 | }
42 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTable.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTable.java,v 1.1 2002/07/25 14:56:49 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 |
15 | /// Toplevel class for a lut. All lookup tables must
16 | /// extend this class.
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 | public abstract class LookUpTable
24 | {
25 |
26 | /// End of line string.
27 | //UPGRADE_NOTE: Final was removed from the declaration of 'eol '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
28 | protected internal static readonly System.String eol = System.Environment.NewLine;
29 | /// The curve data
30 | protected internal ICCCurveType curve = null;
31 | /// Number of values in created lut
32 | protected internal int dwNumInput = 0;
33 |
34 |
35 | /// For subclass usage.
36 | /// The curve data
37 | ///
38 | /// Number of values in created lut
39 | ///
40 | protected internal LookUpTable(ICCCurveType curve, int dwNumInput)
41 | {
42 | this.curve = curve;
43 | this.dwNumInput = dwNumInput;
44 | }
45 |
46 | /* end class LookUpTable */
47 | }
48 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTable16Gamma.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTable16Gamma.java,v 1.1 2002/07/25 14:56:46 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// A Gamma based 16 bit lut.
15 | ///
16 | ///
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 | public class LookUpTable16Gamma:LookUpTable16
24 | {
25 |
26 | /* Construct the lut
27 | * @param curve data
28 | * @param dwNumInput size of lut
29 | * @param dwMaxOutput max value of lut
30 | */
31 | public LookUpTable16Gamma(ICCCurveType curve, int dwNumInput, int dwMaxOutput):base(curve, dwNumInput, dwMaxOutput)
32 | {
33 | double dfE = ICCCurveType.CurveGammaToDouble(curve.entry(0)); // Gamma exponent for inverse transformation
34 | for (int i = 0; i < dwNumInput; i++)
35 | {
36 | //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'"
37 | lut[i] = (short) System.Math.Floor(System.Math.Pow((double) i / (dwNumInput - 1), dfE) * dwMaxOutput + 0.5);
38 | }
39 | }
40 |
41 | /* end class LookUpTable16Gamma */
42 | }
43 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTable16Interp.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTable16Interp.java,v 1.1 2002/07/25 14:56:46 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// An interpolated 16 bit lut
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A.Kern
20 | ///
21 | public class LookUpTable16Interp:LookUpTable16
22 | {
23 |
24 | /// Construct the lut from the curve data
25 | /// curve the data
26 | /// dwNumInput the lut size
27 | /// dwMaxOutput the lut max value
28 | public LookUpTable16Interp(ICCCurveType curve, int dwNumInput, int dwMaxOutput):base(curve, dwNumInput, dwMaxOutput)
29 | {
30 |
31 | int dwLowIndex, dwHighIndex; // Indices of interpolation points
32 | double dfLowIndex, dfHighIndex; // FP indices of interpolation points
33 | double dfTargetIndex; // Target index into interpolation table
34 | double dfRatio; // Ratio of LUT input points to curve values
35 | double dfLow, dfHigh; // Interpolation values
36 | double dfOut; // Output LUT value
37 |
38 | dfRatio = (double) (curve.count - 1) / (double) (dwNumInput - 1);
39 |
40 | for (int i = 0; i < dwNumInput; i++)
41 | {
42 | dfTargetIndex = (double) i * dfRatio;
43 | dfLowIndex = System.Math.Floor(dfTargetIndex);
44 | //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'"
45 | dwLowIndex = (int) dfLowIndex;
46 | dfHighIndex = System.Math.Ceiling(dfTargetIndex);
47 | //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'"
48 | dwHighIndex = (int) dfHighIndex;
49 |
50 | if (dwLowIndex == dwHighIndex)
51 | dfOut = ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
52 | else
53 | {
54 | dfLow = ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
55 | dfHigh = ICCCurveType.CurveToDouble(curve.entry(dwHighIndex));
56 | dfOut = dfLow + (dfHigh - dfLow) * (dfTargetIndex - dfLowIndex);
57 | }
58 |
59 | //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'"
60 | lut[i] = (short) System.Math.Floor(dfOut * dwMaxOutput + 0.5);
61 | }
62 | }
63 |
64 | /* end class LookUpTable16Interp */
65 | }
66 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTable16LinearSRGBtoSRGB.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTable16LinearSRGBtoSRGB.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 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// A Linear 16 bit SRGB to SRGB lut
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A. Kern
20 | ///
21 | public class LookUpTable16LinearSRGBtoSRGB:LookUpTable16
22 | {
23 |
24 | /// Factory method for creating the lut.
25 | /// size of shadow region
26 | ///
27 | /// shadow region parameter
28 | ///
29 | /// size of lut
30 | ///
31 | /// post shadow region parameter
32 | ///
33 | /// post shadow region parameter
34 | ///
35 | /// post shadow region parameter
36 | ///
37 | /// the lut
38 | ///
39 | public static LookUpTable16LinearSRGBtoSRGB createInstance(int wShadowCutoff, double dfShadowSlope, int ksRGBLinearMaxValue, double ksRGB8ScaleAfterExp, double ksRGBExponent, double ksRGB8ReduceAfterEx)
40 | {
41 | return new LookUpTable16LinearSRGBtoSRGB(wShadowCutoff, dfShadowSlope, ksRGBLinearMaxValue, ksRGB8ScaleAfterExp, ksRGBExponent, ksRGB8ReduceAfterEx);
42 | }
43 |
44 | /// Construct the lut
45 | /// size of shadow region
46 | ///
47 | /// shadow region parameter
48 | ///
49 | /// size of lut
50 | ///
51 | /// post shadow region parameter
52 | ///
53 | /// post shadow region parameter
54 | ///
55 | /// post shadow region parameter
56 | ///
57 | protected internal LookUpTable16LinearSRGBtoSRGB(int wShadowCutoff, double dfShadowSlope, int ksRGBLinearMaxValue, double ksRGB8ScaleAfterExp, double ksRGBExponent, double ksRGB8ReduceAfterExp):base(ksRGBLinearMaxValue + 1, (short) 0)
58 | {
59 |
60 | int i = - 1;
61 | //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'"
62 | double dfNormalize = 1.0 / (float) ksRGBLinearMaxValue;
63 |
64 | // Generate the final linear-sRGB to non-linear sRGB LUT
65 | for (i = 0; i <= wShadowCutoff; i++)
66 | {
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 | lut[i] = (byte) System.Math.Floor(dfShadowSlope * (double) i + 0.5);
69 | }
70 |
71 | // Now calculate the rest
72 | for (; i <= ksRGBLinearMaxValue; i++)
73 | {
74 | //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'"
75 | lut[i] = (byte) System.Math.Floor(ksRGB8ScaleAfterExp * System.Math.Pow((double) i * dfNormalize, ksRGBExponent) - ksRGB8ReduceAfterExp + 0.5);
76 | }
77 | }
78 |
79 | /* end class LookUpTable16LinearSRGBtoSRGB */
80 | }
81 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTable32Gamma.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTable32Gamma.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 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// A Gamma based 32 bit lut.
15 | ///
16 | ///
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 |
24 | public class LookUpTable32Gamma:LookUpTable32
25 | {
26 |
27 |
28 | /* Construct the lut
29 | * @param curve data
30 | * @param dwNumInput size of lut
31 | * @param dwMaxOutput max value of lut
32 | */
33 | public LookUpTable32Gamma(ICCCurveType curve, int dwNumInput, int dwMaxOutput):base(curve, dwNumInput, dwMaxOutput)
34 | {
35 | double dfE = ICCCurveType.CurveGammaToDouble(curve.entry(0)); // Gamma exponent for inverse transformation
36 | for (int i = 0; i < dwNumInput; i++)
37 | {
38 | //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'"
39 | lut[i] = (int) System.Math.Floor(System.Math.Pow((double) i / (dwNumInput - 1), dfE) * dwMaxOutput + 0.5);
40 | }
41 | }
42 |
43 | /* end class LookUpTable32Gamma */
44 | }
45 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTable32Interp.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTable32Interp.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 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// An interpolated 32 bit lut
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A.Kern
20 | ///
21 |
22 | public class LookUpTable32Interp:LookUpTable32
23 | {
24 |
25 | /// Construct the lut from the curve data
26 | /// curve the data
27 | /// dwNumInput the lut size
28 | /// dwMaxOutput the lut max value
29 | public LookUpTable32Interp(ICCCurveType curve, int dwNumInput, int dwMaxOutput):base(curve, dwNumInput, dwMaxOutput)
30 | {
31 |
32 | int dwLowIndex, dwHighIndex; // Indices of interpolation points
33 | double dfLowIndex, dfHighIndex; // FP indices of interpolation points
34 | double dfTargetIndex; // Target index into interpolation table
35 | double dfRatio; // Ratio of LUT input points to curve values
36 | double dfLow, dfHigh; // Interpolation values
37 | double dfOut; // Output LUT value
38 |
39 | dfRatio = (double) (curve.count - 1) / (double) (dwNumInput - 1);
40 |
41 | for (int i = 0; i < dwNumInput; i++)
42 | {
43 | dfTargetIndex = (double) i * dfRatio;
44 | dfLowIndex = System.Math.Floor(dfTargetIndex);
45 | //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'"
46 | dwLowIndex = (int) dfLowIndex;
47 | dfHighIndex = System.Math.Ceiling(dfTargetIndex);
48 | //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'"
49 | dwHighIndex = (int) dfHighIndex;
50 |
51 | if (dwLowIndex == dwHighIndex)
52 | dfOut = ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
53 | else
54 | {
55 | dfLow = ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
56 | dfHigh = ICCCurveType.CurveToDouble(curve.entry(dwHighIndex));
57 | dfOut = dfLow + (dfHigh - dfLow) * (dfTargetIndex - dfLowIndex);
58 | }
59 |
60 | //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'"
61 | lut[i] = (int) System.Math.Floor(dfOut * dwMaxOutput + 0.5);
62 | }
63 | }
64 |
65 | /* end class LookUpTable32Interp */
66 | }
67 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTable8.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTable8.java,v 1.1 2002/07/25 14:56:48 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// Toplevel class for a byte [] lut.
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A. Kern
20 | ///
21 | public abstract class LookUpTable8:LookUpTable
22 | {
23 |
24 | /// Maximum output value of the LUT
25 | //UPGRADE_NOTE: Final was removed from the declaration of 'dwMaxOutput '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
26 | protected internal byte dwMaxOutput;
27 | /// The lut values.
28 | // Maximum output value of the LUT
29 | //UPGRADE_NOTE: Final was removed from the declaration of 'lut '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
30 | protected internal byte[] lut;
31 |
32 |
33 | /// Create an abbreviated string representation of a 16 bit lut.
34 | /// the lut as a String
35 | ///
36 | public override System.String ToString()
37 | {
38 | System.Text.StringBuilder rep = new System.Text.StringBuilder("[LookUpTable8 ");
39 | //int row, col;
40 | rep.Append("max= " + dwMaxOutput);
41 | rep.Append(", nentries= " + dwMaxOutput);
42 | return rep.Append("]").ToString();
43 | }
44 |
45 |
46 |
47 | public virtual System.String toStringWholeLut()
48 | {
49 | System.Text.StringBuilder rep = new System.Text.StringBuilder("LookUpTable8" + eol);
50 | rep.Append("maxOutput = " + dwMaxOutput + eol);
51 | for (int i = 0; i < dwNumInput; ++i)
52 | rep.Append("lut[" + i + "] = " + lut[i] + eol);
53 | return rep.Append("]").ToString();
54 | }
55 |
56 | protected internal LookUpTable8(int dwNumInput, byte dwMaxOutput):base(null, dwNumInput)
57 | {
58 | lut = new byte[dwNumInput];
59 | this.dwMaxOutput = dwMaxOutput;
60 | }
61 |
62 |
63 | /// Create the string representation of a 16 bit lut.
64 | /// the lut as a String
65 | ///
66 | protected internal LookUpTable8(ICCCurveType curve, int dwNumInput, byte dwMaxOutput):base(curve, dwNumInput)
67 | {
68 | this.dwMaxOutput = dwMaxOutput;
69 | lut = new byte[dwNumInput];
70 | }
71 |
72 | /// lut accessor
73 | /// of the element
74 | ///
75 | /// the lut [index]
76 | ///
77 | public byte elementAt(int index)
78 | {
79 | return lut[index];
80 | }
81 |
82 | /* end class LookUpTable8 */
83 | }
84 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTable8Gamma.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTable8Gamma.java,v 1.1 2002/07/25 14:56:48 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// A Gamma based 16 bit lut.
15 | ///
16 | ///
17 | ///
18 | ///
19 | /// 1.0
20 | ///
21 | /// Bruce A. Kern
22 | ///
23 | public class LookUpTable8Gamma:LookUpTable8
24 | {
25 |
26 | /* Construct the lut
27 | * @param curve data
28 | * @param dwNumInput size of lut
29 | * @param dwMaxOutput max value of lut
30 | */
31 | public LookUpTable8Gamma(ICCCurveType curve, int dwNumInput, byte dwMaxOutput):base(curve, dwNumInput, dwMaxOutput)
32 | {
33 | double dfE = ICCCurveType.CurveGammaToDouble(curve.entry(0)); // Gamma exponent for inverse transformation
34 | for (int i = 0; i < dwNumInput; i++)
35 | {
36 | //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'"
37 | lut[i] = (byte) System.Math.Floor(System.Math.Pow((double) i / (dwNumInput - 1), dfE) * dwMaxOutput + 0.5);
38 | }
39 | }
40 |
41 | /* end class LookUpTable8Gamma */
42 | }
43 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTable8Interp.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTable8Interp.java,v 1.1 2002/07/25 14:56:48 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 |
15 | /// An interpolated 8 bit lut
16 | ///
17 | ///
18 | /// 1.0
19 | ///
20 | /// Bruce A.Kern
21 | ///
22 | public class LookUpTable8Interp:LookUpTable8
23 | {
24 |
25 | /// Construct the lut from the curve data
26 | /// curve the data
27 | /// dwNumInput the lut size
28 | /// dwMaxOutput the lut max value
29 | public LookUpTable8Interp(ICCCurveType curve, int dwNumInput, byte dwMaxOutput):base(curve, dwNumInput, dwMaxOutput)
30 | {
31 |
32 | int dwLowIndex, dwHighIndex; // Indices of interpolation points
33 | double dfLowIndex, dfHighIndex; // FP indices of interpolation points
34 | double dfTargetIndex; // Target index into interpolation table
35 | double dfRatio; // Ratio of LUT input points to curve values
36 | double dfLow, dfHigh; // Interpolation values
37 | double dfOut; // Output LUT value
38 |
39 | dfRatio = (double) (curve.count - 1) / (double) (dwNumInput - 1);
40 |
41 | for (int i = 0; i < dwNumInput; i++)
42 | {
43 | dfTargetIndex = (double) i * dfRatio;
44 | dfLowIndex = System.Math.Floor(dfTargetIndex);
45 | //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'"
46 | dwLowIndex = (int) dfLowIndex;
47 | dfHighIndex = System.Math.Ceiling(dfTargetIndex);
48 | //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'"
49 | dwHighIndex = (int) dfHighIndex;
50 |
51 | if (dwLowIndex == dwHighIndex)
52 | dfOut = ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
53 | else
54 | {
55 | dfLow = ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
56 | dfHigh = ICCCurveType.CurveToDouble(curve.entry(dwHighIndex));
57 | dfOut = dfLow + (dfHigh - dfLow) * (dfTargetIndex - dfLowIndex);
58 | }
59 |
60 | //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'"
61 | lut[i] = (byte) System.Math.Floor(dfOut * dwMaxOutput + 0.5);
62 | }
63 | }
64 |
65 | /* end class LookUpTable8Interp */
66 | }
67 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTableFP.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTableFP.java,v 1.1 2002/07/25 14:56:49 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// Toplevel class for a float [] lut.
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A. Kern
20 | ///
21 | public abstract class LookUpTableFP:LookUpTable
22 | {
23 |
24 | /// The lut values.
25 | //UPGRADE_NOTE: Final was removed from the declaration of 'lut '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
26 | public float[] lut;
27 |
28 | /// Factory method for getting a lut from a given curve.
29 | /// the data
30 | ///
31 | /// the size of the lut
32 | ///
33 | /// the lookup table
34 | ///
35 |
36 | public static LookUpTableFP createInstance(ICCCurveType curve, int dwNumInput)
37 | {
38 |
39 | if (curve.nEntries == 1)
40 | return new LookUpTableFPGamma(curve, dwNumInput);
41 | else
42 | return new LookUpTableFPInterp(curve, dwNumInput);
43 | }
44 |
45 | /// Construct an empty lut
46 | /// the size of the lut t lut.
47 | ///
48 | /// max output value of the lut
49 | ///
50 | protected internal LookUpTableFP(ICCCurveType curve, int dwNumInput):base(curve, dwNumInput)
51 | {
52 | lut = new float[dwNumInput];
53 | }
54 |
55 | /// lut accessor
56 | /// of the element
57 | ///
58 | /// the lut [index]
59 | ///
60 | public float elementAt(int index)
61 | {
62 | return lut[index];
63 | }
64 |
65 | /* end class LookUpTableFP */
66 | }
67 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTableFPGamma.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTableFPGamma.java,v 1.1 2002/07/25 14:56:48 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// Class Description
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A. Kern
20 | ///
21 |
22 | public class LookUpTableFPGamma:LookUpTableFP
23 | {
24 |
25 | internal double dfE = - 1;
26 | //UPGRADE_NOTE: Final was removed from the declaration of 'eol '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
27 | new private static readonly System.String eol = System.Environment.NewLine;
28 |
29 | public LookUpTableFPGamma(ICCCurveType curve, int dwNumInput):base(curve, dwNumInput)
30 | {
31 |
32 | // Gamma exponent for inverse transformation
33 | dfE = ICCCurveType.CurveGammaToDouble(curve.entry(0));
34 | for (int i = 0; i < dwNumInput; i++)
35 | {
36 | //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'"
37 | lut[i] = (float) System.Math.Pow((double) i / (dwNumInput - 1), dfE);
38 | }
39 | }
40 |
41 | /// Create an abbreviated string representation of a 16 bit lut.
42 | /// the lut as a String
43 | ///
44 | public override System.String ToString()
45 | {
46 | System.Text.StringBuilder rep = new System.Text.StringBuilder("[LookUpTableGamma ");
47 | //int row, col;
48 | rep.Append("dfe= " + dfE);
49 | rep.Append(", nentries= " + lut.Length);
50 | return rep.Append("]").ToString();
51 | }
52 |
53 |
54 | /* end class LookUpTableFPGamma */
55 | }
56 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/LookUpTableFPInterp.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: LookUpTableFPInterp.java,v 1.1 2002/07/25 14:56:48 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc.Lut
12 | {
13 |
14 | /// An interpolated floating point lut
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A.Kern
20 | ///
21 | public class LookUpTableFPInterp:LookUpTableFP
22 | {
23 |
24 | /// Create an abbreviated string representation of a 16 bit lut.
25 | /// the lut as a String
26 | ///
27 | public override System.String ToString()
28 | {
29 | System.Text.StringBuilder rep = new System.Text.StringBuilder("[LookUpTable32 ").Append(" nentries= " + lut.Length);
30 | return rep.Append("]").ToString();
31 | }
32 |
33 | /// Construct the lut from the curve data
34 | /// curve the data
35 | /// dwNumInput the lut size
36 | public LookUpTableFPInterp(ICCCurveType curve, int dwNumInput):base(curve, dwNumInput)
37 | {
38 |
39 | int dwLowIndex, dwHighIndex; // Indices of interpolation points
40 | double dfLowIndex, dfHighIndex; // FP indices of interpolation points
41 | double dfTargetIndex; // Target index into interpolation table
42 | double dfRatio; // Ratio of LUT input points to curve values
43 | double dfLow, dfHigh; // Interpolation values
44 |
45 | dfRatio = (double) (curve.nEntries - 1) / (double) (dwNumInput - 1);
46 |
47 | for (int i = 0; i < dwNumInput; i++)
48 | {
49 | dfTargetIndex = (double) i * dfRatio;
50 | dfLowIndex = System.Math.Floor(dfTargetIndex);
51 | //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'"
52 | dwLowIndex = (int) dfLowIndex;
53 | dfHighIndex = System.Math.Ceiling(dfTargetIndex);
54 | //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'"
55 | dwHighIndex = (int) dfHighIndex;
56 | if (dwLowIndex == dwHighIndex)
57 | {
58 | //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'"
59 | lut[i] = (float) ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
60 | }
61 | else
62 | {
63 | dfLow = ICCCurveType.CurveToDouble(curve.entry(dwLowIndex));
64 | dfHigh = ICCCurveType.CurveToDouble(curve.entry(dwHighIndex));
65 | //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'"
66 | lut[i] = (float) (dfLow + (dfHigh - dfLow) * (dfTargetIndex - dfLowIndex));
67 | }
68 | }
69 | }
70 |
71 | /* end class LookUpTableFPInterp */
72 | }
73 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/MatrixBasedTransformException.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: MatrixBasedTransformException.java,v 1.1 2002/07/25 14:56:49 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | namespace CSJ2K.Icc.Lut
11 | {
12 |
13 | /// Thrown by MatrixBasedTransformTosRGB
14 | ///
15 | ///
16 | ///
17 | ///
18 | /// 1.0
19 | ///
20 | /// Bruce A. Kern
21 | ///
22 |
23 | public class MatrixBasedTransformException:System.Exception
24 | {
25 |
26 | /// Contruct with message
27 | /// returned by getMessage()
28 | ///
29 | internal MatrixBasedTransformException(System.String msg):base(msg)
30 | {
31 | }
32 |
33 |
34 | /// Empty constructor
35 | internal MatrixBasedTransformException()
36 | {
37 | }
38 |
39 | /* end class MatrixBasedTransformException */
40 | }
41 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Lut/MonochromeTransformException.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: MonochromeTransformException.java,v 1.1 2002/07/25 14:56:49 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | namespace CSJ2K.Icc.Lut
11 | {
12 |
13 | /// Exception thrown by MonochromeTransformTosRGB.
14 | ///
15 | ///
16 | ///
17 | ///
18 | /// 1.0
19 | ///
20 | /// Bruce A. Kern
21 | ///
22 |
23 | public class MonochromeTransformException:System.Exception
24 | {
25 |
26 | /// Contruct with message
27 | /// returned by getMessage()
28 | ///
29 | internal MonochromeTransformException(System.String msg):base(msg)
30 | {
31 | }
32 |
33 | /// Empty constructor
34 | internal MonochromeTransformException()
35 | {
36 | }
37 |
38 | /* end class MonochromeTransformException */
39 | }
40 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/MatrixBasedRestrictedProfile.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: MatrixBasedRestrictedProfile.java,v 1.1 2002/07/25 14:56:56 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | using ICCXYZType = CSJ2K.Icc.Tags.ICCXYZType;
12 | namespace CSJ2K.Icc
13 | {
14 |
15 | /// This class is a 3 component RestrictedICCProfile
16 | ///
17 | ///
18 | /// 1.0
19 | ///
20 | /// Bruce A Kern
21 | ///
22 | public class MatrixBasedRestrictedProfile:RestrictedICCProfile
23 | {
24 | /// Get the type of RestrictedICCProfile for this object
25 | /// kThreeCompInput
26 | ///
27 | override public int Type
28 | {
29 | get
30 | {
31 | return kThreeCompInput;
32 | }
33 |
34 | }
35 |
36 | /// Factory method which returns a 3 component RestrictedICCProfile
37 | /// Red TRC curve
38 | ///
39 | /// Green TRC curve
40 | ///
41 | /// Blue TRC curve
42 | ///
43 | /// Red colorant
44 | ///
45 | /// Green colorant
46 | ///
47 | /// Blue colorant
48 | ///
49 | /// the RestrictedICCProfile
50 | ///
51 | public static new RestrictedICCProfile createInstance(ICCCurveType rcurve, ICCCurveType gcurve, ICCCurveType bcurve, ICCXYZType rcolorant, ICCXYZType gcolorant, ICCXYZType bcolorant)
52 | {
53 | return new MatrixBasedRestrictedProfile(rcurve, gcurve, bcurve, rcolorant, gcolorant, bcolorant);
54 | }
55 |
56 | /// Construct a 3 component RestrictedICCProfile
57 | /// Red TRC curve
58 | ///
59 | /// Green TRC curve
60 | ///
61 | /// Blue TRC curve
62 | ///
63 | /// Red colorant
64 | ///
65 | /// Green colorant
66 | ///
67 | /// Blue colorant
68 | ///
69 | protected internal MatrixBasedRestrictedProfile(ICCCurveType rcurve, ICCCurveType gcurve, ICCCurveType bcurve, ICCXYZType rcolorant, ICCXYZType gcolorant, ICCXYZType bcolorant):base(rcurve, gcurve, bcurve, rcolorant, gcolorant, bcolorant)
70 | {
71 | }
72 |
73 | /// String representation of a MatrixBasedRestrictedProfile
74 | ///
75 | public override System.String ToString()
76 | {
77 | System.Text.StringBuilder rep = new System.Text.StringBuilder("[Matrix-Based Input Restricted ICC profile").Append(eol);
78 |
79 | rep.Append("trc[RED]:").Append(eol).Append(trc[RED]).Append(eol);
80 | rep.Append("trc[RED]:").Append(eol).Append(trc[GREEN]).Append(eol);
81 | rep.Append("trc[RED]:").Append(eol).Append(trc[BLUE]).Append(eol);
82 |
83 | rep.Append("Red colorant: ").Append(colorant[RED]).Append(eol);
84 | rep.Append("Red colorant: ").Append(colorant[GREEN]).Append(eol);
85 | rep.Append("Red colorant: ").Append(colorant[BLUE]).Append(eol);
86 |
87 | return rep.Append("]").ToString();
88 | }
89 |
90 | /* end class MatrixBasedRestrictedProfile */
91 | }
92 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/MonochromeInputRestrictedProfile.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: MonochromeInputRestrictedProfile.java,v 1.1 2002/07/25 14:56:56 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCCurveType = CSJ2K.Icc.Tags.ICCCurveType;
11 | namespace CSJ2K.Icc
12 | {
13 |
14 | /// This class is a 1 component RestrictedICCProfile
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A Kern
20 | ///
21 | public class MonochromeInputRestrictedProfile:RestrictedICCProfile
22 | {
23 | /// Get the type of RestrictedICCProfile for this object
24 | /// kMonochromeInput
25 | ///
26 | override public int Type
27 | {
28 | get
29 | {
30 | return kMonochromeInput;
31 | }
32 |
33 | }
34 |
35 | /// Factory method which returns a 1 component RestrictedICCProfile
36 | /// Gray TRC curve
37 | ///
38 | /// the RestrictedICCProfile
39 | ///
40 | public static new RestrictedICCProfile createInstance(ICCCurveType c)
41 | {
42 | return new MonochromeInputRestrictedProfile(c);
43 | }
44 |
45 | /// Construct a 1 component RestrictedICCProfile
46 | /// Gray TRC curve
47 | ///
48 | private MonochromeInputRestrictedProfile(ICCCurveType c):base(c)
49 | {
50 | }
51 |
52 | /// String representation of a MonochromeInputRestrictedProfile
53 | ///
54 | public override System.String ToString()
55 | {
56 | System.Text.StringBuilder rep = new System.Text.StringBuilder("Monochrome Input Restricted ICC profile" + eol);
57 |
58 | rep.Append("trc[GRAY]:" + eol).Append(trc[GRAY]).Append(eol);
59 |
60 | return rep.ToString();
61 | }
62 |
63 | /* end class MonochromeInputRestrictedProfile */
64 | }
65 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Tags/ICCCurveType.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCCurveType.java,v 1.1 2002/07/25 14:56:36 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCProfile = CSJ2K.Icc.ICCProfile;
11 | namespace CSJ2K.Icc.Tags
12 | {
13 |
14 | /// The ICCCurve tag
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A. Kern
20 | ///
21 | public class ICCCurveType:ICCTag
22 | {
23 |
24 | //UPGRADE_NOTE: Final was removed from the declaration of 'eol '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
25 | private static readonly System.String eol = System.Environment.NewLine;
26 | /// Tag fields
27 | //UPGRADE_NOTE: Final was removed from the declaration of 'type '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
28 | new public int type;
29 | /// Tag fields
30 | //UPGRADE_NOTE: Final was removed from the declaration of 'reserved '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
31 | public int reserved;
32 | /// Tag fields
33 | //UPGRADE_NOTE: Final was removed from the declaration of 'nEntries '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
34 | public int nEntries;
35 | /// Tag fields
36 | //UPGRADE_NOTE: Final was removed from the declaration of 'entry '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
37 | public int[] entry_Renamed_Field;
38 |
39 | /// Return the string rep of this tag.
40 | public override System.String ToString()
41 | {
42 | System.Text.StringBuilder rep = new System.Text.StringBuilder("[").Append(base.ToString()).Append(" nentries = ").Append(System.Convert.ToString(nEntries)).Append(", length = " + System.Convert.ToString(entry_Renamed_Field.Length) + " ... ");
43 | return rep.Append("]").ToString();
44 | }
45 |
46 | /// Normalization utility
47 | public static double CurveToDouble(int entry)
48 | {
49 | return (double) entry / 65535.0;
50 | }
51 |
52 | /// Normalization utility
53 | public static short DoubleToCurve(double entry)
54 | {
55 | //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'"
56 | return (short) System.Math.Floor(entry * 65535.0 + 0.5);
57 | }
58 |
59 | /// Normalization utility
60 | public static double CurveGammaToDouble(int entry)
61 | {
62 | return (double) entry / 256.0;
63 | }
64 |
65 |
66 | /// Construct this tag from its constituant parts
67 | /// tag id
68 | ///
69 | /// array of bytes
70 | ///
71 | /// to data in the data array
72 | ///
73 | /// of data in the data array
74 | ///
75 | protected internal ICCCurveType(int signature, byte[] data, int offset, int length):base(signature, data, offset, offset + 2 * ICCProfile.int_size)
76 | {
77 | type = ICCProfile.getInt(data, offset);
78 | reserved = ICCProfile.getInt(data, offset + ICCProfile.int_size);
79 | nEntries = ICCProfile.getInt(data, offset + 2 * ICCProfile.int_size);
80 | entry_Renamed_Field = new int[nEntries];
81 | for (int i = 0; i < nEntries; ++i)
82 | entry_Renamed_Field[i] = ICCProfile.getShort(data, offset + 3 * ICCProfile.int_size + i * ICCProfile.short_size) & 0xFFFF;
83 | }
84 |
85 |
86 | /// Accessor for curve entry at index.
87 | public int entry(int i)
88 | {
89 | return entry_Renamed_Field[i];
90 | }
91 |
92 | /* end class ICCCurveType */
93 | }
94 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Tags/ICCDataType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CSJ2K.Icc;
3 |
4 | namespace CSJ2K.Icc.Tags
5 | {
6 | public class ICCDataType : ICCTag
7 | {
8 | new public int type;
9 | public int reserved;
10 | public int dataFlag;
11 | //byte[] Data;
12 |
13 | /// Construct this tag from its constituant parts
14 | /// tag id
15 | /// array of bytes
16 | /// to data in the data array
17 | /// of data in the data array
18 | protected internal ICCDataType(int signature, byte[] data, int offset, int length)
19 | : base(signature, data, offset, offset + 2 * ICCProfile.int_size)
20 | {
21 | type = ICCProfile.getInt(data, offset);
22 | reserved = ICCProfile.getInt(data, offset + ICCProfile.int_size);
23 | dataFlag = ICCProfile.getInt(data, offset + ICCProfile.int_size);
24 | //Data = ICCProfile.getString(data, offset + ICCProfile.int_size, length, true);
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Tags/ICCMeasurementType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CSJ2K.Icc;
3 | using CSJ2K.Icc.Types;
4 |
5 | namespace CSJ2K.Icc.Tags
6 | {
7 | public class ICCMeasurementType : ICCTag
8 | {
9 | new public int type;
10 | public int reserved;
11 | public int observer;
12 | public XYZNumber backing;
13 | public int geometry;
14 | public int flare;
15 | public int illuminant;
16 |
17 | /// Construct this tag from its constituant parts
18 | /// tag id
19 | /// array of bytes
20 | /// to data in the data array
21 | /// of data in the data array
22 | protected internal ICCMeasurementType(int signature, byte[] data, int offset, int length)
23 | : base(signature, data, offset, offset + 2 * ICCProfile.int_size)
24 | {
25 | type = ICCProfile.getInt(data, offset);
26 | reserved = ICCProfile.getInt(data, offset + ICCProfile.int_size);
27 | observer = ICCProfile.getInt(data, offset + ICCProfile.int_size);
28 | backing = ICCProfile.getXYZNumber(data, offset + ICCProfile.int_size);
29 | geometry = ICCProfile.getInt(data, offset + (ICCProfile.int_size*3));
30 | flare = ICCProfile.getInt(data, offset + ICCProfile.int_size);
31 | illuminant = ICCProfile.getInt(data, offset + ICCProfile.int_size);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Tags/ICCSignatureType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CSJ2K.Icc;
3 |
4 | namespace CSJ2K.Icc.Tags
5 | {
6 | public class ICCSignatureType : ICCTag
7 | {
8 | new public int type;
9 | public int reserved;
10 | new public int signature;
11 |
12 | /// Construct this tag from its constituant parts
13 | /// tag id
14 | /// array of bytes
15 | /// to data in the data array
16 | /// of data in the data array
17 | protected internal ICCSignatureType(int signature, byte[] data, int offset, int length)
18 | : base(signature, data, offset, offset + 2 * ICCProfile.int_size)
19 | {
20 | type = ICCProfile.getInt(data, offset);
21 | reserved = ICCProfile.getInt(data, offset + ICCProfile.int_size);
22 | signature = ICCProfile.getInt(data, offset + ICCProfile.int_size);
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Tags/ICCTextDescriptionType.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCTextDescriptionType.java,v 1.1 2002/07/25 14:56:37 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCProfile = CSJ2K.Icc.ICCProfile;
11 | namespace CSJ2K.Icc.Tags
12 | {
13 |
14 | /// A text based ICC tag
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A. Kern
20 | ///
21 | public class ICCTextDescriptionType:ICCTag
22 | {
23 |
24 | /// Tag fields
25 | //UPGRADE_NOTE: Final was removed from the declaration of 'type '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
26 | new public int type;
27 | /// Tag fields
28 | //UPGRADE_NOTE: Final was removed from the declaration of 'reserved '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
29 | public int reserved;
30 | /// Tag fields
31 | //UPGRADE_NOTE: Final was removed from the declaration of 'size '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
32 | public int size;
33 | /// Tag fields
34 | //UPGRADE_NOTE: Final was removed from the declaration of 'ascii '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
35 | public byte[] ascii;
36 |
37 | /// Construct this tag from its constituant parts
38 | /// tag id
39 | ///
40 | /// array of bytes
41 | ///
42 | /// to data in the data array
43 | ///
44 | /// of data in the data array
45 | ///
46 | protected internal ICCTextDescriptionType(int signature, byte[] data, int offset, int length):base(signature, data, offset, length)
47 | {
48 |
49 | type = ICCProfile.getInt(data, offset);
50 | offset += ICCProfile.int_size;
51 |
52 | reserved = ICCProfile.getInt(data, offset);
53 | offset += ICCProfile.int_size;
54 |
55 | size = ICCProfile.getInt(data, offset);
56 | offset += ICCProfile.int_size;
57 |
58 | ascii = new byte[size - 1];
59 | Array.Copy(data, offset, ascii, 0, size - 1);
60 | }
61 |
62 | /// Return the string rep of this tag.
63 | public override System.String ToString()
64 | {
65 | return "[" + base.ToString() + " \"" + System.Text.Encoding.UTF8.GetString(ascii, 0, ascii.Length) + "\"]";
66 | }
67 |
68 | /* end class ICCTextDescriptionType */
69 | }
70 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Tags/ICCTextType.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCTextType.java,v 1.1 2002/07/25 14:56:37 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCProfile = CSJ2K.Icc.ICCProfile;
11 | namespace CSJ2K.Icc.Tags
12 | {
13 |
14 | /// A text based ICC tag
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A. Kern
20 | ///
21 | public class ICCTextType:ICCTag
22 | {
23 |
24 | /// Tag fields
25 | //UPGRADE_NOTE: Final was removed from the declaration of 'type '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
26 | new public int type;
27 | /// Tag fields
28 | //UPGRADE_NOTE: Final was removed from the declaration of 'reserved '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
29 | public int reserved;
30 | /// Tag fields
31 | //UPGRADE_NOTE: Final was removed from the declaration of 'ascii '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
32 | public byte[] ascii;
33 |
34 | /// Construct this tag from its constituant parts
35 | /// tag id
36 | ///
37 | /// array of bytes
38 | ///
39 | /// to data in the data array
40 | ///
41 | /// of data in the data array
42 | ///
43 | protected internal ICCTextType(int signature, byte[] data, int offset, int length):base(signature, data, offset, length)
44 | {
45 | type = ICCProfile.getInt(data, offset);
46 | offset += ICCProfile.int_size;
47 | reserved = ICCProfile.getInt(data, offset);
48 | offset += ICCProfile.int_size;
49 | int size = 0;
50 | while (data[offset + size] != 0)
51 | ++size;
52 | ascii = new byte[size];
53 | Array.Copy(data, offset, ascii, 0, size);
54 | }
55 |
56 | /// Return the string rep of this tag.
57 | public override System.String ToString()
58 | {
59 | return "[" + base.ToString() + " \"" + System.Text.Encoding.UTF8.GetString(ascii, 0, ascii.Length) + "\"]";
60 | }
61 |
62 | /* end class ICCTextType */
63 | }
64 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Tags/ICCViewType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CSJ2K.Icc;
3 | using CSJ2K.Icc.Types;
4 |
5 | namespace CSJ2K.Icc.Tags
6 | {
7 | public class ICCViewType : ICCTag
8 | {
9 | new public int type;
10 | public int reserved;
11 | public XYZNumber CIEilluminant;
12 | public XYZNumber CIEsurround;
13 | public int illuminant;
14 |
15 | /// Construct this tag from its constituant parts
16 | /// tag id
17 | /// array of bytes
18 | /// to data in the data array
19 | /// of data in the data array
20 | protected internal ICCViewType(int signature, byte[] data, int offset, int length)
21 | : base(signature, data, offset, offset + 2 * ICCProfile.int_size)
22 | {
23 | type = ICCProfile.getInt(data, offset);
24 | reserved = ICCProfile.getInt(data, offset + ICCProfile.int_size);
25 | CIEilluminant = ICCProfile.getXYZNumber(data, offset + ICCProfile.int_size);
26 | CIEsurround = ICCProfile.getXYZNumber(data, offset + (ICCProfile.int_size*3));
27 | illuminant = ICCProfile.getInt(data, offset + (ICCProfile.int_size * 3));
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Tags/ICCXYZType.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCXYZType.java,v 1.1 2002/07/25 14:56:37 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCProfile = CSJ2K.Icc.ICCProfile;
11 | using XYZNumber = CSJ2K.Icc.Types.XYZNumber;
12 | namespace CSJ2K.Icc.Tags
13 | {
14 |
15 | /// A tag containing a triplet.
16 | ///
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 | /// 1.0
23 | ///
24 | /// Bruce A. Kern
25 | ///
26 | public class ICCXYZType:ICCTag
27 | {
28 |
29 | /// x component
30 | //UPGRADE_NOTE: Final was removed from the declaration of 'x '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
31 | public long x;
32 | /// y component
33 | //UPGRADE_NOTE: Final was removed from the declaration of 'y '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
34 | public long y;
35 | /// z component
36 | //UPGRADE_NOTE: Final was removed from the declaration of 'z '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
37 | public long z;
38 |
39 | /// Normalization utility
40 | public static long DoubleToXYZ(double x)
41 | {
42 | //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'"
43 | return (long) System.Math.Floor(x * 65536.0 + 0.5);
44 | }
45 |
46 | /// Normalization utility
47 | public static double XYZToDouble(long x)
48 | {
49 | return x / 65536.0;
50 | }
51 |
52 | /// Construct this tag from its constituant parts
53 | /// tag id
54 | ///
55 | /// array of bytes
56 | ///
57 | /// to data in the data array
58 | ///
59 | /// of data in the data array
60 | ///
61 | protected internal ICCXYZType(int signature, byte[] data, int offset, int length):base(signature, data, offset, length)
62 | {
63 | x = ICCProfile.getInt(data, offset + 2 * ICCProfile.int_size);
64 | y = ICCProfile.getInt(data, offset + 3 * ICCProfile.int_size);
65 | z = ICCProfile.getInt(data, offset + 4 * ICCProfile.int_size);
66 | }
67 |
68 |
69 | /// Return the string rep of this tag.
70 | public override System.String ToString()
71 | {
72 | return "[" + base.ToString() + "(" + x + ", " + y + ", " + z + ")]";
73 | }
74 |
75 |
76 | /// Write to a file.
77 | //UPGRADE_TODO: Class 'java.io.RandomAccessFile' was converted to 'System.IO.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioRandomAccessFile'"
78 | public virtual void write(System.IO.Stream raf)
79 | {
80 | byte[] xb = ICCProfile.setLong(x);
81 | byte[] yb = ICCProfile.setLong(y);
82 | byte[] zb = ICCProfile.setLong(z);
83 |
84 | // CONVERSION PROBLEM?
85 | raf.Write(xb, ICCProfile.int_size, 0);
86 | raf.Write(yb, ICCProfile.int_size, 0);
87 | raf.Write(zb, ICCProfile.int_size, 0);
88 | }
89 |
90 |
91 | /* end class ICCXYZType */
92 | }
93 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Tags/ICCXYZTypeReverse.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCXYZTypeReverse.java,v 1.1 2002/07/25 14:56:38 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCProfile = CSJ2K.Icc.ICCProfile;
11 | using XYZNumber = CSJ2K.Icc.Types.XYZNumber;
12 | namespace CSJ2K.Icc.Tags
13 | {
14 |
15 | /// A tag containing a triplet.
16 | ///
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 | /// 1.0
23 | ///
24 | /// Bruce A. Kern
25 | ///
26 | public class ICCXYZTypeReverse:ICCXYZType
27 | {
28 |
29 | /// x component
30 | //UPGRADE_NOTE: Final was removed from the declaration of 'x '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
31 | new public long x;
32 | /// y component
33 | //UPGRADE_NOTE: Final was removed from the declaration of 'y '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
34 | new public long y;
35 | /// z component
36 | //UPGRADE_NOTE: Final was removed from the declaration of 'z '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
37 | new public long z;
38 |
39 | /// Construct this tag from its constituant parts
40 | /// tag id
41 | ///
42 | /// array of bytes
43 | ///
44 | /// to data in the data array
45 | ///
46 | /// of data in the data array
47 | ///
48 | protected internal ICCXYZTypeReverse(int signature, byte[] data, int offset, int length):base(signature, data, offset, length)
49 | {
50 | z = ICCProfile.getInt(data, offset + 2 * ICCProfile.int_size);
51 | y = ICCProfile.getInt(data, offset + 3 * ICCProfile.int_size);
52 | x = ICCProfile.getInt(data, offset + 4 * ICCProfile.int_size);
53 | }
54 |
55 |
56 | /// Return the string rep of this tag.
57 | public override System.String ToString()
58 | {
59 | return "[" + base.ToString() + "(" + x + ", " + y + ", " + z + ")]";
60 | }
61 |
62 | /* end class ICCXYZTypeReverse */
63 | }
64 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Types/ICCDateTime.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCDateTime.java,v 1.1 2002/07/25 14:56:31 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCProfile = CSJ2K.Icc.ICCProfile;
11 | namespace CSJ2K.Icc.Types
12 | {
13 |
14 | /// Date Time format for tags
15 | ///
16 | ///
17 | /// 1.0
18 | ///
19 | /// Bruce A. Kern
20 | ///
21 | public class ICCDateTime
22 | {
23 | //UPGRADE_NOTE: Final was removed from the declaration of 'size '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
24 | //UPGRADE_NOTE: The initialization of 'size' was moved to static method 'icc.types.ICCDateTime'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
25 | public static readonly int size;
26 |
27 | /// Year datum.
28 | public short wYear;
29 | /// Month datum.
30 | // Number of the actual year (i.e. 1994)
31 | public short wMonth;
32 | /// Day datum.
33 | // Number of the month (1-12)
34 | public short wDay;
35 | /// Hour datum.
36 | // Number of the day
37 | public short wHours;
38 | /// Minute datum.
39 | // Number of hours (0-23)
40 | public short wMinutes;
41 | /// Second datum.
42 | // Number of minutes (0-59)
43 | public short wSeconds; // Number of seconds (0-59)
44 |
45 | /// Construct an ICCDateTime from parts
46 | public ICCDateTime(short year, short month, short day, short hour, short minute, short second)
47 | {
48 | wYear = year; wMonth = month; wDay = day;
49 | wHours = hour; wMinutes = minute; wSeconds = second;
50 | }
51 |
52 | /// Write an ICCDateTime to a file.
53 | //UPGRADE_TODO: Class 'java.io.RandomAccessFile' was converted to 'System.IO.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioRandomAccessFile'"
54 | public virtual void write(System.IO.Stream raf)
55 | {
56 | System.IO.BinaryWriter temp_BinaryWriter;
57 | temp_BinaryWriter = new System.IO.BinaryWriter(raf);
58 | temp_BinaryWriter.Write((System.Int16) wYear);
59 | System.IO.BinaryWriter temp_BinaryWriter2;
60 | temp_BinaryWriter2 = new System.IO.BinaryWriter(raf);
61 | temp_BinaryWriter2.Write((System.Int16) wMonth);
62 | System.IO.BinaryWriter temp_BinaryWriter3;
63 | temp_BinaryWriter3 = new System.IO.BinaryWriter(raf);
64 | temp_BinaryWriter3.Write((System.Int16) wDay);
65 | System.IO.BinaryWriter temp_BinaryWriter4;
66 | temp_BinaryWriter4 = new System.IO.BinaryWriter(raf);
67 | temp_BinaryWriter4.Write((System.Int16) wHours);
68 | System.IO.BinaryWriter temp_BinaryWriter5;
69 | temp_BinaryWriter5 = new System.IO.BinaryWriter(raf);
70 | temp_BinaryWriter5.Write((System.Int16) wMinutes);
71 | System.IO.BinaryWriter temp_BinaryWriter6;
72 | temp_BinaryWriter6 = new System.IO.BinaryWriter(raf);
73 | temp_BinaryWriter6.Write((System.Int16) wSeconds);
74 | }
75 |
76 | /// Return a ICCDateTime representation.
77 | public override System.String ToString()
78 | {
79 | //System.String rep = "";
80 | return System.Convert.ToString(wYear) + "/" + System.Convert.ToString(wMonth) + "/" + System.Convert.ToString(wDay) + " " + System.Convert.ToString(wHours) + ":" + System.Convert.ToString(wMinutes) + ":" + System.Convert.ToString(wSeconds);
81 | }
82 |
83 | /* end class ICCDateTime*/
84 | static ICCDateTime()
85 | {
86 | size = 6 * ICCProfile.short_size;
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Types/ICCProfileVersion.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: ICCProfileVersion.java,v 1.1 2002/07/25 14:56:31 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCProfile = CSJ2K.Icc.ICCProfile;
11 | namespace CSJ2K.Icc.Types
12 | {
13 |
14 | /// This class describes the ICCProfile Version as contained in
15 | /// the header of the ICC Profile.
16 | ///
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 | /// 1.0
23 | ///
24 | /// Bruce A. Kern
25 | ///
26 | public class ICCProfileVersion
27 | {
28 | /// Field size
29 | //UPGRADE_NOTE: Final was removed from the declaration of 'size '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
30 | //UPGRADE_NOTE: The initialization of 'size' was moved to static method 'icc.types.ICCProfileVersion'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
31 | public static readonly int size;
32 |
33 | /// Major revision number in binary coded decimal
34 | public byte uMajor;
35 | /// Minor revision in high nibble, bug fix revision
36 | /// in low nibble, both in binary coded decimal
37 | ///
38 | public byte uMinor;
39 |
40 | private byte reserved1;
41 | private byte reserved2;
42 |
43 | /// Construct from constituent parts.
44 | public ICCProfileVersion(byte major, byte minor, byte res1, byte res2)
45 | {
46 | uMajor = major; uMinor = minor; reserved1 = res1; reserved2 = res2;
47 | }
48 |
49 | /// Construct from file content.
50 | //UPGRADE_TODO: Class 'java.io.RandomAccessFile' was converted to 'System.IO.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioRandomAccessFile'"
51 | public virtual void write(System.IO.Stream raf)
52 | {
53 | raf.WriteByte(uMajor); raf.WriteByte(uMinor); raf.WriteByte(reserved1); raf.WriteByte(reserved2);
54 | }
55 |
56 | /// String representation of class instance.
57 | public override System.String ToString()
58 | {
59 | return "Version " + uMajor + "." + uMinor;
60 | }
61 |
62 | /* end class ICCProfileVersion */
63 | static ICCProfileVersion()
64 | {
65 | size = 4 * ICCProfile.byte_size;
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/CSJ2K/Icc/Types/XYZNumber.cs:
--------------------------------------------------------------------------------
1 | /// **************************************************************************
2 | ///
3 | /// $Id: XYZNumber.java,v 1.1 2002/07/25 14:56:31 grosbois Exp $
4 | ///
5 | /// Copyright Eastman Kodak Company, 343 State Street, Rochester, NY 14650
6 | /// $Date $
7 | /// ***************************************************************************
8 | ///
9 | using System;
10 | using ICCProfile = CSJ2K.Icc.ICCProfile;
11 | namespace CSJ2K.Icc.Types
12 | {
13 |
14 | /// A convientient representation for the contents of the
15 | /// ICCXYZTypeTag class.
16 | ///
17 | ///
18 | ///
19 | ///
20 | /// 1.0
21 | ///
22 | /// Bruce A. Kern
23 | ///
24 | public class XYZNumber
25 | {
26 | //UPGRADE_NOTE: Final was removed from the declaration of 'size '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
27 | //UPGRADE_NOTE: The initialization of 'size' was moved to static method 'icc.types.XYZNumber'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'"
28 | public static readonly int size;
29 |
30 | /// x value
31 | public int dwX;
32 | /// y value
33 | // X tristimulus value
34 | public int dwY;
35 | /// z value
36 | // Y tristimulus value
37 | public int dwZ; // Z tristimulus value
38 |
39 | /// Construct from constituent parts.
40 | public XYZNumber(int x, int y, int z)
41 | {
42 | dwX = x; dwY = y; dwZ = z;
43 | }
44 |
45 | /// Normalization utility
46 | public static int DoubleToXYZ(double x)
47 | {
48 | //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'"
49 | return (int) System.Math.Floor(x * 65536.0 + 0.5);
50 | }
51 |
52 | /// Normalization utility
53 | public static double XYZToDouble(int x)
54 | {
55 | return (double) x / 65536.0;
56 | }
57 |
58 | /// Write to a file
59 | //UPGRADE_TODO: Class 'java.io.RandomAccessFile' was converted to 'System.IO.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioRandomAccessFile'"
60 | public virtual void write(System.IO.Stream raf)
61 | {
62 | System.IO.BinaryWriter temp_BinaryWriter;
63 | temp_BinaryWriter = new System.IO.BinaryWriter(raf);
64 | temp_BinaryWriter.Write((System.Int32) dwX);
65 | System.IO.BinaryWriter temp_BinaryWriter2;
66 | temp_BinaryWriter2 = new System.IO.BinaryWriter(raf);
67 | temp_BinaryWriter2.Write((System.Int32) dwY);
68 | System.IO.BinaryWriter temp_BinaryWriter3;
69 | temp_BinaryWriter3 = new System.IO.BinaryWriter(raf);
70 | temp_BinaryWriter3.Write((System.Int32) dwZ);
71 | }
72 |
73 | /// String representation of class instance.
74 | public override System.String ToString()
75 | {
76 | return "[" + dwX + ", " + dwY + ", " + dwZ + "]";
77 | }
78 |
79 |
80 | /* end class XYZNumber */
81 | static XYZNumber()
82 | {
83 | size = 3 * ICCProfile.int_size;
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/CSJ2K/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 |
7 | [assembly: AssemblyTitle ("CSJ2K")]
8 | [assembly: AssemblyDescription ("")]
9 | [assembly: AssemblyConfiguration ("")]
10 | [assembly: AssemblyCompany ("")]
11 | [assembly: AssemblyProduct ("")]
12 | [assembly: AssemblyCopyright ("Lucas Teske")]
13 | [assembly: AssemblyTrademark ("")]
14 | [assembly: AssemblyCulture ("")]
15 |
16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
19 |
20 | [assembly: AssemblyVersion ("1.0.*")]
21 |
22 | // The following attributes are used to specify the signing key for the assembly,
23 | // if desired. See the Mono documentation for more information about signing.
24 |
25 | //[assembly: AssemblyDelaySign(false)]
26 | //[assembly: AssemblyKeyFile("")]
27 |
28 |
--------------------------------------------------------------------------------
/CSJ2K/README.md:
--------------------------------------------------------------------------------
1 | CSJ2K for OSP
2 | =============
3 |
4 | This is a modified version of CSJ2K to be used in OpenSatelliteProject based in https://github.com/cureos/csj2k/commit/0e16edc333d31ec9826496dd19e1b439630e2aeb. The original version can be found at https://github.com/cureos/csj2k
5 |
6 | Copyright (c) 1999-2000 JJ2000 Partners; original C# port (c) 2007-2012 Jason S. Clary; C# encoding and adaptation to Portable Class Library with platform specific support (c) 2013-2016 Anders Gustafsson, Cureos AB; Modifications for OpenSatelliteProject by Lucas Teske.
7 |
8 | Licensed and distributable under the terms of the [BSDLicense](http://www.opensource.org/licenses/bsd-license.php)
--------------------------------------------------------------------------------
/CSJ2K/Util/BitmapImage.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using System.Drawing;
7 | using System.Drawing.Imaging;
8 |
9 | internal class BitmapImage : ImageBase
10 | {
11 | #region CONSTRUCTORS
12 |
13 | internal BitmapImage(int width, int height, byte[] bytes)
14 | : base(width, height, bytes)
15 | {
16 | }
17 |
18 | #endregion
19 |
20 | #region METHODS
21 |
22 | protected override object GetImageObject()
23 | {
24 | var bitmap = new Bitmap(Width, Height, PixelFormat.Format32bppArgb);
25 |
26 | var dstdata = bitmap.LockBits(
27 | new Rectangle(0, 0, Width, Height),
28 | ImageLockMode.ReadWrite,
29 | bitmap.PixelFormat);
30 |
31 | var ptr = dstdata.Scan0;
32 | System.Runtime.InteropServices.Marshal.Copy(Bytes, 0, ptr, Bytes.Length);
33 | bitmap.UnlockBits(dstdata);
34 |
35 | return bitmap;
36 | }
37 |
38 | #endregion
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/CSJ2K/Util/BitmapImageCreator.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using CSJ2K.j2k.image;
7 |
8 | public class BitmapImageCreator : IImageCreator
9 | {
10 | #region FIELDS
11 |
12 | private static readonly IImageCreator Instance = new BitmapImageCreator();
13 |
14 | #endregion
15 |
16 | #region PROPERTIES
17 |
18 | public bool IsDefault
19 | {
20 | get
21 | {
22 | return false;
23 | }
24 | }
25 |
26 | #endregion
27 |
28 | #region METHODS
29 |
30 | public static void Register()
31 | {
32 | ImageFactory.Register(Instance);
33 | }
34 |
35 | public IImage Create(int width, int height, byte[] bytes)
36 | {
37 | return new BitmapImage(width, height, bytes);
38 | }
39 |
40 | public BlkImgDataSrc ToPortableImageSource(object imageObject)
41 | {
42 | return BitmapImageSource.Create(imageObject);
43 | }
44 |
45 | #endregion
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/CSJ2K/Util/BitmapImageSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using System;
7 | using System.Drawing;
8 | using System.Drawing.Imaging;
9 | using System.Linq;
10 |
11 | using CSJ2K.j2k.image;
12 |
13 | internal class BitmapImageSource : PortableImageSource
14 | {
15 | #region CONSTRUCTORS
16 |
17 | private BitmapImageSource(Bitmap bitmap)
18 | : base(
19 | bitmap.Width,
20 | bitmap.Height,
21 | GetNumberOfComponents(bitmap.PixelFormat),
22 | GetRangeBits(bitmap.PixelFormat),
23 | GetSignedArray(bitmap.PixelFormat),
24 | GetComponents(bitmap))
25 | {
26 | }
27 |
28 | #endregion
29 |
30 | #region METHODS
31 |
32 |
33 | internal static BlkImgDataSrc Create(object imageObject)
34 | {
35 | var bitmap = imageObject as Bitmap;
36 | return bitmap == null ? null : new BitmapImageSource(bitmap);
37 | }
38 |
39 | private static int GetNumberOfComponents(PixelFormat pixelFormat)
40 | {
41 | switch (pixelFormat)
42 | {
43 | case PixelFormat.Format16bppGrayScale:
44 | case PixelFormat.Format1bppIndexed:
45 | case PixelFormat.Format4bppIndexed:
46 | case PixelFormat.Format8bppIndexed:
47 | return 1;
48 | case PixelFormat.Format24bppRgb:
49 | case PixelFormat.Format32bppArgb:
50 | case PixelFormat.Format32bppPArgb:
51 | case PixelFormat.Format32bppRgb:
52 | return 3;
53 | default:
54 | throw new ArgumentOutOfRangeException("pixelFormat");
55 | }
56 | }
57 |
58 | private static int GetRangeBits(PixelFormat pixelFormat)
59 | {
60 | switch (pixelFormat)
61 | {
62 | case PixelFormat.Format16bppGrayScale:
63 | return 16;
64 | case PixelFormat.Format1bppIndexed:
65 | return 1;
66 | case PixelFormat.Format4bppIndexed:
67 | return 4;
68 | case PixelFormat.Format8bppIndexed:
69 | case PixelFormat.Format24bppRgb:
70 | case PixelFormat.Format32bppArgb:
71 | case PixelFormat.Format32bppPArgb:
72 | case PixelFormat.Format32bppRgb:
73 | return 8;
74 | default:
75 | throw new ArgumentOutOfRangeException("pixelFormat");
76 | }
77 | }
78 |
79 | private static bool[] GetSignedArray(PixelFormat pixelFormat)
80 | {
81 | return Enumerable.Repeat(false, GetNumberOfComponents(pixelFormat)).ToArray();
82 | }
83 |
84 | private static int[][] GetComponents(Bitmap bitmap)
85 | {
86 | var w = bitmap.Width;
87 | var h = bitmap.Height;
88 | var nc = GetNumberOfComponents(bitmap.PixelFormat);
89 |
90 | var comps = new int[nc][];
91 | for (var c = 0; c < nc; ++c) comps[c] = new int[w * h];
92 |
93 | for (int y = 0, xy = 0; y < h; ++y)
94 | {
95 | for (var x = 0; x < w; ++x, ++xy)
96 | {
97 | var color = bitmap.GetPixel(x, y);
98 | for (var c = 0; c < nc; ++c)
99 | {
100 | comps[c][xy] = c == 0 ? color.R : c == 1 ? color.G : color.B;
101 | }
102 | }
103 | }
104 |
105 | return comps;
106 | }
107 |
108 | #endregion
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/CSJ2K/Util/DotnetFileInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using System;
7 | using System.IO;
8 |
9 | internal class DotnetFileInfo : IFileInfo
10 | {
11 | #region FIELDS
12 |
13 | private readonly FileInfo _fileInfo;
14 |
15 | #endregion
16 |
17 | #region CONSTRUCTORS
18 |
19 | internal DotnetFileInfo(string fileName)
20 | {
21 | _fileInfo = new FileInfo(fileName);
22 | }
23 |
24 | #endregion
25 |
26 | #region PROPERTIES
27 |
28 | public string Name
29 | {
30 | get
31 | {
32 | return _fileInfo.Name;
33 | }
34 | }
35 |
36 | public string FullName
37 | {
38 | get
39 | {
40 | return _fileInfo.FullName;
41 | }
42 | }
43 |
44 | public bool Exists
45 | {
46 | get
47 | {
48 | return _fileInfo.Exists;
49 | }
50 | }
51 |
52 | #endregion
53 |
54 | #region METHODS
55 |
56 | public bool Delete()
57 | {
58 | try
59 | {
60 | _fileInfo.Delete();
61 | return true;
62 | }
63 | catch (Exception)
64 | {
65 | return false;
66 | }
67 | }
68 |
69 | #endregion
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/CSJ2K/Util/DotnetFileInfoCreator.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | public class DotnetFileInfoCreator : IFileInfoCreator
7 | {
8 | #region FIELDS
9 |
10 | private static readonly IFileInfoCreator Instance = new DotnetFileInfoCreator();
11 |
12 | #endregion
13 |
14 | #region METHODS
15 |
16 | public static void Register()
17 | {
18 | FileInfoFactory.Register(Instance);
19 | }
20 |
21 | public IFileInfo Create(string fileName)
22 | {
23 | return new DotnetFileInfo(fileName);
24 | }
25 |
26 | #endregion
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/CSJ2K/Util/DotnetFileStreamCreator.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using System;
7 | using System.IO;
8 |
9 | public class DotnetFileStreamCreator : IFileStreamCreator
10 | {
11 | #region FIELDS
12 |
13 | private static readonly IFileStreamCreator Instance = new DotnetFileStreamCreator();
14 |
15 | #endregion
16 |
17 | #region METHODS
18 |
19 | public static void Register()
20 | {
21 | FileStreamFactory.Register(Instance);
22 | }
23 |
24 | public Stream Create(string path, string mode)
25 | {
26 | if (mode.Equals("rw", StringComparison.OrdinalIgnoreCase)) return new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite);
27 | if (mode.Equals("r", StringComparison.OrdinalIgnoreCase)) return new FileStream(path, FileMode.Open, FileAccess.Read);
28 | throw new ArgumentException(String.Format("File mode: {0} not supported.", mode), "mode");
29 | }
30 |
31 | #endregion
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/CSJ2K/Util/DotnetMsgLogger.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using System;
7 |
8 | using CSJ2K.j2k.util;
9 |
10 | public class DotnetMsgLogger : StreamMsgLogger
11 | {
12 | #region FIELDS
13 |
14 | private static readonly IMsgLogger Instance = new DotnetMsgLogger();
15 |
16 | #endregion
17 |
18 | #region CONSTRUCTORS
19 |
20 | public DotnetMsgLogger()
21 | : base(Console.OpenStandardOutput(), Console.OpenStandardError(), 78)
22 | {
23 | }
24 |
25 | #endregion
26 |
27 | #region METHODS
28 |
29 | public static void Register()
30 | {
31 | FacilityManager.DefaultMsgLogger = Instance;
32 | }
33 |
34 | #endregion
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/CSJ2K/Util/FileInfoFactory.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using System;
7 |
8 | public static class FileInfoFactory
9 | {
10 | #region FIELDS
11 |
12 | private static IFileInfoCreator _creator;
13 |
14 | #endregion
15 |
16 | #region CONSTRUCTORS
17 |
18 | static FileInfoFactory()
19 | {
20 | _creator = J2kSetup.GetSinglePlatformInstance();
21 | }
22 |
23 | #endregion
24 |
25 | #region METHODS
26 |
27 | public static void Register(IFileInfoCreator creator)
28 | {
29 | _creator = creator;
30 | }
31 |
32 | internal static IFileInfo New(string fileName)
33 | {
34 | if (_creator == null) throw new InvalidOperationException("No file info creator is registered.");
35 | if (fileName == null) throw new ArgumentNullException("fileName");
36 |
37 | return _creator.Create(fileName);
38 | }
39 |
40 | #endregion
41 | }
42 | }
--------------------------------------------------------------------------------
/CSJ2K/Util/FileStreamFactory.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using System;
7 | using System.IO;
8 |
9 | public class FileStreamFactory
10 | {
11 | #region FIELDS
12 |
13 | private static IFileStreamCreator _creator;
14 |
15 | #endregion
16 |
17 | #region CONSTRUCTORS
18 |
19 | static FileStreamFactory()
20 | {
21 | _creator = J2kSetup.GetSinglePlatformInstance();
22 | }
23 |
24 | #endregion
25 |
26 | #region METHODS
27 |
28 | public static void Register(IFileStreamCreator creator)
29 | {
30 | _creator = creator;
31 | }
32 |
33 | internal static Stream New(string path, string mode)
34 | {
35 | if (_creator == null) throw new InvalidOperationException("No file stream creator is registered.");
36 | if (path == null) throw new ArgumentNullException("path");
37 | if (mode == null) throw new ArgumentNullException("mode");
38 |
39 | return _creator.Create(path, mode);
40 | }
41 |
42 | #endregion
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/CSJ2K/Util/IDefaultable.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2016 fo-dicom contributors.
2 | // Licensed under the Microsoft Public License (MS-PL).
3 |
4 | namespace CSJ2K.Util
5 | {
6 | ///
7 | /// Interface for default classification of manager types.
8 | ///
9 | public interface IDefaultable
10 | {
11 | ///
12 | /// Gets whether or not this type is classified as a default manager.
13 | ///
14 | bool IsDefault { get; }
15 | }
16 | }
--------------------------------------------------------------------------------
/CSJ2K/Util/IFileInfo.cs:
--------------------------------------------------------------------------------
1 | namespace CSJ2K.Util
2 | {
3 | public interface IFileInfo
4 | {
5 | #region PROPERTIES
6 |
7 | string Name { get; }
8 |
9 | string FullName { get; }
10 |
11 | bool Exists { get; }
12 |
13 | #endregion
14 |
15 | #region METHODS
16 |
17 | bool Delete();
18 |
19 | #endregion
20 | }
21 | }
--------------------------------------------------------------------------------
/CSJ2K/Util/IFileInfoCreator.cs:
--------------------------------------------------------------------------------
1 | namespace CSJ2K.Util
2 | {
3 | public interface IFileInfoCreator
4 | {
5 | #region METHODS
6 |
7 | IFileInfo Create(string fileName);
8 |
9 | #endregion
10 | }
11 | }
--------------------------------------------------------------------------------
/CSJ2K/Util/IFileStreamCreator.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using System.IO;
7 |
8 | public interface IFileStreamCreator
9 | {
10 | Stream Create(string path, string mode);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/CSJ2K/Util/IImage.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | public interface IImage
7 | {
8 | #region METHODS
9 |
10 | T As();
11 |
12 | #endregion
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/CSJ2K/Util/IImageCreator.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using CSJ2K.j2k.image;
7 |
8 | public interface IImageCreator : IDefaultable
9 | {
10 | IImage Create(int width, int height, byte[] bytes);
11 |
12 | BlkImgDataSrc ToPortableImageSource(object imageObject);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/CSJ2K/Util/ImageBase.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using System;
7 | using System.Reflection;
8 |
9 |
10 | public abstract class ImageBase : IImage
11 | {
12 | #region FIELDS
13 |
14 | protected const int SizeOfArgb = 4;
15 |
16 | #endregion
17 |
18 | #region CONSTRUCTORS
19 |
20 | protected ImageBase(int width, int height, byte[] bytes)
21 | {
22 | Width = width;
23 | Height = height;
24 | Bytes = bytes;
25 | }
26 |
27 | #endregion
28 |
29 | #region PROPERTIES
30 |
31 | protected int Width { get; }
32 |
33 | protected int Height { get; }
34 |
35 | protected byte[] Bytes { get; }
36 |
37 | #endregion
38 |
39 | #region METHODS
40 |
41 | public virtual T As()
42 | {
43 | #if NETFX_CORE || NETSTANDARD
44 | if (!typeof(TBase).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()))
45 | #else
46 | if (!typeof(TBase).IsAssignableFrom(typeof(T)))
47 | #endif
48 | {
49 | throw new InvalidCastException(
50 | $"Cannot cast to '{typeof(T).Name}'; type must be assignable from '{typeof(TBase).Name}'");
51 | }
52 |
53 | return (T)GetImageObject();
54 | }
55 |
56 | protected abstract object GetImageObject();
57 |
58 | #endregion
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/CSJ2K/Util/ImageFactory.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007-2016 CSJ2K contributors.
2 | // Licensed under the BSD 3-Clause License.
3 |
4 | namespace CSJ2K.Util
5 | {
6 | using CSJ2K.j2k.image;
7 |
8 | public static class ImageFactory
9 | {
10 | #region FIELDS
11 |
12 | private static IImageCreator _creator;
13 |
14 | #endregion
15 |
16 | #region CONSTRUCTORS
17 |
18 | static ImageFactory()
19 | {
20 | _creator = J2kSetup.GetDefaultPlatformInstance();
21 | }
22 |
23 | #endregion
24 |
25 | #region METHODS
26 |
27 | public static void Register(IImageCreator creator)
28 | {
29 | _creator = creator;
30 | }
31 |
32 | internal static IImage New(int width, int height, byte[] bytes)
33 | {
34 | return _creator.Create(width, height, bytes);
35 | }
36 |
37 | internal static BlkImgDataSrc ToPortableImageSource(object imageObject)
38 | {
39 | try
40 | {
41 | return _creator.ToPortableImageSource(imageObject);
42 | }
43 | catch
44 | {
45 | return null;
46 | }
47 | }
48 |
49 | #endregion
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/CSJ2K/j2k/IntegerSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/IntegerSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/JJ2KExceptionHandler.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/JJ2KExceptionHandler.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/JJ2KInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/JJ2KInfo.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/ModuleSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/ModuleSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/NoNextElementException.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/NoNextElementException.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/StringSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/StringSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/CBlkCoordInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/CBlkCoordInfo.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/CoordInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/CoordInfo.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/CorruptedCodestreamException.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/CorruptedCodestreamException.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/HeaderInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/HeaderInfo.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/Markers.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/Markers.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/PrecCoordInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/PrecCoordInfo.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/PrecInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/PrecInfo.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/ProgressionType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/ProgressionType.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/reader/BitstreamReaderAgent.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/reader/BitstreamReaderAgent.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/reader/CBlkInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/reader/CBlkInfo.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/reader/FileBitstreamReaderAgent.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/reader/FileBitstreamReaderAgent.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/reader/HeaderDecoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/reader/HeaderDecoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/reader/PktDecoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/reader/PktDecoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/reader/PktHeaderBitReader.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/reader/PktHeaderBitReader.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/reader/PktInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/reader/PktInfo.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/reader/TagTreeDecoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/reader/TagTreeDecoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/writer/CodestreamWriter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/writer/CodestreamWriter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/writer/FileCodestreamWriter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/writer/FileCodestreamWriter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/writer/HeaderEncoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/writer/HeaderEncoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/writer/PktEncoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/writer/PktEncoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/decoder/DecoderSpecs.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/decoder/DecoderSpecs.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/encoder/EncoderSpecs.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/encoder/EncoderSpecs.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/CBlkSizeSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/CBlkSizeSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/CodedCBlk.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/CodedCBlk.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/PrecinctSizeSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/PrecinctSizeSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/Progression.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/Progression.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/ProgressionSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/ProgressionSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/StdEntropyCoderOptions.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/StdEntropyCoderOptions.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/decoder/ByteToBitInput.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/decoder/ByteToBitInput.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/decoder/CodedCBlkDataSrcDec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/decoder/CodedCBlkDataSrcDec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/decoder/DecLyrdCBlk.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/decoder/DecLyrdCBlk.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/decoder/EntropyDecoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/decoder/EntropyDecoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/decoder/MQDecoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/decoder/MQDecoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/decoder/StdEntropyDecoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/decoder/StdEntropyDecoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/BitToByteOutput.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/BitToByteOutput.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/CodedCBlkDataSrcEnc.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/CodedCBlkDataSrcEnc.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/EBCOTLayer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/EBCOTLayer.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/EBCOTRateAllocator.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/EBCOTRateAllocator.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/EntropyCoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/EntropyCoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/LayersInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/LayersInfo.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/MQCoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/MQCoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/PostCompRateAllocator.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/PostCompRateAllocator.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/entropy/encoder/StdEntropyCoder.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/entropy/encoder/StdEntropyCoder.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/fileformat/FileFormatBoxes.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/fileformat/FileFormatBoxes.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/fileformat/reader/FileFormatReader.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/fileformat/reader/FileFormatReader.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/fileformat/writer/FileFormatWriter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/fileformat/writer/FileFormatWriter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/BlkImgDataSrc.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/BlkImgDataSrc.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/CompTransfSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/CompTransfSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/Coord.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/Coord.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/DataBlk.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/DataBlk.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/DataBlkFloat.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/DataBlkFloat.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/DataBlkInt.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/DataBlkInt.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/ImgData.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/ImgData.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/ImgDataAdapter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/ImgDataAdapter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/ImgDataConverter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/ImgDataConverter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/ImgDataJoiner.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/ImgDataJoiner.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/Tiler.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/Tiler.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/forwcomptransf/ForwCompTransfSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/forwcomptransf/ForwCompTransfSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/input/ImgReader.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/input/ImgReader.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/input/ImgReaderPGM.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/input/ImgReaderPGM.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/input/ImgReaderPGX.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/input/ImgReaderPGX.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/input/ImgReaderPPM.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/input/ImgReaderPPM.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/output/ImgWriter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/output/ImgWriter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/output/ImgWriterPGM.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/output/ImgWriterPGM.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/output/ImgWriterPGX.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/output/ImgWriterPGX.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/image/output/ImgWriterPPM.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/image/output/ImgWriterPPM.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/io/BEBufferedRandomAccessFile.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/io/BEBufferedRandomAccessFile.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/io/BinaryDataInput.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/io/BinaryDataInput.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/io/BinaryDataOutput.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/io/BinaryDataOutput.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/io/BufferedRandomAccessFile.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/io/BufferedRandomAccessFile.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/io/EndianType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/io/EndianType.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/io/RandomAccessIO.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/io/RandomAccessIO.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/GuardBitsSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/GuardBitsSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/QuantStepSizeSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/QuantStepSizeSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/QuantTypeSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/QuantTypeSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/QuantizationType.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/QuantizationType.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/dequantizer/CBlkQuantDataSrcDec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/dequantizer/CBlkQuantDataSrcDec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/dequantizer/Dequantizer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/dequantizer/Dequantizer.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/dequantizer/DequantizerParams.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/dequantizer/DequantizerParams.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/dequantizer/StdDequantizer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/dequantizer/StdDequantizer.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/dequantizer/StdDequantizerParams.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/dequantizer/StdDequantizerParams.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/quantizer/CBlkQuantDataSrcEnc.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/quantizer/CBlkQuantDataSrcEnc.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/quantizer/Quantizer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/quantizer/Quantizer.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/quantization/quantizer/StdQuantizer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/quantization/quantizer/StdQuantizer.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/roi/MaxShiftSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/roi/MaxShiftSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/roi/ROIDeScaler.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/roi/ROIDeScaler.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/roi/encoder/ArbROIMaskGenerator.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/roi/encoder/ArbROIMaskGenerator.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/roi/encoder/ROI.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/roi/encoder/ROI.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/roi/encoder/ROIMaskGenerator.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/roi/encoder/ROIMaskGenerator.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/roi/encoder/ROIScaler.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/roi/encoder/ROIScaler.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/roi/encoder/RectROIMaskGenerator.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/roi/encoder/RectROIMaskGenerator.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/roi/encoder/SubbandROIMask.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/roi/encoder/SubbandROIMask.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/roi/encoder/SubbandRectROIMask.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/roi/encoder/SubbandRectROIMask.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/ArrayUtil.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/ArrayUtil.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/CodestreamManipulator.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/CodestreamManipulator.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/FacilityManager.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/FacilityManager.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/IMsgLogger.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/IMsgLogger.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/ISRandomAccessIO.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/ISRandomAccessIO.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/MathUtil.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/MathUtil.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/MsgPrinter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/MsgPrinter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/ParameterList.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/ParameterList.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/ProgressWatch.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/ProgressWatch.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/StreamMsgLogger.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/StreamMsgLogger.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/util/StringFormatException.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/util/StringFormatException.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/FilterTypes.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/FilterTypes.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/Subband.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/Subband.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/WTDecompSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/WTDecompSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/WTFilterSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/WTFilterSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/WaveletFilter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/WaveletFilter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/WaveletTransform.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/WaveletTransform.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/AnWTFilter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/AnWTFilter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloat.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloat.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloatLift9x7.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloatLift9x7.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/AnWTFilterInt.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/AnWTFilterInt.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/AnWTFilterIntLift5x3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/AnWTFilterIntLift5x3.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/AnWTFilterSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/AnWTFilterSpec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/CBlkWTData.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/CBlkWTData.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/CBlkWTDataFloat.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/CBlkWTDataFloat.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/CBlkWTDataInt.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/CBlkWTDataInt.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/CBlkWTDataSrc.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/CBlkWTDataSrc.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/ForwWT.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/ForwWT.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/ForwWTDataProps.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/ForwWTDataProps.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/ForwWTFull.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/ForwWTFull.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/ForwardWT.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/ForwardWT.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/analysis/SubbandAn.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/analysis/SubbandAn.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/CBlkWTDataSrcDec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/CBlkWTDataSrcDec.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/InvWT.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/InvWT.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/InvWTAdapter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/InvWTAdapter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/InvWTData.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/InvWTData.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/InvWTFull.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/InvWTFull.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/InverseWT.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/InverseWT.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/MultiResImgData.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/MultiResImgData.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/MultiResImgDataAdapter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/MultiResImgDataAdapter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/SubbandSyn.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/SubbandSyn.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/SynWTFilter.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/SynWTFilter.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloat.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloat.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloatLift9x7.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloatLift9x7.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/SynWTFilterInt.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/SynWTFilterInt.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/SynWTFilterIntLift5x3.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/SynWTFilterIntLift5x3.cs
--------------------------------------------------------------------------------
/CSJ2K/j2k/wavelet/synthesis/SynWTFilterSpec.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/CSJ2K/j2k/wavelet/synthesis/SynWTFilterSpec.cs
--------------------------------------------------------------------------------
/GRB/CRC32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace OpenSatelliteProject.GRB {
6 | public class Crc32 {
7 | #region Constants
8 | ///
9 | /// Generator polynomial (modulo 2) for the reversed CRC32 algorithm.
10 | ///
11 | const UInt32 s_generator = 0xEDB88320;
12 | #endregion
13 |
14 | #region Constructors
15 | ///
16 | /// Creates a new instance of the Crc32 class.
17 | ///
18 | public Crc32() {
19 | // Constructs the checksum lookup table. Used to optimize the checksum.
20 | m_checksumTable = Enumerable.Range(0, 256).Select(i => {
21 | var tableEntry = (uint)i;
22 | for (var j = 0; j < 8; ++j) {
23 | tableEntry = ((tableEntry & 1) != 0) ? (s_generator ^ (tableEntry >> 1)) : (tableEntry >> 1);
24 | }
25 | return tableEntry;
26 | }).ToArray();
27 | }
28 | #endregion
29 |
30 | #region Methods
31 | ///
32 | /// Calculates the checksum of the byte stream.
33 | ///
34 | /// The byte stream to calculate the checksum for.
35 | /// A 32-bit reversed checksum.
36 | public UInt32 Get(IEnumerable byteStream) {
37 | try {
38 | // Initialize checksumRegister to 0xFFFFFFFF and calculate the checksum.
39 | return ~byteStream.Aggregate(0xFFFFFFFF, (checksumRegister, currentByte) =>
40 | (m_checksumTable[(checksumRegister & 0xFF) ^ Convert.ToByte(currentByte)] ^ (checksumRegister >> 8)));
41 | } catch (FormatException e) {
42 | throw new Exception("Could not read the stream out as bytes.", e);
43 | } catch (InvalidCastException e) {
44 | throw new Exception("Could not read the stream out as bytes.", e);
45 | } catch (OverflowException e) {
46 | throw new Exception("Could not read the stream out as bytes.", e);
47 | }
48 | }
49 | #endregion
50 |
51 | #region Fields
52 | ///
53 | /// Contains a cache of calculated checksum chunks.
54 | ///
55 | readonly UInt32[] m_checksumTable;
56 |
57 | #endregion
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/GRB/Enum/AssembleIdentifier.cs:
--------------------------------------------------------------------------------
1 | namespace OpenSatelliteProject.GRB.Enum {
2 | public enum AssembleIdentifier {
3 | WCDASPrimary = 0,
4 | WCDASBackup = 1,
5 | CBUPrimary = 2,
6 | CBUBackup = 3,
7 | }
8 | }
9 |
10 |
--------------------------------------------------------------------------------
/GRB/Enum/Instrument.cs:
--------------------------------------------------------------------------------
1 | namespace OpenSatelliteProject.GRB.Enum {
2 | public enum Instrument {
3 | Unknown,
4 | ABI,
5 | GLM,
6 | EXIS,
7 | SEISS,
8 | SUVI,
9 | MAG,
10 | INFO
11 | }
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/GRB/Enum/PayloadType.cs:
--------------------------------------------------------------------------------
1 | namespace OpenSatelliteProject.GRB.Enum {
2 | public enum PayloadType {
3 | Generic = 0,
4 | Reserved = 1,
5 | ImageData = 2,
6 | ImageDataWithQuality = 3,
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/GRB/Enum/SystemEnvironment.cs:
--------------------------------------------------------------------------------
1 | namespace OpenSatelliteProject.GRB.Enum {
2 | public enum SystemEnvironment {
3 | Development = 0,
4 | IntegrationAndTest = 1,
5 | Operational = 2,
6 | }
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/GRB/EnumHelpers.cs:
--------------------------------------------------------------------------------
1 | using OpenSatelliteProject.GRB.Enum;
2 |
3 | namespace OpenSatelliteProject.GRB {
4 | public static class EnumHelpers {
5 |
6 | public static PayloadType APID2Type(uint apid) {
7 | if (apid >= 0x100 && apid <= 0x19f) { // ABI
8 | uint s = apid / 0x10;
9 | return (s % 2) > 0 ? PayloadType.ImageData : PayloadType.Generic;
10 | }
11 |
12 | return (apid >= 0x486 && apid <= 0x48b) ? PayloadType.ImageData : PayloadType.Generic;
13 | }
14 | public static PayloadType APID2Type(int apid) {
15 | if (apid >= 0x100 && apid <= 0x19f) { // ABI
16 | int s = apid / 0x10;
17 | return (s % 2) > 0 ? PayloadType.ImageData : PayloadType.Generic;
18 | }
19 |
20 | return (apid >= 0x486 && apid <= 0x48b) ? PayloadType.ImageData : PayloadType.Generic;
21 | }
22 |
23 | public static Instrument APID2Instrument(uint apid) {
24 | if (apid >= 0x100 && apid <= 0x19f) {
25 | return Instrument.ABI;
26 | }
27 | if (apid >= 0x300 && apid <= 0x303) {
28 | return Instrument.GLM;
29 | }
30 | if (apid >= 0x380 && apid <= 0x383) {
31 | return Instrument.EXIS;
32 | }
33 | if (apid >= 0x400 && apid <= 0x431) {
34 | return Instrument.SEISS;
35 | }
36 | if (apid >= 0x480 && apid <= 0x48b) {
37 | return Instrument.SUVI;
38 | }
39 | if (apid == 0x500 || apid == 0x501) {
40 | return Instrument.MAG;
41 | }
42 | if (apid == 0x580) {
43 | return Instrument.INFO;
44 | }
45 |
46 | return Instrument.Unknown;
47 | }
48 | }
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/GRB/GRB.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {0B6D542D-33A9-43E7-989F-9C56359860FB}
7 | Library
8 | OpenSatelliteProject.GRB
9 | OpenSatelliteProject.GRB
10 | v4.5
11 |
12 |
13 | true
14 | full
15 | false
16 | bin\Debug
17 | DEBUG;
18 | prompt
19 | 4
20 | false
21 |
22 |
23 |
24 | true
25 | bin\Release
26 | prompt
27 | 4
28 |
29 | false
30 |
31 |
32 |
33 |
34 | ..\packages\DotSpatial.Mono.1.9\lib\net40-Client\DotSpatial.Mono.dll
35 |
36 |
37 | ..\packages\DotSpatial.Serialization.1.9\lib\net40-Client\DotSpatial.Serialization.dll
38 |
39 |
40 | ..\packages\DotSpatial.Topology.1.9\lib\net40-Client\DotSpatial.Topology.dll
41 |
42 |
43 | ..\packages\DotSpatial.Projections.1.9\lib\net40-Client\DotSpatial.Projections.dll
44 |
45 |
46 | ..\packages\DotSpatial.Data.1.9\lib\net40-Client\DotSpatial.Data.dll
47 |
48 |
49 | ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll
50 |
51 |
52 | ..\packages\OpenSatelliteProject.XRIT.1.3.6489\lib\net45\XRIT.dll
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/GRB/Headers/GRBGenericHeader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | namespace OpenSatelliteProject.GRB.Headers {
5 | public class GRBGenericHeader {
6 |
7 | public byte compressionAlgorithm;
8 | public uint secondsSinceEpoch;
9 | public uint microsecondsFromSeconds;
10 | public byte[] reserved;
11 | public uint grbPayloadCount;
12 | public DateTime timestamp;
13 | public ulong epoch;
14 | public string filename;
15 | public int apid;
16 |
17 | public GRBGenericHeader (int apid, byte [] headerData) {
18 | this.apid = apid;
19 | compressionAlgorithm = headerData [0];
20 |
21 | byte[] secondsBuffer = headerData.Skip (1).Take (4).ToArray ();
22 | byte[] microsseconds = headerData.Skip (5).Take (4).ToArray ();
23 | reserved = headerData.Skip (9).Take (8).ToArray ();
24 | byte[] count = headerData.Skip (17).Take (4).ToArray ();
25 |
26 | if (BitConverter.IsLittleEndian) {
27 | Array.Reverse (secondsBuffer);
28 | Array.Reverse (microsseconds);
29 | Array.Reverse (count);
30 | }
31 |
32 | secondsSinceEpoch = BitConverter.ToUInt32 (secondsBuffer, 0);
33 | microsecondsFromSeconds = BitConverter.ToUInt32 (microsseconds, 0);
34 | grbPayloadCount = BitConverter.ToUInt32 (count, 0);
35 |
36 | timestamp = new DateTime(2000, 1, 1, 0, 0, 0);
37 | timestamp = timestamp.AddSeconds(secondsSinceEpoch);
38 | timestamp = timestamp.AddMilliseconds(microsecondsFromSeconds / 1000f);
39 |
40 | epoch = (ulong) (secondsSinceEpoch * 1e6 + microsecondsFromSeconds);
41 |
42 | filename = $"{epoch}-{grbPayloadCount:D8}.grb";
43 | }
44 | }
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/GRB/Headers/GRBImageHeader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | namespace OpenSatelliteProject.GRB.Headers {
5 | public class GRBImageHeader {
6 | public byte compressionAlgorithm;
7 | public uint secondsSinceEpoch;
8 | public uint microsecondsFromSeconds;
9 | public byte[] reserved;
10 | public uint sequence;
11 | public DateTime timestamp;
12 | public string filename;
13 | public int apid;
14 | public ulong epoch;
15 |
16 | public uint rowOffset;
17 | public uint rowOffsetB;
18 | public uint ulX;
19 | public uint ulY;
20 | public uint height;
21 | public uint width;
22 | public uint dqfOffset;
23 |
24 | public GRBImageHeader (int apid, byte[] headerData) {
25 | this.apid = apid;
26 | compressionAlgorithm = headerData [0];
27 |
28 | byte[] secondsBuffer = headerData.Skip (1).Take (4).ToArray ();
29 | byte[] microsseconds = headerData.Skip (5).Take (4).ToArray ();
30 | byte[] count = headerData.Skip (9).Take (2).ToArray ();
31 | byte[] rOff = headerData.Skip (11).Take (3).ToArray ();
32 | byte[] ulXB = headerData.Skip (14).Take (4).ToArray ();
33 | byte[] ulYB = headerData.Skip (18).Take (4).ToArray ();
34 | byte[] heightB = headerData.Skip (22).Take (4).ToArray ();
35 | byte[] widthB = headerData.Skip (26).Take (4).ToArray ();
36 | byte[] dqOff = headerData.Skip (30).Take (4).ToArray ();
37 |
38 | if (BitConverter.IsLittleEndian) {
39 | Array.Reverse (secondsBuffer);
40 | Array.Reverse (microsseconds);
41 | Array.Reverse (count);
42 | Array.Reverse (rOff);
43 | Array.Reverse (ulXB);
44 | Array.Reverse (ulYB);
45 | Array.Reverse (heightB);
46 | Array.Reverse (widthB);
47 | Array.Reverse (dqOff);
48 | }
49 |
50 | secondsSinceEpoch = BitConverter.ToUInt32 (secondsBuffer, 0);
51 | microsecondsFromSeconds = BitConverter.ToUInt32 (microsseconds, 0);
52 | sequence = BitConverter.ToUInt16 (count, 0);
53 |
54 | epoch = (ulong)(secondsSinceEpoch * 1e6 + microsecondsFromSeconds);
55 |
56 | rowOffset = (uint) (rOff [2] << 16 + rOff [1] << 8 + rOff [0]) & 0xFFFFFFFF;
57 |
58 | ulX = BitConverter.ToUInt32 (ulXB, 0);
59 | ulY = BitConverter.ToUInt32 (ulYB, 0);
60 | height = BitConverter.ToUInt32 (heightB, 0);
61 | width = BitConverter.ToUInt32 (widthB, 0);
62 | dqfOffset = BitConverter.ToUInt32 (dqOff, 0);
63 |
64 | timestamp = new DateTime(2000, 1, 1, 0, 0, 0);
65 | timestamp = timestamp.AddSeconds(secondsSinceEpoch);
66 | timestamp = timestamp.AddMilliseconds(microsecondsFromSeconds / 1000f);
67 |
68 | filename = compressionAlgorithm == 1 ? $"{epoch}-{sequence:D8}.j2k" : $"{epoch}-{sequence:D8}.img";
69 | }
70 |
71 | public override string ToString() {
72 | string o = "";
73 | o += $"DateTime: {timestamp.ToString()}\n";
74 | o += $"Sequence: {sequence}\n";
75 | o += $"Epoch: {epoch}\n";
76 | o += $"APID: {apid}\n";
77 | o += $"rowOffset: {rowOffset}\n";
78 | o += $"upperLeftX: {ulX}\n";
79 | o += $"upperLeftY: {ulY}\n";
80 | o += $"width: {width}\n";
81 | o += $"height: {height}\n";
82 | o += $"dqfOffset: {dqfOffset}\n";
83 | return o;
84 | }
85 | }
86 | }
87 |
88 |
--------------------------------------------------------------------------------
/GRB/Headers/SecondHeader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using OpenSatelliteProject.GRB.Enum;
4 |
5 | namespace OpenSatelliteProject.GRB.Headers {
6 | public class SecondHeader {
7 |
8 | public PayloadType PayloadType { get; private set; }
9 | public DateTime Timestamp { get; private set; }
10 | public int GRBVersion { get; private set; }
11 | public AssembleIdentifier AssembleIdentifier { get; private set; }
12 | public SystemEnvironment SystemEnvironment { get; private set; }
13 |
14 | public SecondHeader (byte[] secondHeader) {
15 | var dseb = secondHeader.Take (2).ToArray ();
16 | var mseb = secondHeader.Skip (2).Take (4).ToArray ();
17 | var grbS = secondHeader.Skip (6).Take (2).ToArray ();
18 |
19 | if (BitConverter.IsLittleEndian) {
20 | Array.Reverse (dseb);
21 | Array.Reverse (mseb);
22 | //Array.Reverse (grbS);
23 | }
24 |
25 | var daysSinceEpoch = BitConverter.ToUInt16(dseb, 0);
26 | var msOfDay = BitConverter.ToUInt32 (mseb, 0);
27 | Timestamp = new DateTime (2000, 1, 1, 0, 0, 0);
28 | Timestamp = Timestamp.AddDays (daysSinceEpoch);
29 | Timestamp = Timestamp.AddMilliseconds (msOfDay);
30 |
31 | var grbSU = BitConverter.ToUInt16 (grbS, 0);
32 |
33 | GRBVersion = grbSU & 0x1F;
34 | PayloadType = (PayloadType)(((grbS [1] & 3) << 5) + ((grbS [0] & 0xE0) >> 5));
35 | AssembleIdentifier = (AssembleIdentifier)((grbSU & 0xC00) >> 10);
36 | SystemEnvironment = (SystemEnvironment)((grbSU & 0x9000) >> 12);
37 | }
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/GRB/Product/ImageSize.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace OpenSatelliteProject.GRB.Product {
4 | public class ImageSize {
5 | public int Width { get; set; }
6 | public int Height { get; set; }
7 | public ImageSize (int width, int height) {
8 | Width = width;
9 | Height = height;
10 | }
11 |
12 |
13 | public static ImageSize New(int width, int height) {
14 | return new ImageSize(width, height);
15 | }
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/GRB/Product/Product.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenSatelliteProject.GRB.Enum;
3 |
4 | namespace OpenSatelliteProject.GRB.Product {
5 | public class Product {
6 | public int APID { get; private set; }
7 | public string Name { get; private set; }
8 | public Instrument Instrument { get; private set; }
9 | public string FolderName { get; private set; }
10 | public bool IsMetadata { get; private set; }
11 | public object[] Meta { get; private set; }
12 |
13 | public Product (int apid, string name, Instrument instrument, string folder, bool isMetadata, object[] meta = null) {
14 | this.APID = apid;
15 | this.Name = name;
16 | this.Instrument = instrument;
17 | this.FolderName = folder;
18 | this.IsMetadata = isMetadata;
19 | this.Meta = meta;
20 | }
21 |
22 | public string ToProductString() {
23 | return $"{Instrument.ToString()}-{FolderName}";
24 | }
25 |
26 | override
27 | public string ToString() {
28 | return $"{Name} - {(IsMetadata ? "Metadata" : "Data")}";
29 | }
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/GRB/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 |
7 | [assembly: AssemblyTitle ("GRB")]
8 | [assembly: AssemblyDescription ("")]
9 | [assembly: AssemblyConfiguration ("")]
10 | [assembly: AssemblyCompany ("")]
11 | [assembly: AssemblyProduct ("")]
12 | [assembly: AssemblyCopyright ("Lucas Teske")]
13 | [assembly: AssemblyTrademark ("")]
14 | [assembly: AssemblyCulture ("")]
15 |
16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
19 |
20 | [assembly: AssemblyVersion ("1.0.*")]
21 |
22 | // The following attributes are used to specify the signing key for the assembly,
23 | // if desired. See the Mono documentation for more information about signing.
24 |
25 | //[assembly: AssemblyDelaySign(false)]
26 | //[assembly: AssemblyKeyFile("")]
27 |
28 |
--------------------------------------------------------------------------------
/GRB/Tools.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Xml.Linq;
5 |
6 | namespace OpenSatelliteProject.GRB {
7 | public static class Tools {
8 |
9 | public static uint CalcCRC(byte[] data) {
10 | Crc32 crc32 = new Crc32();
11 | return crc32.Get (data);
12 | }
13 | public static uint CRC32(this byte[] data) {
14 | return CalcCRC(data);
15 | }
16 |
17 | public static void Print(this byte[] data) {
18 | const int lineSize = 24;
19 | var sb = "";
20 | var bytesLine = "";
21 | for (int i = 0; i < data.Length; i++) {
22 | if (i % lineSize == 0) {
23 | if (bytesLine.Length > 0) {
24 | sb += "| " + bytesLine + "\n| ";
25 | bytesLine = "";
26 | } else {
27 | sb += "\n| ";
28 | }
29 | }
30 | sb += data [i].ToString ("X2") + " ";
31 | bytesLine += !char.IsControl ((char)data [i]) ? Convert.ToChar(data [i]).ToString() : ".";
32 | if (i % 4 == 3) {
33 | sb += " ";
34 | }
35 | }
36 | Console.WriteLine (sb);
37 | }
38 | private static readonly string xmlHead = " b.ToString("X2")));
62 | }
63 |
64 | public static string FindAttrValue(XDocument doc, string name, bool caseInsensitive=true) {
65 | var z = doc.Descendants().First().Descendants();
66 | foreach (var d in z) {
67 | if (d.Name.LocalName == "attribute") {
68 | var attr = d.FirstAttribute;
69 | bool datasetName = false;
70 | while (attr != null) {
71 | if (attr.Name == "name") {
72 | if (
73 | (attr.Value != name && !caseInsensitive) ||
74 | (attr.Value.ToLower() != name.ToLower() && caseInsensitive)
75 | ) {
76 | break;
77 | }
78 | datasetName = true;
79 | }
80 | if (attr.Name == "value" && datasetName) {
81 | return attr.Value;
82 | }
83 | attr = attr.NextAttribute;
84 | }
85 | }
86 | }
87 |
88 | return null;
89 | }
90 | }
91 | }
92 |
93 |
--------------------------------------------------------------------------------
/GRB/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ImageTools/IMTools.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {74ABADF7-5281-4A0C-ABE6-CB325E75E6C9}
7 | Library
8 | OpenSatelliteProject.IMTools
9 | OpenSatelliteProject.IMTools
10 | false
11 | Image Tools for processing 16 Bit Imagery
12 | v4.5
13 |
14 |
15 | true
16 | full
17 | false
18 | bin\Debug
19 | DEBUG;
20 | prompt
21 | 4
22 | false
23 | true
24 |
25 |
26 | full
27 | true
28 | bin\Release
29 | prompt
30 | 4
31 | false
32 | true
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | {36EC19FD-7AF1-4176-BCA0-EB41F6C8E0EA}
47 | CSJ2K
48 |
49 |
50 |
--------------------------------------------------------------------------------
/ImageTools/ImageAssembler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CSJ2K;
3 | using System.Drawing;
4 | using System.Drawing.Imaging;
5 | using System.Threading.Tasks;
6 | using System.IO;
7 |
8 | namespace OpenSatelliteProject.IMTools {
9 | public class ImageAssembler {
10 |
11 | readonly Image16 image;
12 | int posY;
13 | int segmentHeight;
14 | ulong epoch;
15 |
16 | public int Width {
17 | get { return image.Width; }
18 | }
19 |
20 | public int Height {
21 | get { return image.Height; }
22 | }
23 |
24 | public bool Done {
25 | get {
26 | return posY >= image.Height;
27 | }
28 | }
29 |
30 | public Image16 Image {
31 | get {
32 | return image;
33 | }
34 | }
35 |
36 | public ulong Epoch {
37 | get {
38 | return epoch;
39 | }
40 | }
41 |
42 | public ImageAssembler (int width, int height, ulong epoch = 0) {
43 | image = new Image16 (width, height);
44 | posY = 0;
45 | segmentHeight = 0;
46 | this.epoch = epoch;
47 | }
48 |
49 | public void AppendJ2K(string filename, bool resizeIfNeeded = false) {
50 | try {
51 | var j2k = J2kImage.FromFile(filename);
52 | image.DrawImage (j2k.GetComponent(0), j2k.Width, j2k.Height, 0, posY, resizeIfNeeded);
53 | posY += j2k.Height;
54 | segmentHeight = j2k.Height;
55 | } catch (Exception e) {
56 | Console.WriteLine ($"Corrupted Segment ({e.GetType().Name}): {e.Message}");
57 | posY += segmentHeight;
58 | }
59 | }
60 |
61 | public void DrawAt(string filename, int x, int y, bool resizeIfNeeded = false) {
62 | try {
63 | var j2k = J2kImage.FromFile(filename);
64 | image.DrawImage (j2k.GetComponent(0), j2k.Width, j2k.Height, x, y, resizeIfNeeded);
65 | } catch (Exception e) {
66 | Console.WriteLine ($"Corrupted Segment ({e.GetType().Name}): {e.Message}");
67 | }
68 | }
69 |
70 | public void DrawAt(Image16 img, int x, int y, bool resizeIfNeeded = false) {
71 | image.DrawImage (img, x, y, resizeIfNeeded);
72 | }
73 |
74 | public void SavePGM(string filename) {
75 | image.SavePGM (filename);
76 | }
77 |
78 | public void SavePNG(string filename) {
79 | var bmp = image.ToBitmap ();
80 | bmp.Save (filename, ImageFormat.Png);
81 | bmp.Dispose ();
82 | }
83 |
84 | public void SaveJPG(string filename) {
85 | var bmp = image.ToBitmap ();
86 | bmp.Save (filename, ImageFormat.Jpeg);
87 | bmp.Dispose ();
88 | }
89 |
90 |
91 | public async Task AsyncSavePGM(string filename) {
92 | await Task.Run (() => {
93 | image.SavePGM (filename);
94 | // Console.WriteLine($"File {filename} saved.");
95 | });
96 | }
97 |
98 | public async Task AsyncSavePNG(string filename) {
99 | await Task.Run (() => {
100 | var bmp = image.ToBitmap ();
101 | bmp.Save (filename, ImageFormat.Png);
102 | bmp.Dispose ();
103 | // Console.WriteLine($"File {filename} saved.");
104 | });
105 | }
106 |
107 | public async Task AsyncSaveJPG(string filename) {
108 | await Task.Run (() => {
109 | var bmp = image.ToBitmap ();
110 | bmp.Save (filename, ImageFormat.Jpeg);
111 | bmp.Dispose ();
112 | // Console.WriteLine($"File {filename} saved.");
113 | });
114 | }
115 | }
116 | }
117 |
118 |
--------------------------------------------------------------------------------
/ImageTools/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 |
7 | [assembly: AssemblyTitle ("ImageTools")]
8 | [assembly: AssemblyDescription ("")]
9 | [assembly: AssemblyConfiguration ("")]
10 | [assembly: AssemblyCompany ("")]
11 | [assembly: AssemblyProduct ("")]
12 | [assembly: AssemblyCopyright ("Lucas Teske")]
13 | [assembly: AssemblyTrademark ("")]
14 | [assembly: AssemblyCulture ("")]
15 |
16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
19 |
20 | [assembly: AssemblyVersion ("1.0.*")]
21 |
22 | // The following attributes are used to specify the signing key for the assembly,
23 | // if desired. See the Mono documentation for more information about signing.
24 |
25 | //[assembly: AssemblyDelaySign(false)]
26 | //[assembly: AssemblyKeyFile("")]
27 |
28 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Open Satellite Project
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/LibraryTest/LibraryTest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | {B2BFDD20-49DE-42E1-8022-A6C300200A05}
7 | Exe
8 | LibraryTest
9 | LibraryTest
10 | v4.6.1
11 |
12 |
13 | true
14 | full
15 | false
16 | bin\Debug
17 | DEBUG;
18 | prompt
19 | 4
20 | true
21 | x86
22 |
23 |
24 | true
25 | bin\Release
26 | prompt
27 | 4
28 | true
29 | x86
30 |
31 |
32 |
33 |
34 | ..\packages\DotSpatial.Mono.1.9\lib\net40-Client\DotSpatial.Mono.dll
35 |
36 |
37 | ..\packages\DotSpatial.Projections.1.9\lib\net40-Client\DotSpatial.Projections.dll
38 |
39 |
40 | ..\packages\DotSpatial.Serialization.1.9\lib\net40-Client\DotSpatial.Serialization.dll
41 |
42 |
43 | ..\packages\DotSpatial.Topology.1.9\lib\net40-Client\DotSpatial.Topology.dll
44 |
45 |
46 | ..\packages\DotSpatial.Data.1.9\lib\net40-Client\DotSpatial.Data.dll
47 |
48 |
49 | ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll
50 |
51 |
52 | ..\packages\OpenSatelliteProject.XRIT.1.3.6489\lib\net452\XRIT.dll
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | {CFAD7ECE-55B4-43DA-97E2-FF5657F9B095}
63 | grbdump
64 |
65 |
66 | {0B6D542D-33A9-43E7-989F-9C56359860FB}
67 | GRB
68 |
69 |
70 | {36EC19FD-7AF1-4176-BCA0-EB41F6C8E0EA}
71 | CSJ2K
72 |
73 |
74 | {74ABADF7-5281-4A0C-ABE6-CB325E75E6C9}
75 | IMTools
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/LibraryTest/LibraryTest.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Project
5 | false
6 |
7 |
--------------------------------------------------------------------------------
/LibraryTest/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 | using grbdump;
4 | using OpenSatelliteProject;
5 | using OpenSatelliteProject.IMTools;
6 | using OpenSatelliteProject.Tools;
7 |
8 | namespace LibraryTest {
9 | class MainClass {
10 |
11 | public static void Main(string[] args) {
12 | long startTime;
13 |
14 | Image16 im = new Image16(21000, 21000);
15 | Image16 im2 = new Image16(4096, 4096, 0x0);
16 | UIConsole.Log("Benchmark Draw");
17 | startTime = LLTools.TimestampMS();
18 | im.DrawImage(im2, 1024, 1024, true);
19 | UIConsole.Log($"Delta: {LLTools.TimestampMS() - startTime} ms");
20 |
21 | UIConsole.Log("Benchmark Save PGM");
22 | startTime = LLTools.TimestampMS();
23 | im.SavePGM("test.pgm");
24 | UIConsole.Log($"Delta: {LLTools.TimestampMS() - startTime} ms");
25 |
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/LibraryTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 |
7 | [assembly: AssemblyTitle("LibraryTest")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("")]
12 | [assembly: AssemblyCopyright("")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
19 |
20 | [assembly: AssemblyVersion("1.0.*")]
21 |
22 | // The following attributes are used to specify the signing key for the assembly,
23 | // if desired. See the Mono documentation for more information about signing.
24 |
25 | //[assembly: AssemblyDelaySign(false)]
26 | //[assembly: AssemblyKeyFile("")]
27 |
--------------------------------------------------------------------------------
/LibraryTest/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | GOES GRB Ingestor
2 | =================
3 |
4 | Prototype for a GOES GRB Ingestor
5 |
6 | With exception of the files under CSJ2K folder (which are licensed as BSD), this whole project is licensed under MIT.
--------------------------------------------------------------------------------
/bb2cadu.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | '''
4 | That script is intended to convert a BBFrame (for example Generic Stream TBS output) file to a CADU file.
5 | '''
6 |
7 | import sys
8 |
9 | ccsdsSync = "\x1A\xCF\xFC\x1D"
10 | frameSize = 2048
11 |
12 | def IsSync(data):
13 | return data[:4] == ccsdsSync
14 |
15 | if len(sys.argv) < 3:
16 | print("Usage: bb2cadu input.ts output.cadu")
17 | exit(1)
18 |
19 | f = open(sys.argv[1], "rb")
20 | o = open(sys.argv[2], "wb")
21 | data = ""
22 |
23 | count = 0
24 |
25 | print "Reading %s" %sys.argv[1]
26 |
27 | while True:
28 | rd = f.read(32)
29 | if len(rd) == 0:
30 | sys.stdout.write("\n")
31 | break
32 | data += rd
33 |
34 | while len(data) > 4:
35 | if IsSync(data):
36 | data += f.read(2048 - len(data))
37 | o.write(data)
38 | count += 1
39 | data = f.read(4)
40 | sys.stdout.write("%s frames written\r" % count)
41 | else:
42 | data = data[1:]
43 |
44 | print "Finished"
--------------------------------------------------------------------------------
/bbframe_stream.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import binascii, time, socket
4 |
5 | file = "/media/ELTN/Baseband Records/GOES/GRB/TBSCapture/Q-capture1.ts"
6 |
7 | FrameLength = 7274
8 | SearchBuffSize = FrameLength * 2
9 | MaxBuffSize = FrameLength * 16
10 |
11 | BBFRAME_HEADER = '\x71\x00\x00\x00\xE3'
12 |
13 |
14 | UDP_IP = '127.0.0.1'
15 | UDP_PORT = 1234
16 |
17 |
18 | def searchInBuff(buff, token):
19 | buff = bytearray(buff)
20 | token = bytearray(token)
21 | if len(buff) > len(token):
22 | for i in range(len(buff) - len(token)):
23 | found = True
24 | for z in range(len(token)):
25 | if buff[i+z] != token[z]:
26 | found = False
27 | break
28 | if found:
29 | return i
30 | return None
31 |
32 | def IsSync(data):
33 | return data[:5] == BBFRAME_HEADER
34 |
35 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
36 |
37 |
38 |
39 | f = open(file, "rb")
40 | data = ""
41 | frameCount = 0
42 | while True:
43 | rd = f.read(SearchBuffSize)
44 | if len(rd) == 0:
45 | break
46 | data += rd
47 | if not IsSync(data):
48 | print "Searching for Sync Mark"
49 | pos = searchInBuff(data, BBFRAME_HEADER)
50 | if pos != None:
51 | print "Found sync at: %s" %pos
52 | print "Buff Len: %s" %len(data)
53 | data = data[pos:]
54 | else:
55 | print "Sync not found, trying one more cycle"
56 | data = data[len(data)-MaxBuffSize:]
57 | continue
58 |
59 | remaining = ""
60 |
61 | if len(data) < FrameLength:
62 | data += f.read(FrameLength - len(data))
63 | elif len(data) > FrameLength:
64 | remaining += data[FrameLength:]
65 | data = data[:FrameLength]
66 | sock.sendto(data, (UDP_IP, UDP_PORT))
67 | #print binascii.hexlify(data[:10]).upper()
68 | frameCount += 1
69 | data = remaining
70 | time.sleep(0.0038)
71 |
72 | conn.close()
73 | f.close()
--------------------------------------------------------------------------------
/grbdump.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "grbdump", "grbdump\grbdump.csproj", "{CFAD7ECE-55B4-43DA-97E2-FF5657F9B095}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSJ2K", "CSJ2K\CSJ2K.csproj", "{36EC19FD-7AF1-4176-BCA0-EB41F6C8E0EA}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IMTools", "ImageTools\IMTools.csproj", "{74ABADF7-5281-4A0C-ABE6-CB325E75E6C9}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GRB", "GRB\GRB.csproj", "{0B6D542D-33A9-43E7-989F-9C56359860FB}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibraryTest", "LibraryTest\LibraryTest.csproj", "{B2BFDD20-49DE-42E1-8022-A6C300200A05}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|x86 = Debug|x86
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {0B6D542D-33A9-43E7-989F-9C56359860FB}.Debug|x86.ActiveCfg = Debug|Any CPU
21 | {0B6D542D-33A9-43E7-989F-9C56359860FB}.Debug|x86.Build.0 = Debug|Any CPU
22 | {0B6D542D-33A9-43E7-989F-9C56359860FB}.Release|x86.ActiveCfg = Release|Any CPU
23 | {0B6D542D-33A9-43E7-989F-9C56359860FB}.Release|x86.Build.0 = Release|Any CPU
24 | {36EC19FD-7AF1-4176-BCA0-EB41F6C8E0EA}.Debug|x86.ActiveCfg = Debug|Any CPU
25 | {36EC19FD-7AF1-4176-BCA0-EB41F6C8E0EA}.Debug|x86.Build.0 = Debug|Any CPU
26 | {36EC19FD-7AF1-4176-BCA0-EB41F6C8E0EA}.Release|x86.ActiveCfg = Release|Any CPU
27 | {36EC19FD-7AF1-4176-BCA0-EB41F6C8E0EA}.Release|x86.Build.0 = Release|Any CPU
28 | {74ABADF7-5281-4A0C-ABE6-CB325E75E6C9}.Debug|x86.ActiveCfg = Debug|Any CPU
29 | {74ABADF7-5281-4A0C-ABE6-CB325E75E6C9}.Debug|x86.Build.0 = Debug|Any CPU
30 | {74ABADF7-5281-4A0C-ABE6-CB325E75E6C9}.Release|x86.ActiveCfg = Release|Any CPU
31 | {74ABADF7-5281-4A0C-ABE6-CB325E75E6C9}.Release|x86.Build.0 = Release|Any CPU
32 | {CFAD7ECE-55B4-43DA-97E2-FF5657F9B095}.Debug|x86.ActiveCfg = Debug|x86
33 | {CFAD7ECE-55B4-43DA-97E2-FF5657F9B095}.Debug|x86.Build.0 = Debug|x86
34 | {CFAD7ECE-55B4-43DA-97E2-FF5657F9B095}.Release|x86.ActiveCfg = Release|x86
35 | {CFAD7ECE-55B4-43DA-97E2-FF5657F9B095}.Release|x86.Build.0 = Release|x86
36 | {B2BFDD20-49DE-42E1-8022-A6C300200A05}.Debug|x86.ActiveCfg = Debug|x86
37 | {B2BFDD20-49DE-42E1-8022-A6C300200A05}.Debug|x86.Build.0 = Debug|x86
38 | {B2BFDD20-49DE-42E1-8022-A6C300200A05}.Release|x86.ActiveCfg = Release|x86
39 | {B2BFDD20-49DE-42E1-8022-A6C300200A05}.Release|x86.Build.0 = Release|x86
40 | EndGlobalSection
41 | GlobalSection(MonoDevelopProperties) = preSolution
42 | Policies = $0
43 | $0.TextStylePolicy = $1
44 | $1.inheritsSet = null
45 | $1.scope = text/x-csharp
46 | $0.CSharpFormattingPolicy = $2
47 | $2.NewLinesForBracesInTypes = False
48 | $2.NewLinesForBracesInMethods = False
49 | $2.NewLinesForBracesInProperties = False
50 | $2.NewLinesForBracesInAccessors = False
51 | $2.NewLinesForBracesInAnonymousMethods = False
52 | $2.NewLinesForBracesInControlBlocks = False
53 | $2.NewLinesForBracesInAnonymousTypes = False
54 | $2.NewLinesForBracesInObjectCollectionArrayInitializers = False
55 | $2.NewLinesForBracesInLambdaExpressionBody = False
56 | $2.NewLineForElse = False
57 | $2.NewLineForCatch = False
58 | $2.NewLineForFinally = False
59 | $2.NewLineForClausesInQuery = False
60 | $2.scope = text/x-csharp
61 | EndGlobalSection
62 | EndGlobal
63 |
--------------------------------------------------------------------------------
/grbdump.userprefs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/grbdump/ChannelManager.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Concurrent;
2 | using System.Threading;
3 | using OpenSatelliteProject;
4 |
5 | namespace grbdump {
6 | class ChannelManager {
7 | const int MAX_QUEUE_LENGTH = 0x2FFFF; // Memory usage will be this * 2048
8 | readonly ConcurrentQueue packets;
9 |
10 | bool running;
11 | Thread channelThread;
12 | readonly Demuxer demuxer;
13 |
14 | public ChannelManager(MSDUManager msduManager) {
15 | packets = new ConcurrentQueue();
16 | running = false;
17 | demuxer = new Demuxer(msduManager);
18 | }
19 |
20 | public void NewPacket(byte[] packet) {
21 | if (running) {
22 | if (packets.Count >= MAX_QUEUE_LENGTH) {
23 | byte[] drop;
24 | UIConsole.Warn("Channel Manager Queue is full!!!! Samples might be dropped.");
25 | packets.TryDequeue(out drop);
26 | }
27 | packets.Enqueue(packet);
28 | }
29 | }
30 |
31 | public void Start() {
32 | if (!running) {
33 | UIConsole.Log("Starting channel thread");
34 | running = true;
35 | channelThread = new Thread(new ThreadStart(ThreadLoop)) {
36 | IsBackground = true,
37 | Priority = ThreadPriority.AboveNormal,
38 | };
39 | channelThread.Start();
40 | } else {
41 | UIConsole.Error("Channel Manager already running!");
42 | }
43 | }
44 |
45 | public void Stop() {
46 | if (running) {
47 | UIConsole.Log("Stopping Thread");
48 | running = false;
49 | channelThread.Join();
50 | } else {
51 | UIConsole.Error("Channel Manager already stopped!");
52 | }
53 | }
54 |
55 | void ThreadLoop() {
56 | UIConsole.Debug("Channel Thread started");
57 | while (running) {
58 | byte[] packet;
59 | int c = 0;
60 | while (c < 8 && packets.TryDequeue(out packet)) {
61 | demuxer.ParseBytes(packet);
62 | c++;
63 | }
64 | Thread.Sleep(1);
65 | // Thread.yield(); // That might be better. Not sure
66 | }
67 | UIConsole.Debug("Channel Thread stopped");
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/grbdump/FileHandlerManager.cs:
--------------------------------------------------------------------------------
1 | using OpenSatelliteProject;
2 | using System.Collections.Concurrent;
3 | using System.Threading;
4 | using System;
5 | using OpenSatelliteProject.GRB.Headers;
6 |
7 | namespace grbdump {
8 | class FileHandlerManager {
9 | const int MAX_QUEUE_LENGTH = 0xFFFFF;
10 | readonly ConcurrentQueue> packets;
11 |
12 | bool running;
13 | Thread channelThread;
14 |
15 | public FileHandlerManager() {
16 | packets = new ConcurrentQueue>();
17 | running = false;
18 | }
19 |
20 | public void NewFile(Tuple file) {
21 | if (running) {
22 | if (packets.Count >= MAX_QUEUE_LENGTH) {
23 | Tuple f;
24 | UIConsole.Warn("File Handler Queue is full!!!! Files might be discarded!");
25 | packets.TryDequeue(out f);
26 | }
27 | packets.Enqueue(file);
28 | }
29 | }
30 |
31 | public void Start() {
32 | if (!running) {
33 | UIConsole.Log("Starting channel thread");
34 | running = true;
35 | channelThread = new Thread(new ThreadStart(ThreadLoop)) {
36 | IsBackground = true,
37 | Priority = ThreadPriority.AboveNormal,
38 | };
39 | channelThread.Start();
40 | } else {
41 | UIConsole.Error("File Handler already running!");
42 | }
43 | }
44 |
45 | public void Stop() {
46 | if (running) {
47 | UIConsole.Log("Stopping Thread");
48 | running = false;
49 | channelThread.Join();
50 | } else {
51 | UIConsole.Error("File Handler already stopped!");
52 | }
53 | }
54 |
55 | void ThreadLoop() {
56 | UIConsole.Debug("File Handler started");
57 | while (running) {
58 | Tuple fileToHandle;
59 | if (packets.TryDequeue(out fileToHandle)) {
60 | string filename = fileToHandle.Item1;
61 | object obj = fileToHandle.Item2;
62 | if (obj.GetType() == typeof(GRBImageHeader)) {
63 | HandleImage(filename, (GRBImageHeader)obj);
64 | } else if (obj.GetType() == typeof(GRBGenericHeader)) {
65 | HandleGeneric(filename, (GRBGenericHeader)obj);
66 | } else {
67 | UIConsole.Error($"Invalid Type: {obj.GetType().Name}");
68 | }
69 | }
70 | // Thread.Yield(); // This might be better
71 | Thread.Sleep(5);
72 | }
73 | UIConsole.Debug("File Handler stopped");
74 | }
75 |
76 | void HandleImage(string filename, GRBImageHeader header) {
77 | GRBFileHandler.HandleFile(filename, header);
78 | }
79 |
80 | void HandleGeneric(string filename, GRBGenericHeader header) {
81 | GRBFileHandler.HandleFile(filename, header);
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/grbdump/MSDUInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenSatelliteProject.GRB.Headers;
3 | using OpenSatelliteProject.Tools;
4 | namespace grbdump {
5 | class MSDUInfo {
6 | const long TIMEOUT = 15 * 60 * 60; // 15 minutes
7 |
8 | public int APID { get; set; }
9 | public long ReceivedTime { get; private set; }
10 | public string FileName { get; set; }
11 | public GRBGenericHeader GenericHeader { get; set; }
12 | public GRBImageHeader ImageHeader { get; set; }
13 |
14 | public bool Expired {
15 | get {
16 | return LLTools.TimestampMS() - ReceivedTime > TIMEOUT;
17 | }
18 | }
19 |
20 | public MSDUInfo() {
21 | ReceivedTime = LLTools.TimestampMS();
22 | }
23 |
24 | public void Refresh() {
25 | ReceivedTime = LLTools.TimestampMS();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/grbdump/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using OpenSatelliteProject;
3 | using System.Threading;
4 | using System.Linq;
5 | using System.Diagnostics;
6 |
7 | namespace grbdump {
8 | class MainClass {
9 | static UdpReceiver udpReceiver;
10 | static Connector cn;
11 |
12 | static ChannelManager channel5, channel6;
13 |
14 | static MSDUManager msduManager;
15 | static FileHandlerManager fileHandlerManager;
16 |
17 | public static void Main (string[] args) {
18 | try {
19 | Process thisProc = Process.GetCurrentProcess();
20 | thisProc.PriorityClass = ProcessPriorityClass.RealTime;
21 | } catch (Exception e) {
22 | UIConsole.Error($"Failed changing process priority: {e}");
23 | }
24 |
25 | fileHandlerManager = new FileHandlerManager();
26 | msduManager = new MSDUManager(fileHandlerManager);
27 | channel5 = new ChannelManager(msduManager);
28 | channel6 = new ChannelManager(msduManager);
29 | // cn = new Connector();
30 |
31 | channel5.Start();
32 | channel6.Start();
33 | msduManager.Start();
34 | fileHandlerManager.Start();
35 |
36 | UIConsole.GlobalEnableDebug = true;
37 |
38 | /*cn = new Connector ();
39 | cn.ChannelDataAvailable += data => {
40 | data = data.Take(2042).ToArray();
41 | int vcid = (data[1] & 0x3F);
42 | if (vcid == 5) {
43 | channel5.NewPacket(data);
44 | } else if (vcid == 6) {
45 | channel6.NewPacket(data);
46 | } else {
47 | UIConsole.Error($"Unknown VCID for GRB: {vcid}");
48 | }
49 | };
50 | cn.Start ();
51 | */
52 | udpReceiver = new UdpReceiver();
53 | udpReceiver.ChannelDataAvailable += data => {
54 | data = data.Take(2042).ToArray();
55 | int vcid = (data[1] & 0x3F);
56 | if (vcid == 5) {
57 | channel5.NewPacket(data);
58 | } else if (vcid == 6) {
59 | channel6.NewPacket(data);
60 | } else if (vcid == 63 ) {
61 | // Fill Frame
62 | } else {
63 | UIConsole.Error($"Unknown VCID for GRB: {vcid}");
64 | }
65 | };
66 | udpReceiver.Start();
67 |
68 | while (true) {
69 | Thread.Sleep (1000);
70 | Thread.Yield();
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/grbdump/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 |
7 | [assembly: AssemblyTitle ("grbdump")]
8 | [assembly: AssemblyDescription ("")]
9 | [assembly: AssemblyConfiguration ("")]
10 | [assembly: AssemblyCompany ("")]
11 | [assembly: AssemblyProduct ("")]
12 | [assembly: AssemblyCopyright ("Lucas Teske")]
13 | [assembly: AssemblyTrademark ("")]
14 | [assembly: AssemblyCulture ("")]
15 |
16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
19 |
20 | [assembly: AssemblyVersion ("1.0.*")]
21 |
22 | // The following attributes are used to specify the signing key for the assembly,
23 | // if desired. See the Mono documentation for more information about signing.
24 |
25 | //[assembly: AssemblyDelaySign(false)]
26 | //[assembly: AssemblyKeyFile("")]
27 |
28 |
--------------------------------------------------------------------------------
/grbdump/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/jp2png.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import sys, glymur, numpy as np, time
4 | from PIL import Image
5 |
6 | if len(sys.argv) < 2:
7 | print "Usage: jp2png output.png image1.jp2 [image2.jpg] ..."
8 | exit(1)
9 |
10 | fulldata = None
11 | output = sys.argv[1]
12 | files = sys.argv[2:]
13 | lines = []
14 | files.sort()
15 |
16 | lastnum = -1
17 | c = 1
18 |
19 | blockshape = (128, 904)
20 | mincalc = None
21 | segs = 1
22 | for file in files:
23 | print "Reading %s" %file
24 | try:
25 | data = glymur.Jp2k(file)
26 | if fulldata == None:
27 | fulldata = data[:]
28 | mincalc = data[:]
29 | blockshape = fulldata.shape
30 | else:
31 | try:
32 | fulldata = np.append(fulldata, data[:], axis=0)
33 | mincalc = np.append(mincalc, data[:], axis=0)
34 | except e:
35 | break
36 | except:
37 | fulldata = np.append(fulldata, np.zeros(blockshape), axis=0)
38 | '''
39 | for file in files:
40 | print "Reading %s" %file
41 | num = int(file.split("-")[1].split(".")[0])
42 | data = glymur.Jp2k(file)
43 | if fulldata == None:
44 | fulldata = data[:]
45 | blockshape = fulldata.shape
46 | lastnum = num
47 | else:
48 | while lastnum + 1 != num:
49 | print "Skipped %s" % (lastnum + 1)
50 | if c == segs:
51 | lines.append(fulldata)
52 | fulldata = np.zeros(blockshape)
53 | else:
54 | fulldata = np.append(fulldata, np.zeros(blockshape), axis=1)
55 | c = c + 1
56 | lastnum += 1
57 | else:
58 | if c == segs:
59 | c = 0
60 | lines.append(fulldata)
61 | fulldata = data[:]
62 | else:
63 | try:
64 | fulldata = np.append(fulldata, data[:], axis=1)
65 | except:
66 | break
67 | c = c + 1
68 | lastnum = num
69 |
70 | #lines.append(fulldata)
71 | fulldata = None
72 |
73 | for i in lines:
74 | if fulldata == None:
75 | fulldata = i
76 | else:
77 | print i.shape, fulldata.shape
78 | try:
79 | fulldata = np.append(fulldata, i, axis=0)
80 | except:
81 | break
82 | '''
83 | print "Processing"
84 | print fulldata.max()
85 | if fulldata.max() > 255:
86 | baseline = mincalc.min()
87 | print "Baseline: %s" %baseline
88 | z = fulldata - baseline
89 | mincalc = mincalc - baseline
90 | z = np.clip(z, 0, z.max())
91 | divz = mincalc.max() / 255
92 | print divz
93 | z = z / divz
94 | else:
95 | print "No Baseline correction"
96 | Image.fromarray(z.astype(dtype="uint8")).save("%s" %output)
--------------------------------------------------------------------------------
/packet.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensatelliteproject/grbdump/73baaa445bf360896b30667ff2314c8275094891/packet.bin
--------------------------------------------------------------------------------
/stream.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import socket, time
4 |
5 | #file = "/media/ELTN/Baseband Records/GOES/GRB/TBSCapture/Q-capture1.ts"
6 | #file = "/home/lucas/Works/OpenSatelliteProject/split/grbdump/Q-capture.cadu"
7 | file = "/media/ELTN/Baseband Records/GOES/GRB/TestData/cspp-geo-grb-test-data-0.4.6/CADU_5"
8 | #file = "/media/ELTN/Baseband Records/GOES/GRB/TestData/cspp-geo-grb-test-data-0.4.6/CADU_6"
9 | #file = "/media/lucas/0E003F18003F05ED1/CADU/CADU_6"
10 | SearchBuffSize = 2048
11 | MaxBuffSize = 16384
12 | ccsdsSync = "\x1A\xCF\xFC\x1D"
13 |
14 | TCP_IP = '127.0.0.1'
15 | TCP_PORT = 5001
16 | FAST_MODE = True # Assume all CADUs are correct, starting with the start of file.
17 |
18 |
19 | def searchInBuff(buff, token):
20 | buff = bytearray(buff)
21 | token = bytearray(token)
22 | if len(buff) > len(token):
23 | for i in range(len(buff) - len(token)):
24 | found = True
25 | for z in range(len(token)):
26 | if buff[i+z] != token[z]:
27 | found = False
28 | break
29 | if found:
30 | return i
31 | return None
32 |
33 | def IsSync(data):
34 | return data[:4] == '\x1A\xCF\xFC\x1D'
35 |
36 | def parseFrame(data, conn):
37 | #if data[:4] == '\x1A\xCF\xFC\x1D':
38 | # print "OK"
39 | data = data[4:]
40 | scid = ((ord(data[0]) & 0x3F) << 2) + ( (ord(data[1]) & 0xC0) >> 6)
41 | vcid = ((ord(data[1]) & 0x3F))
42 | counter = ord(data[4]) + (ord(data[3]) << 8) + (ord(data[2]) << 16)
43 |
44 | if vcid != 63:
45 | #print "Valid Frame"
46 | #print " Satellite ID: %s" %scid
47 | #if vcid == 5:
48 | # print " RHCP Channel"
49 | #elif vcid == 6:
50 | # print " LHCP Channel"
51 | #else:
52 | # print " Virtual Channel: %s" %vcid
53 | print " Counter: %s" %counter
54 | #print ""
55 | conn.send(data[:2042])
56 |
57 | f = open(file, "rb")
58 |
59 | data = ""
60 | frameCount = 0
61 |
62 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
63 | s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
64 | s.bind((TCP_IP, TCP_PORT))
65 | s.listen(1)
66 |
67 | print "Waiting connection"
68 | conn, addr = s.accept()
69 | print 'Connection address:', addr
70 | #conn = None
71 | time.sleep(1)
72 |
73 | if FAST_MODE:
74 | # Assume Sequential CADUs
75 | while True:
76 | rd = f.read(2048)
77 | if len(rd) < 2048:
78 | break
79 | frameCount+=1
80 | parseFrame(rd, conn)
81 | #time.sleep(0.00015) # Full Speed
82 | time.sleep( 0.002)
83 | # time.sleep(0.01)
84 | else:
85 | while True:
86 | rd = f.read(SearchBuffSize)
87 | if len(rd) == 0:
88 | break
89 | data += rd
90 | if not IsSync(data):
91 | print "Searching for Sync Mark"
92 | pos = searchInBuff(data, ccsdsSync)
93 | if pos != None:
94 | print "Found sync at: %s" %pos
95 | print "Buff Len: %s" %len(data)
96 | data = data[pos:]
97 | else:
98 | print "Sync not found, trying one more cycle"
99 | data = data[len(data)-MaxBuffSize:]
100 | continue
101 |
102 | remaining = ""
103 |
104 | if len(data) < 2048:
105 | data += f.read(2048 - len(data))
106 | elif len(data) > 2048:
107 | remaining += data[2048:]
108 | data = data[:2048]
109 | parseFrame(data, conn)
110 | frameCount += 1
111 | data = remaining
112 | time.sleep( 0.002)
113 |
114 | conn.close()
115 | f.close()
--------------------------------------------------------------------------------
/stream_udp.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import socket, time
4 |
5 |
6 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
7 |
8 | #file = "/media/ELTN/Baseband Records/GOES/GRB/TBSCapture/Q-capture1.ts"
9 | #file = "/home/lucas/Works/OpenSatelliteProject/split/grbdump/Q-capture.cadu"
10 | file = "/media/ELTN/Baseband Records/GOES/GRB/TestData/cspp-geo-grb-test-data-0.4.6/CADU_5"
11 | #file = "/media/ELTN/Baseband Records/GOES/GRB/TestData/cspp-geo-grb-test-data-0.4.6/CADU_6"
12 | #file = "/media/lucas/0E003F18003F05ED1/CADU/CADU_6"
13 | SearchBuffSize = 2048
14 | MaxBuffSize = 16384
15 | ccsdsSync = "\x1A\xCF\xFC\x1D"
16 |
17 | TCP_IP = '127.0.0.1'
18 | TCP_PORT = 5001
19 | FAST_MODE = True # Assume all CADUs are correct, starting with the start of file.
20 |
21 |
22 | def searchInBuff(buff, token):
23 | buff = bytearray(buff)
24 | token = bytearray(token)
25 | if len(buff) > len(token):
26 | for i in range(len(buff) - len(token)):
27 | found = True
28 | for z in range(len(token)):
29 | if buff[i+z] != token[z]:
30 | found = False
31 | break
32 | if found:
33 | return i
34 | return None
35 |
36 | def IsSync(data):
37 | return data[:4] == '\x1A\xCF\xFC\x1D'
38 |
39 | f = open(file, "rb")
40 |
41 | data = ""
42 | frameCount = 0
43 |
44 | time.sleep(1)
45 |
46 | if FAST_MODE:
47 | # Assume Sequential CADUs
48 | while True:
49 | rd = f.read(2048)
50 | if len(rd) < 2048:
51 | break
52 | frameCount+=1
53 | sock.sendto(rd, ('127.0.0.1', 1234))
54 | time.sleep(0.001) # Full Speed
55 | #time.sleep( 0.002)
56 | # time.sleep(0.01)
57 | else:
58 | while True:
59 | rd = f.read(SearchBuffSize)
60 | if len(rd) == 0:
61 | break
62 | data += rd
63 | if not IsSync(data):
64 | print "Searching for Sync Mark"
65 | pos = searchInBuff(data, ccsdsSync)
66 | if pos != None:
67 | print "Found sync at: %s" %pos
68 | print "Buff Len: %s" %len(data)
69 | data = data[pos:]
70 | else:
71 | print "Sync not found, trying one more cycle"
72 | data = data[len(data)-MaxBuffSize:]
73 | continue
74 |
75 | remaining = ""
76 |
77 | if len(data) < 2048:
78 | data += f.read(2048 - len(data))
79 | elif len(data) > 2048:
80 | remaining += data[2048:]
81 | data = data[:2048]
82 | sock.sendto(data, ('127.0.0.1', 1234))
83 | frameCount += 1
84 | data = remaining
85 | time.sleep( 0.001)
86 |
87 | conn.close()
88 | f.close()
--------------------------------------------------------------------------------