Top Description Fields Constructors Methods
org.brotli.dec

pack-priv final Class Huffman

extends Object
Class Inheritance

Utilities for building Huffman decoding tables.

Field Summary

Modifier and TypeField and Description
pack-priv static final int
HUFFMAN_MAX_TABLE_SIZE

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

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv 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

Returns:

table width of the next 2nd level table.
nextTableBitSize
(int[]
histogram of bit lengths for the remaining symbols,
count
,
int
code length of the next processed symbol.
len
,
int rootBits)

private static void
replicateValue(int[] table, int offset, int step, int end, int item)

Stores item in table[0], table[step], table[2 * step] .., table[end].

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HUFFMAN_MAX_TABLE_SIZEback to summary
pack-priv static final int HUFFMAN_MAX_TABLE_SIZE

Maximum possible Huffman table size for an alphabet size of 704, max code length 15 and root table bits 8.

MAX_LENGTHback to summary
private static final int MAX_LENGTH

Constructor Detail

Huffmanback to summary
pack-priv Huffman()

Method Detail

buildHuffmanTableback to summary
pack-priv static void buildHuffmanTable(int[] rootTable, int tableOffset, int rootBits, int[] codeLengths, int codeLengthsSize)

Builds Huffman lookup table assuming code lengths are in symbol order.

getNextKeyback to summary
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.

nextTableBitSizeback to summary
private static int nextTableBitSize(int[] count, int len, int rootBits)
Parameters
count:int[]

histogram of bit lengths for the remaining symbols,

len:int

code length of the next processed symbol.

Returns:int

table width of the next 2nd level table.

replicateValueback to summary
private static void replicateValue(int[] table, int offset, int step, int end, int item)

Stores item in table[0], table[step], table[2 * step] .., table[end].

Assumes that end is an integer multiple of step.