-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from opensatelliteproject/libdecompress
Libdecompress
- Loading branch information
Showing
7 changed files
with
148 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace OpenSatelliteProject.Tools { | ||
/// <summary> | ||
/// libaec Wrapper Class | ||
/// | ||
/// Used for decompressing LRIT Rice | ||
/// </summary> | ||
public static class AEC { | ||
public static readonly int ALLOW_K13_OPTION_MASK = 1; | ||
public static readonly int CHIP_OPTION_MASK = 2; | ||
public static readonly int EC_OPTION_MASK = 4; | ||
public static readonly int LSB_OPTION_MASK = 8; | ||
public static readonly int MSB_OPTION_MASK = 16; | ||
public static readonly int NN_OPTION_MASK = 32; | ||
public static readonly int RAW_OPTION_MASK = 128; | ||
|
||
[DllImport("satdecompress", CallingConvention = CallingConvention.Cdecl)] | ||
public static unsafe extern int Decompress(byte *input, byte *output, uint inputLength, uint outputLength, int bitsPerPixel, int pixelsPerBlock, int pixelsPerScanline, int mask); | ||
|
||
public static int LritRiceDecompress(ref byte[] dest, byte[] source, int bitsPerPixel, int pixelsPerBlock, int pixelsPerScanline, int mask) { | ||
int status = -100; | ||
unsafe { | ||
fixed (byte* destPtr = dest) { | ||
fixed (byte *srcPtr = source) { | ||
status = Decompress(srcPtr, destPtr, (uint) source.Length, (uint) dest.Length, bitsPerPixel, pixelsPerBlock, pixelsPerScanline, mask); | ||
} | ||
} | ||
} | ||
|
||
if (status <= 0) { | ||
throw new AECException((AECStatus)status); | ||
} | ||
|
||
return status; | ||
} | ||
} | ||
|
||
public class AECException: Exception { | ||
public AECStatus status; | ||
|
||
public AECException(AECStatus error) { | ||
this.status = error; | ||
} | ||
} | ||
|
||
public enum AECStatus { | ||
INTERNAL_ERROR = -100, | ||
MEMORY_ERROR = -4, | ||
DATA_ERROR = -3, | ||
STREAM_ERROR = -2, | ||
CONFIG_ERROR = -1, | ||
OK = 0, | ||
OUTPUT_BUFFER_FULL = 2, | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
<Properties StartupItem="goesdump/GOES Dumper.csproj" RefactoringSettings.EnableRefactorings="True"> | ||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" /> | ||
<MonoDevelop.Ide.Workbench ActiveDocument="XRIT/Tools/TextHandler.cs"> | ||
<MonoDevelop.Ide.Workbench ActiveDocument="XRIT/Tools/AEC.cs"> | ||
<Files> | ||
<File FileName="XRITLibraryTest/Program.cs" Line="1" Column="1" /> | ||
<File FileName="XRIT/Tools/ImageHandler.cs" Line="11" Column="31" /> | ||
<File FileName="XRITLibraryTest/MainWindow.cs" Line="16" Column="124" /> | ||
<File FileName="XRIT/Tools/LLTools.cs" Line="5" Column="37" /> | ||
<File FileName="goesdump/GoesDecoder/FileHandler.cs" Line="37" Column="9" /> | ||
<File FileName="goesdump/GoesDecoder/Connector.cs" Line="211" Column="1" /> | ||
<File FileName="goesdump/GoesDecoder/PacketManager.cs" Line="168" Column="13" /> | ||
<File FileName="goesdump/ChannelDecoder/DemuxManager.cs" Line="1" Column="1" /> | ||
<File FileName="goesdump/ChannelDecoder/Demuxer.cs" Line="109" Column="23" /> | ||
<File FileName="XRIT/Tools/TextHandler.cs" Line="3" Column="38" /> | ||
<File FileName="XRIT/Tools/AEC.cs" Line="28" Column="39" /> | ||
<File FileName="XRITLibraryTest/MainWindow.cs" Line="28" Column="16" /> | ||
<File FileName="goesdump/ChannelDecoder/Demuxer.cs" Line="137" Column="73" /> | ||
<File FileName="goesdump/GoesDecoder/PacketManager.cs" Line="291" Column="156" /> | ||
</Files> | ||
</MonoDevelop.Ide.Workbench> | ||
<MonoDevelop.Ide.DebuggingService.Breakpoints> | ||
<BreakpointStore /> | ||
</MonoDevelop.Ide.DebuggingService.Breakpoints> | ||
<MonoDevelop.Ide.DebuggingService.PinnedWatches /> | ||
<MonoDevelop.Ide.DebuggingService.PinnedWatches> | ||
<Watch file="XRIT/Tools/AEC.cs" line="32" offsetX="528" offsetY="496" expression="param" liveUpdate="False" /> | ||
</MonoDevelop.Ide.DebuggingService.PinnedWatches> | ||
</Properties> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters