Class Huffman
java.lang.Object
org.brotli.dec.Huffman
Utilities for building Huffman decoding tables.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static intbuildHuffmanTable(int[] tableGroup, int tableIdx, int rootBits, int[] codeLengths, int codeLengthsSize) Builds Huffman lookup table assuming code lengths are in symbol order.private static intgetNextKey(int key, int len) Returns reverse(reverse(key, len) + 1, len).private static intnextTableBitSize(int[] count, int len, int rootBits) private static voidreplicateValue(int[] table, int offset, int step, int end, int item) Storesitemintable[0], table[step], table[2 * step] .., table[end].
-
Field Details
-
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) Storesitemintable[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 int buildHuffmanTable(int[] tableGroup, int tableIdx, int rootBits, int[] codeLengths, int codeLengthsSize) Builds Huffman lookup table assuming code lengths are in symbol order.- Returns:
- number of slots used by resulting Huffman table
-