Class RANSEncode<T extends RANSParams>
java.lang.Object
htsjdk.samtools.cram.compression.rans.RANSEncode<T>
- Direct Known Subclasses:
RANS4x8Encode, RANSNx16Encode
Abstract base class for rANS encoders (both 4x8 and Nx16). Holds the shared encoding
symbol matrix and provides helper methods for frequency-to-symbol setup.
The encoding symbol matrix is allocated once at construction and reused across compress calls. Between calls, only the symbols that were actually used are reset.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidbuildSymsOrder0(int[] frequencies) Set up encoding symbols for Order-0 from the given normalized frequency table.protected final voidbuildSymsOrder1(int[][] frequencies) Set up encoding symbols for Order-1 from the given normalized frequency tables.abstract byte[]Compress a byte array using this rANS encoder.protected final RANSEncodingSymbol[][]
-
Constructor Details
-
RANSEncode
protected RANSEncode()
-
-
Method Details
-
getEncodingSymbols
-
compress
Compress a byte array using this rANS encoder.- Parameters:
input- the data to compressparams- encoder-specific parameters (order, flags, etc.)- Returns:
- the compressed byte stream
-
buildSymsOrder0
protected final void buildSymsOrder0(int[] frequencies) Set up encoding symbols for Order-0 from the given normalized frequency table. Only symbols with non-zero frequency are initialized; others are reset to zero. -
buildSymsOrder1
protected final void buildSymsOrder1(int[][] frequencies) Set up encoding symbols for Order-1 from the given normalized frequency tables. Each row corresponds to one context symbol.
-