Package com.itextpdf.io.codec.brotli.dec
Class Huffman
java.lang.Object
com.itextpdf.io.codec.brotli.dec.Huffman
Utilities for building Huffman decoding tables.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
Maximum possible Huffman table size for an alphabet size of 704, max code length 15 and root table bits 8.private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
buildHuffmanTable
(int[] rootTable, int tableOffset, int rootBits, int[] codeLengths, int codeLengthsSize) Builds Huffman lookup table assuming code lengths are in symbol order.private static int
getNextKey
(int key, int len) Returns reverse(reverse(key, len) + 1, len).private static int
nextTableBitSize
(int[] count, int len, int rootBits) private static void
replicateValue
(int[] table, int offset, int step, int end, int item) Storesitem
intable[0], table[step], table[2 * step] .., table[end]
.
-
Field Details
-
HUFFMAN_MAX_TABLE_SIZE
static final int HUFFMAN_MAX_TABLE_SIZEMaximum possible Huffman table size for an alphabet size of 704, max code length 15 and root table bits 8.- See Also:
-
MAX_LENGTH
private static final int MAX_LENGTH- See Also:
-
-
Constructor Details
-
Huffman
Huffman()
-
-
Method Details
-
getNextKey
private static int getNextKey(int key, int len) Returns reverse(reverse(key, len) + 1, len).reverse(key, len) is the bit-wise reversal of the len least significant bits of key.
-
replicateValue
private static void replicateValue(int[] table, int offset, int step, int end, int item) Storesitem
intable[0], table[step], table[2 * step] .., table[end]
.Assumes that end is an integer multiple of step.
-
nextTableBitSize
private static int nextTableBitSize(int[] count, int len, int rootBits) - Parameters:
count
- histogram of bit lengths for the remaining symbols,len
- code length of the next processed symbol.- Returns:
- table width of the next 2nd level table.
-
buildHuffmanTable
static void buildHuffmanTable(int[] rootTable, int tableOffset, int rootBits, int[] codeLengths, int codeLengthsSize) Builds Huffman lookup table assuming code lengths are in symbol order.
-