Home / Function/ allocateHuffmanCodeLengths() — netty Function Reference

allocateHuffmanCodeLengths() — netty Function Reference

Architecture documentation for the allocateHuffmanCodeLengths() function in Bzip2HuffmanAllocator.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  2de6ad84_ece2_e1f6_0d2d_5992144ef04b["allocateHuffmanCodeLengths()"]
  3ede8457_e9d7_5e55_8fd7_02b725a73605["Bzip2HuffmanAllocator"]
  2de6ad84_ece2_e1f6_0d2d_5992144ef04b -->|defined in| 3ede8457_e9d7_5e55_8fd7_02b725a73605
  21a7e6f4_2182_ef35_16b7_26d7774b9f85["setExtendedParentPointers()"]
  2de6ad84_ece2_e1f6_0d2d_5992144ef04b -->|calls| 21a7e6f4_2182_ef35_16b7_26d7774b9f85
  536a1061_cf34_c364_3957_752998cccfb4["findNodesToRelocate()"]
  2de6ad84_ece2_e1f6_0d2d_5992144ef04b -->|calls| 536a1061_cf34_c364_3957_752998cccfb4
  a7f0d7e8_8c26_ba76_56bf_1426cfcf43d0["allocateNodeLengths()"]
  2de6ad84_ece2_e1f6_0d2d_5992144ef04b -->|calls| a7f0d7e8_8c26_ba76_56bf_1426cfcf43d0
  313bded7_9d4e_2a33_2056_0b95ca399438["allocateNodeLengthsWithRelocation()"]
  2de6ad84_ece2_e1f6_0d2d_5992144ef04b -->|calls| 313bded7_9d4e_2a33_2056_0b95ca399438
  style 2de6ad84_ece2_e1f6_0d2d_5992144ef04b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java lines 158–181

    static void allocateHuffmanCodeLengths(final int[] array, final int maximumLength) {
        switch (array.length) {
            case 2:
                array[1] = 1;
                // fall through
            case 1:
                array[0] = 1;
                return;
        }

        /* Pass 1 : Set extended parent pointers */
        setExtendedParentPointers(array);

        /* Pass 2 : Find number of nodes to relocate in order to achieve maximum code length */
        int nodesToRelocate = findNodesToRelocate(array, maximumLength);

        /* Pass 3 : Generate code lengths */
        if (array[0] % array.length >= nodesToRelocate) {
            allocateNodeLengths(array);
        } else {
            int insertDepth = maximumLength - (32 - Integer.numberOfLeadingZeros(nodesToRelocate - 1));
            allocateNodeLengthsWithRelocation(array, nodesToRelocate, insertDepth);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does allocateHuffmanCodeLengths() do?
allocateHuffmanCodeLengths() is a function in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java.
Where is allocateHuffmanCodeLengths() defined?
allocateHuffmanCodeLengths() is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java at line 158.
What does allocateHuffmanCodeLengths() call?
allocateHuffmanCodeLengths() calls 4 function(s): allocateNodeLengths, allocateNodeLengthsWithRelocation, findNodesToRelocate, setExtendedParentPointers.

Analyze Your Own Codebase

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

Try Supermodel Free