public BigHuffmanTree(BitStream bs, int allocSize)
{
_bs = bs;
uint bit = _bs.GetBit();
if (bit == 0)
{
_tree = new uint[1];
_tree[0] = 0;
_last[0] = _last[1] = _last[2] = 0;
return;
}
for (uint i = 0; i < 256; ++i)
_prefixtree[i] = _prefixlength[i] = 0;
_loBytes = new SmallHuffmanTree(_bs);
_hiBytes = new SmallHuffmanTree(_bs);
_markers[0] = _bs.GetBits(16);
_markers[1] = _bs.GetBits(16);
_markers[2] = _bs.GetBits(16);
_last[0] = _last[1] = _last[2] = 0xffffffff;
_treeSize = 0;
_tree = new uint[allocSize / 4];
DecodeTree(0, 0);
bit = _bs.GetBit();
Debug.Assert(bit == 0);
for (uint i = 0; i < 3; ++i)
{
if (_last[i] == 0xffffffff)
{
_last[i] = _treeSize;
_tree[_treeSize++] = 0;
}
}
}