Class RANSDecode
java.lang.Object
htsjdk.samtools.cram.compression.rans.RANSDecode
- Direct Known Subclasses:
RANS4x8Decode, RANSNx16Decode
Abstract base class for rANS decoders (both 4x8 and Nx16). Holds the shared decoding
state: per-context frequency tables, reverse-lookup tables, and decoding symbols.
State is allocated once at construction and reused across calls. Between calls, only the rows that were actually used in the previous decode are reset, avoiding the O(65536) full reset that would otherwise be required.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final RANSDecodingSymbol[][]protected final int[][]protected final byte[][]protected final voidmarkRowUsed(int row) Mark a context row as used.protected final voidReset only the decoder rows that were used in the previous decode operation.abstract byte[]uncompress(byte[] input) Uncompress a rANS-encoded byte stream.
-
Constructor Details
-
RANSDecode
protected RANSDecode()
-
-
Method Details
-
getFrequencies
protected final int[][] getFrequencies() -
getReverseLookup
protected final byte[][] getReverseLookup() -
getDecodingSymbols
-
uncompress
public abstract byte[] uncompress(byte[] input) Uncompress a rANS-encoded byte stream.- Parameters:
input- the compressed byte stream (format-specific header + encoded data)- Returns:
- the uncompressed data
-
markRowUsed
protected final void markRowUsed(int row) Mark a context row as used. Called by subclass readFrequencyTable methods when populating a row. Enables selective reset on the nextresetDecoderState()call. -
resetDecoderState
protected final void resetDecoderState()Reset only the decoder rows that were used in the previous decode operation. Called at the start of each uncompress to prepare for new data.
-