C# Class DSDecmp.Formats.Nitro.LZ11

Compressor and decompressor for the LZ-0x11 format used in many of the games for the newer Nintendo consoles and handhelds.
Exibir arquivo Open project: Diegoisawesome/AwesomeMapEditor-old Class Usage Examples

Public Methods

Method Description
CompressWithLA ( Stream instream, long inLength, Stream outstream ) : int

Variation of the original compression method, making use of Dynamic Programming to 'look ahead' and determine the optimal 'length' values for the compressed blocks. Is not 100% optimal, as the flag-bytes are not taken into account.

Decompress ( Stream instream, Stream outstream ) : long

Private Methods

Method Description
GetOccurrenceLength ( byte newPtr, int newLength, byte oldPtr, int oldLength, int &disp ) : int

Determine the maximum size of a LZ-compressed block starting at newPtr, using the already compressed data starting at oldPtr. Takes O(inLength * oldLength) = O(n^2) time.

GetOptimalCompressionLengths ( byte indata, int inLength, int &lengths, int &disps ) : void

Gets the optimal compression lengths for each start of a compressed block using Dynamic Programming. This takes O(n^2) time, although in practice it will often be O(n^3) since one of the constants is 0x10110 (the maximum length of a compressed block)

Method Details

CompressWithLA() public static method

Variation of the original compression method, making use of Dynamic Programming to 'look ahead' and determine the optimal 'length' values for the compressed blocks. Is not 100% optimal, as the flag-bytes are not taken into account.
public static CompressWithLA ( Stream instream, long inLength, Stream outstream ) : int
instream Stream
inLength long
outstream Stream
return int

Decompress() public static method

public static Decompress ( Stream instream, Stream outstream ) : long
instream Stream
outstream Stream
return long