Exemplo n.º 1
0
        /// <summary>
        /// Decodes Huffman trees from input stream and constructs lookup tables.
        /// </summary>
        /// <param name="group">target POJO</param>
        /// <param name="br">data source</param>
        public static void Decode(HuffmanTreeGroup group, BitReader br)
        {
            int next = 0;
            int n    = group.trees.Length;

            for (int i = 0; i < n; i++)
            {
                group.trees[i] = next;
                CSharpBrotli.Decode.Decode.ReadHuffmanCode(group.alphabetSize, group.codes, next, br);
                next += Huffman.HUFFMAN_MAX_TABLE_SIZE;
            }
        }
Exemplo n.º 2
0
        /// <summary>Decodes Huffman trees from input stream and constructs lookup tables.</summary>
        /// <param name="group">target POJO</param>
        /// <param name="br">data source</param>
        internal static void Decode(HuffmanTreeGroup group, BitReader br)
        {
            int next = 0;
            int n    = group.trees.Length;

            for (int i = 0; i < n; i++)
            {
                group.trees[i] = next;
                BrotliDecode.ReadHuffmanCode(group.alphabetSize, group.codes, next, br);
                next += Huffman.HuffmanMaxTableSize;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes the Huffman tree group.
 /// </summary>
 /// <param name="group">POJO to be initialised</param>
 /// <param name="alphabetSize">the maximal alphabet size in this group</param>
 /// <param name="n">number of Huffman codes</param>
 public static void Init(HuffmanTreeGroup group, int alphabetSize, int n)
 {
     group.alphabetSize = alphabetSize;
     group.codes        = new int[n * Huffman.HUFFMAN_MAX_TABLE_SIZE];
     group.trees        = new int[n];
 }
Exemplo n.º 4
0
 /// <summary>Initializes the Huffman tree group.</summary>
 /// <param name="group">POJO to be initialised</param>
 /// <param name="alphabetSize">the maximal alphabet size in this group</param>
 /// <param name="n">number of Huffman codes</param>
 internal static void Init(HuffmanTreeGroup group, int alphabetSize, int n)
 {
     group.alphabetSize = alphabetSize;
     group.codes        = new int[n * Huffman.HuffmanMaxTableSize];
     group.trees        = new int[n];
 }