createHuffmanDecodingTables() — netty Function Reference
Architecture documentation for the createHuffmanDecodingTables() function in Bzip2HuffmanStageDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 1f145f57_0ee1_c514_d995_5c5721dc2790["createHuffmanDecodingTables()"] 14c72e79_23d2_4aa5_16ea_6018c1df750a["Bzip2HuffmanStageDecoder"] 1f145f57_0ee1_c514_d995_5c5721dc2790 -->|defined in| 14c72e79_23d2_4aa5_16ea_6018c1df750a style 1f145f57_0ee1_c514_d995_5c5721dc2790 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageDecoder.java lines 117–167
void createHuffmanDecodingTables() {
final int alphabetSize = this.alphabetSize;
for (int table = 0; table < tableCodeLengths.length; table++) {
final int[] tableBases = codeBases[table];
final int[] tableLimits = codeLimits[table];
final int[] tableSymbols = codeSymbols[table];
final byte[] codeLengths = tableCodeLengths[table];
int minimumLength = HUFFMAN_DECODE_MAX_CODE_LENGTH;
int maximumLength = 0;
// Find the minimum and maximum code length for the table
for (int i = 0; i < alphabetSize; i++) {
final byte currLength = codeLengths[i];
maximumLength = Math.max(currLength, maximumLength);
minimumLength = Math.min(currLength, minimumLength);
}
minimumLengths[table] = minimumLength;
// Calculate the first output symbol for each code length
for (int i = 0; i < alphabetSize; i++) {
tableBases[codeLengths[i] + 1]++;
}
for (int i = 1, b = tableBases[0]; i < HUFFMAN_DECODE_MAX_CODE_LENGTH + 2; i++) {
b += tableBases[i];
tableBases[i] = b;
}
// Calculate the first and last Huffman code for each code length (codes at a given
// length are sequential in value)
for (int i = minimumLength, code = 0; i <= maximumLength; i++) {
int base = code;
code += tableBases[i + 1] - tableBases[i];
tableBases[i] = base - tableBases[i];
tableLimits[i] = code - 1;
code <<= 1;
}
// Populate the mapping from canonical code index to output symbol
for (int bitLength = minimumLength, codeIndex = 0; bitLength <= maximumLength; bitLength++) {
for (int symbol = 0; symbol < alphabetSize; symbol++) {
if (codeLengths[symbol] == bitLength) {
tableSymbols[codeIndex++] = symbol;
}
}
}
}
currentTable = selectors[0];
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does createHuffmanDecodingTables() do?
createHuffmanDecodingTables() is a function in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageDecoder.java.
Where is createHuffmanDecodingTables() defined?
createHuffmanDecodingTables() is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageDecoder.java at line 117.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free