Home / Function/ decodeHuffmanData() — netty Function Reference

decodeHuffmanData() — netty Function Reference

Architecture documentation for the decodeHuffmanData() function in Bzip2BlockDecompressor.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5a74d419_86a2_df2c_f8a8_4431b8d8f002["decodeHuffmanData()"]
  5e864d32_96fc_3bee_77e4_3eeb1e9d6e8d["Bzip2BlockDecompressor"]
  5a74d419_86a2_df2c_f8a8_4431b8d8f002 -->|defined in| 5e864d32_96fc_3bee_77e4_3eeb1e9d6e8d
  53f222c8_eda8_7c97_2c97_0b36e2249292["initialiseInverseBWT()"]
  5a74d419_86a2_df2c_f8a8_4431b8d8f002 -->|calls| 53f222c8_eda8_7c97_2c97_0b36e2249292
  style 5a74d419_86a2_df2c_f8a8_4431b8d8f002 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2BlockDecompressor.java lines 174–242

    boolean decodeHuffmanData(final Bzip2HuffmanStageDecoder huffmanDecoder) {
        final Bzip2BitReader reader = this.reader;
        final byte[] bwtBlock = this.bwtBlock;
        final byte[] huffmanSymbolMap = this.huffmanSymbolMap;
        final int streamBlockSize = this.bwtBlock.length;
        final int huffmanEndOfBlockSymbol = this.huffmanEndOfBlockSymbol;
        final int[] bwtByteCounts = this.bwtByteCounts;
        final Bzip2MoveToFrontTable symbolMTF = this.symbolMTF;

        int bwtBlockLength = this.bwtBlockLength;
        int repeatCount = this.repeatCount;
        int repeatIncrement = this.repeatIncrement;
        int mtfValue = this.mtfValue;

        for (;;) {
            if (!reader.hasReadableBits(HUFFMAN_DECODE_MAX_CODE_LENGTH)) {
                this.bwtBlockLength = bwtBlockLength;
                this.repeatCount = repeatCount;
                this.repeatIncrement = repeatIncrement;
                this.mtfValue = mtfValue;
                return false;
            }
            final int nextSymbol = huffmanDecoder.nextSymbol();

            if (nextSymbol == HUFFMAN_SYMBOL_RUNA) {
                repeatCount += repeatIncrement;
                repeatIncrement <<= 1;
            } else if (nextSymbol == HUFFMAN_SYMBOL_RUNB) {
                repeatCount += repeatIncrement << 1;
                repeatIncrement <<= 1;
            } else {
                if (repeatCount > 0) {
                    if (bwtBlockLength + repeatCount > streamBlockSize) {
                        throw new DecompressionException("block exceeds declared block size");
                    }
                    final byte nextByte = huffmanSymbolMap[mtfValue];
                    bwtByteCounts[nextByte & 0xff] += repeatCount;
                    while (--repeatCount >= 0) {
                        bwtBlock[bwtBlockLength++] = nextByte;
                    }

                    repeatCount = 0;
                    repeatIncrement = 1;
                }

                if (nextSymbol == huffmanEndOfBlockSymbol) {
                    break;
                }

                if (bwtBlockLength >= streamBlockSize) {
                    throw new DecompressionException("block exceeds declared block size");
                }

                mtfValue = symbolMTF.indexToFront(nextSymbol - 1) & 0xff;

                final byte nextByte = huffmanSymbolMap[mtfValue];
                bwtByteCounts[nextByte & 0xff]++;
                bwtBlock[bwtBlockLength++] = nextByte;
            }
        }
        if (bwtBlockLength > MAX_BLOCK_LENGTH) {
            throw new DecompressionException("block length exceeds max block length: "
                    + bwtBlockLength + " > " + MAX_BLOCK_LENGTH);
        }

        this.bwtBlockLength = bwtBlockLength;
        initialiseInverseBWT();
        return true;
    }

Domain

Subdomains

Frequently Asked Questions

What does decodeHuffmanData() do?
decodeHuffmanData() is a function in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2BlockDecompressor.java.
Where is decodeHuffmanData() defined?
decodeHuffmanData() is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2BlockDecompressor.java at line 174.
What does decodeHuffmanData() call?
decodeHuffmanData() calls 1 function(s): initialiseInverseBWT.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free