Example #1
0
        /// <summary>
        /// HuffCodec
        /// </summary>
        /// <param name="defaultIndex"></param>
        internal HuffCodec(uint defaultIndex)
        {
            HuffBits bits = new HuffBits();

            bits.InitBits(defaultIndex);
            InitHuffTable(bits);
        }
 /// <summary>
 /// InitHuffTable
 /// </summary>
 /// <param name="huffBits"></param>
 private void InitHuffTable(HuffBits huffBits)
 {
     _huffBits = huffBits;
     uint bitSize = _huffBits.GetSize();
     int lowerBound = 1;
     _mins[0] = 0;
     for (uint n = 1; n < bitSize; n++)
     {
         _mins[n] = (uint)lowerBound;
         lowerBound += (1 << (_huffBits.GetBitsAtIndex(n) - 1));
     }
 }
Example #3
0
        /// <summary>
        /// InitHuffTable
        /// </summary>
        /// <param name="huffBits"></param>
        private void InitHuffTable(HuffBits huffBits)
        {
            _huffBits = huffBits;
            uint bitSize    = _huffBits.GetSize();
            int  lowerBound = 1;

            _mins[0] = 0;
            for (uint n = 1; n < bitSize; n++)
            {
                _mins[n]    = (uint)lowerBound;
                lowerBound += (1 << (_huffBits.GetBitsAtIndex(n) - 1));
            }
        }
 /// <summary>
 /// HuffCodec
 /// </summary>
 /// <param name="defaultIndex"></param>
 internal HuffCodec(uint defaultIndex)
 {
     HuffBits bits = new HuffBits();
     bits.InitBits(defaultIndex);
     InitHuffTable(bits);
 }