UNPKG

@syncfusion/ej2-pdf

Version:

Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.

131 lines (130 loc) 3.16 kB
import { _InBuffer } from './in-buffer'; /** * Implements a Huffman decoding table with fast lookup and tree traversal. * * @private */ export declare class _HuffmanTree { /** * Maximum number of codes in the length/literal tree. * * @private */ static _maxLengthTree: number; /** * Maximum tree depth supported. * * @private */ static _maxDepthTree: number; /** * Number of code length codes. * * @private */ static _nCLength: number; /** * Number of bits used for initial table lookup. * * @private */ _tBits: number; /** * Lookup table for fast Huffman decoding. * * @private */ _table: number[]; /** * Left child indices for the Huffman tree. * * @private */ _left: number[]; /** * Right child indices for the Huffman tree. * * @private */ _right: number[]; /** * Array of code lengths for symbols. * * @private */ _clArray: number[]; /** * Bit mask applied to table lookups. * * @private */ _tMask: number; /** * Loads the code length array and builds the decoding structures. * * @private * @param {number[]} code Code length array. * @returns {void} nothing. */ _load(code: number[]): void; /** * Loads the predefined length or distance tree and builds the decoding structures. * * @private * @param {boolean} isLengthTree Whether the tree is a literal/length tree. * @returns {void} nothing. */ _loadTree(isLengthTree: boolean): void; /** * Initializes table size and bit mask and creates the primary decode table. * * @private * @returns {void} nothing. */ _initialize(): void; /** * Returns the fixed Huffman code lengths for the literal/length alphabet. * * @private * @returns {number[]} lengthTree. */ _getLengthTree(): number[]; /** * Returns the fixed Huffman code lengths for the distance alphabet. * * @private * @returns {number[]} depthTree. */ _getDepthTree(): number[]; /** * Computes canonical Huffman codes for symbols based on code lengths. * * @private * @returns {number[]} canonicalCodes. */ _calculateHashCode(): number[]; /** * Reverses the lowest `length` bits of the given value. * * @private * @param {number} code Code value. * @param {number} length Number of bits to reverse. * @returns {number} reversedCode. */ _bitReverse(code: number, length: number): number; /** * Builds the fast lookup table and associated tree nodes for Huffman decoding. * * @private * @returns {void} nothing. */ _createTable(): void; /** * Decodes and returns the next symbol from the input bit buffer. * * @private * @param {_InBuffer} input Bitwise input buffer. * @returns {number} symbol or -1 if insufficient bits. */ _getNextSymbol(input: _InBuffer): number; }