final class Bzip2BlockDecompressor
extends java.lang.Object
decodeHuffmanData(Bzip2HuffmanStageDecoder)
decodeHuffmanData(Bzip2HuffmanStageDecoder)
decodeHuffmanData(Bzip2HuffmanStageDecoder)
initialiseInverseBWT()
read()
read()
(through decodeNextBWTByte()
)Modifier and Type | Field and Description |
---|---|
private int |
blockCRC
The CRC of the current block as read from the block header.
|
private boolean |
blockRandomised
true if the current block is randomised, otherwise false . |
private byte[] |
bwtBlock
The Burrows-Wheeler Transform processed data.
|
private int |
bwtBlockLength
The actual length in bytes of the current block at the Inverse Burrows Wheeler Transform
stage (before final Run-Length Decoding).
|
private int[] |
bwtByteCounts
Counts of each byte value within the
huffmanSymbolMap data. |
private int |
bwtBytesDecoded
The number of output bytes that have been decoded up to the Inverse Burrows Wheeler Transform stage.
|
private int |
bwtCurrentMergedPointer
The current merged pointer into the Burrow-Wheeler Transform array.
|
private int[] |
bwtMergedPointers
At each position contains the union of :-
An output character (8 bits)
A pointer from each position to its successor (24 bits, left shifted 8 bits)
As the pointer cannot exceed the maximum block size of 900k, 24 bits is more than enough to
hold it; Folding the character data into the spare bits while performing the inverse BWT,
when both pieces of information are available, saves a large number of memory accesses in
the final decoding stages.
|
private int |
bwtStartPointer
Starting pointer into BWT for after untransform.
|
private Crc32 |
crc
Calculates the block CRC from the fully decoded bytes of the block.
|
(package private) int |
huffmanEndOfBlockSymbol
The end-of-block Huffman symbol.
|
(package private) int |
huffmanInUse16
Bitmap, of ranges of 16 bytes, present/not present.
|
(package private) byte[] |
huffmanSymbolMap
A map from Huffman symbol index to output character.
|
private int |
mtfValue |
private int |
randomCount
If the current block is randomised, the remaining count at the current RNUMS position.
|
private int |
randomIndex
If the current block is randomised, the position within the RNUMS randomisation array.
|
private Bzip2BitReader |
reader
A reader that provides bit-level reads.
|
private int |
repeatCount |
private int |
repeatIncrement |
private int |
rleAccumulator
The number of previous identical output bytes decoded.
|
private int |
rleLastDecodedByte
The most recently RLE decoded byte.
|
private int |
rleRepeat
The RLE repeat count of the current decoded byte.
|
private Bzip2MoveToFrontTable |
symbolMTF
Table for Move To Front transformations.
|
Constructor and Description |
---|
Bzip2BlockDecompressor(int blockSize,
int blockCRC,
boolean blockRandomised,
int bwtStartPointer,
Bzip2BitReader reader) |
Modifier and Type | Method and Description |
---|---|
int |
blockLength() |
(package private) int |
checkCRC()
Verify and return the block CRC.
|
(package private) boolean |
decodeHuffmanData(Bzip2HuffmanStageDecoder huffmanDecoder)
Reads the Huffman encoded data from the input stream, performs Run-Length Decoding and
applies the Move To Front transform to reconstruct the Burrows-Wheeler Transform array.
|
private int |
decodeNextBWTByte()
Decodes a byte from the Burrows-Wheeler Transform stage.
|
private void |
initialiseInverseBWT()
Set up the Inverse Burrows-Wheeler Transform merged pointer array.
|
int |
read()
Decodes a byte from the final Run-Length Encoding stage, pulling a new byte from the
Burrows-Wheeler Transform stage when required.
|
private final Bzip2BitReader reader
private final Crc32 crc
private final int blockCRC
private final boolean blockRandomised
true
if the current block is randomised, otherwise false
.int huffmanEndOfBlockSymbol
int huffmanInUse16
final byte[] huffmanSymbolMap
private final int[] bwtByteCounts
huffmanSymbolMap
data.
Collected at the Move To Front stage, consumed by the Inverse Burrows Wheeler Transform stage.private final byte[] bwtBlock
private final int bwtStartPointer
private int[] bwtMergedPointers
private int bwtCurrentMergedPointer
private int bwtBlockLength
private int bwtBytesDecoded
private int rleLastDecodedByte
private int rleAccumulator
private int rleRepeat
private int randomIndex
private int randomCount
private final Bzip2MoveToFrontTable symbolMTF
private int repeatCount
private int repeatIncrement
private int mtfValue
Bzip2BlockDecompressor(int blockSize, int blockCRC, boolean blockRandomised, int bwtStartPointer, Bzip2BitReader reader)
boolean decodeHuffmanData(Bzip2HuffmanStageDecoder huffmanDecoder)
private void initialiseInverseBWT()
public int read()
private int decodeNextBWTByte()
public int blockLength()
int checkCRC()