Package libsidutils.cruncher
Klasse PUCrunch
java.lang.Object
libsidutils.cruncher.PUCrunch
-------->
z..zx.....x normal (zz != ee)
e..e value(LEN) value(POSHI+1) 8+b(POSLO) LZ77
e..e 0 (2) 0 (2-256) 8b(POSLO) LZ77
e..e 100 (3) 111111 111111 END of FILE
e..e 101 (4..) 111111 111111 8b(add) 8b(POSLO) DLZ
e..e010 n..ne.....e escape + new esc
e..e011 value(LEN) bytecode Short RLE 2..
e..e011 111..111 8b(LENLO) value(LENHI+1) bytecode Long RLE
(values 64.. not used (may not be available) in bytecode)
e..e011 0 0 RLE=2, rank 1 (saves 11.. bit)
e..e011 0 10 x RLE=2, rank 2-3 (saves 9.. bit)
e..e011 0 11 0xx RLE=2, rank 4-7 (saves 7.. bit)
e..e011 0 11 10xxx RLE=2, rank 8-15 (saves 5.. bit)
e..e011 0 11 110xxxx xxxx RLE=2, not ranked
LZ77, len=2 (pos<=256) saves 4 bits (2-bit escape)
LZ77, len=3 saves 10..1 bits (pos 2..15616)
LZ77, len=4 saves 18..9 bits
LZ77, len=5 saves 24..15 bits
RLE, len=2 saves 11..1(..-5) bits (bytecode rank 1..not ranked)
RLE, len=3 saves 15..2 bits
RLE, len=4 saves 23..10 bits
RLE, len=5 saves 29..16 bits
bs: 3505 LZ reference points, 41535 bytes -> 11.85, i.e. 8.4% referenced
1) Short RLE -> gamma + 1 linear bit -> ivanova.run -29 bytes
2) ?? .. no
esc = RLE, with value 1
e..e01 value(1) n..ne.....e escape + new esc
e..e01 value(LEN) bytecode Short RLE 2..
e..e01 111..111 8b(LENLO) value(LENHI+1) bytecode Long RLE
(values 64.. not used (may not be available) in bytecode)
Value:
Elias Gamma Code rediscovered, just the prefix bits are reversed, plus
there is a length limit (1 bit gained for each value in the last group)
; 0000000 not possible
; 0000001 0 1 -6 bits
; 000001x 10 x 2-3 -4 bits
; 00001xx 110 xx 4-7 -2 bits
; 0001xxx 1110 xxx 8-15 +0 bits
; 001xxxx 11110 xxxx 16-31 +2 bits
; 01xxxxx 111110 xxxxx 32-63 +4 bits
; 1xxxxxx 111111 xxxxxx 64-127 +5 bits
- Autor:
- Ken Händel
-
Verschachtelte Klassen - Übersicht
Verschachtelte Klassen -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprivate int[]private intprivate intprivate static final Decruncher[]private static final intprivate int[]private intprivate intprivate intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate byte[]private intprivate int[]private int[][]private int[]private static final intprivate intprivate static final intprivate int[]private int[]private int[]private int[]private intprivate int[]private int[]private intprivate intprivate intprivate intprivate static final intprivate int[]private byte[]private static final intprivate byte[]private intprivate int[]private static final intprivate int[]private int[]private intprivate byte[]private intprivate intprivate boolean -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprivate DecruncherBestMatch(int type) voidprivate voidprivate intgetSYSAddr(int offset) private voidInitRle(int flags) private voidprivate voidprivate intLenDLz(int lzlen, int lzpos) private intLenLz(int lzlen, int lzpos) private intLenRle(int len, int data) private intOptimizeEscape(PUCrunch.IntContainer startEscape, PUCrunch.IntContainer nonNormal) The algorithm in the OptimizeEscape() works as follows: 1) Only unpacked bytes are processed, they are marked with MMARK.private intOptimizeLength(int optimize) private voidOptimizeRle(int flags) private voidOutputDLz(int esc, int lzlen, int lzpos, int add) private voidOutputEof(int esc) private voidOutputLz(int esc, int lzlen, int lzpos, byte[] data, int dataPos, int curpos) private intOutputNormal(int esc, byte[] data, int dataPos, int newesc) private intOutputRle(int esc, byte[] data, int dataPos, int rlelen) private intPackLz77(int lzsz, int flags, int endAddr, int memEnd, int type) private voidprintCrunchingResult(int stackUsed, int ibufferUsed, int start, int endAddr, int memStart, int overlap, Decruncher dc, byte[] header) private voidprintCrunchInput(String input, int startAddr, int memStart, int execAddr) private voidPutBit(int bit) private voidPutNBits(int b, int bits) private voidPutRleByte(int data) private voidPutValue(int value) private intRealLenValue(int value) private voidSavePack(int type, PrintStream fp, int start, int exec, int escape, int endAddr, int progEnd, boolean enable2MHz, int memStart, int memEnd) voidsetVerbose(boolean verbose)
-
Felddetails
-
FIXF_C64
private static final int FIXF_C64- Siehe auch:
-
FIXF_MACHMASK
private static final int FIXF_MACHMASK- Siehe auch:
-
FIXF_WRAP
private static final int FIXF_WRAP- Siehe auch:
-
FIXF_DLZ
private static final int FIXF_DLZ- Siehe auch:
-
FIXF_BASIC
private static final int FIXF_BASIC- Siehe auch:
-
FIXF_FAST
private static final int FIXF_FAST- Siehe auch:
-
FIXF_SHORT
private static final int FIXF_SHORT- Siehe auch:
-
FIXF_MUSTMASK
private static final int FIXF_MUSTMASK- Siehe auch:
-
DECRUNCHERS
-
F_AUTO
private static final int F_AUTO- Siehe auch:
-
F_NOOPT
private static final int F_NOOPT- Siehe auch:
-
F_AUTOEX
private static final int F_AUTOEX- Siehe auch:
-
F_2MHZ
private static final int F_2MHZ- Siehe auch:
-
LITERAL
private static final int LITERAL- Siehe auch:
-
LZ77
private static final int LZ77- Siehe auch:
-
RLE
private static final int RLE- Siehe auch:
-
DLZ
private static final int DLZ- Siehe auch:
-
MMARK
private static final int MMARK- Siehe auch:
-
F_NORLE
private static final int F_NORLE- Siehe auch:
-
OUT_SIZE
private static final int OUT_SIZE- Siehe auch:
-
maxGamma
private int maxGamma -
reservedBytes
private int reservedBytes -
escBits
private int escBits -
escMask
private int escMask -
extraLZPosBits
private int extraLZPosBits -
rleUsed
private int rleUsed -
memConfig
private int memConfig -
cliConfig
private int cliConfig -
lrange
private int lrange -
maxlzlen
private int maxlzlen -
maxrlelen
private int maxrlelen -
size
private int size -
bitMask
private int bitMask -
timesDLz
private int timesDLz -
inlen
private int inlen -
lzopt
private int lzopt -
outBuffer
private byte[] outBuffer -
indata
private byte[] indata -
newesc
private byte[] newesc -
rleValues
private byte[] rleValues -
lenValue
private int[] lenValue -
rleHist
private int[] rleHist -
rleLen
private int[] rleLen -
lenStat
private int[][] lenStat -
rle
private int[] rle -
elr
private int[] elr -
lzlen
private int[] lzlen -
lzpos
private int[] lzpos -
lzmlen
private int[] lzmlen -
lzmpos
private int[] lzmpos -
lzlen2
private int[] lzlen2 -
lzpos2
private int[] lzpos2 -
mode
private int[] mode -
backSkip
private int[] backSkip -
length
private int[] length -
verbose
private boolean verbose
-
-
Konstruktordetails
-
PUCrunch
public PUCrunch()
-
-
Methodendetails
-
BestMatch
-
SavePack
private void SavePack(int type, PrintStream fp, int start, int exec, int escape, int endAddr, int progEnd, boolean enable2MHz, int memStart, int memEnd) -
FlushBits
private void FlushBits() -
PutBit
private void PutBit(int bit) -
PutValue
private void PutValue(int value) -
RealLenValue
private int RealLenValue(int value) -
initValueLen
private void initValueLen() -
PutNBits
private void PutNBits(int b, int bits) -
OutputNormal
private int OutputNormal(int esc, byte[] data, int dataPos, int newesc) -
OutputEof
private void OutputEof(int esc) -
PutRleByte
private void PutRleByte(int data) -
InitRleLen
private void InitRleLen() -
LenRle
private int LenRle(int len, int data) -
OutputRle
private int OutputRle(int esc, byte[] data, int dataPos, int rlelen) -
LenDLz
private int LenDLz(int lzlen, int lzpos) -
OutputDLz
private void OutputDLz(int esc, int lzlen, int lzpos, int add) -
LenLz
private int LenLz(int lzlen, int lzpos) -
OutputLz
private void OutputLz(int esc, int lzlen, int lzpos, byte[] data, int dataPos, int curpos) -
OptimizeLength
private int OptimizeLength(int optimize) -
OptimizeEscape
The algorithm in the OptimizeEscape() works as follows: 1) Only unpacked bytes are processed, they are marked with MMARK. We proceed from the end to the beginning. Variable A (old/new length) is updated. 2) At each unpacked byte, one and only one possible escape matches. A new escape code must be selected for this case. The optimal selection is the one which provides the shortest number of escapes to the end of the file, i.e. A[esc] = 1+min(A[0], A[1], .. A[states-1]). For other states A[esc] = A[esc]; If we change escape in this byte, the new escape is the one with the smallest value in A. 3) The starting escape is selected from the possibilities and mode 0 is restored to all mode 3 locations. -
InitRle
private void InitRle(int flags) -
OptimizeRle
private void OptimizeRle(int flags) -
PackLz77
private int PackLz77(int lzsz, int flags, int endAddr, int memEnd, int type) -
setVerbose
public void setVerbose(boolean verbose) -
getSYSAddr
private int getSYSAddr(int offset) -
printCrunchInput
-
printCrunchingResult
private void printCrunchingResult(int stackUsed, int ibufferUsed, int start, int endAddr, int memStart, int overlap, Decruncher dc, byte[] header) -
crunch
- Löst aus:
IOException
-