private readonly int _maxBitLength; // maximum length in bits of a code /// <summary> /// Initializes a new instance of the <see cref="DeflateTree"/> class. /// Literal Tree MinCodes = 257, MaxCodes = 286, MaxBitLength = 15 /// Distance Tree MinCodes = 2, MaxCodes = 30, MaxBitLength = 15 /// Bit Length Tree MinCodes = 4, MaxCodes = 19, MaxBitLength = 7 /// </summary> /// <param name="writeBits">The write bits.</param> /// <param name="minCodes">The minimum codes.</param> /// <param name="maxCodes">The maximum codes.</param> /// <param name="maxBitLength">Maximum length of the bit.</param> public DeflateTree(WriteBits writeBits, int minCodes, int maxCodes, int maxBitLength) { // write bits method _writeBits = writeBits; // save minimum codes, maximum codes, and maximum bit length _minCodes = minCodes; _maxCodes = maxCodes; _maxBitLength = maxBitLength; // allocate arrays CodeFreq = new int[maxCodes]; _saveCodeLength = new byte[maxCodes]; _saveCodes = new ushort[maxCodes]; _freqTree = new FreqNode[2 * maxCodes - 1]; _bitLengthFreq = new int[maxBitLength]; _firstCode = new int[maxBitLength]; // clear arrays Reset(); }
private Int32 MaxBitLength; // maximum length in bits of a code //////////////////////////////////////////////////////////////////// // Constructor //////////////////////////////////////////////////////////////////// // Literal Tree MinCodes = 257, MaxCodes = 286, MaxBitLength = 15 // Distance Tree MinCodes = 2, MaxCodes = 30, MaxBitLength = 15 // Bit Length Tree MinCodes = 4, MaxCodes = 19, MaxBitLength = 7 public DeflateTree(WriteBits WriteBits, Int32 MinCodes, Int32 MaxCodes, Int32 MaxBitLength) { // write bits method this.WriteBits = WriteBits; // save minimum codes, maximum codes, and maximum bit length this.MinCodes = MinCodes; this.MaxCodes = MaxCodes; this.MaxBitLength = MaxBitLength; // allocate arrays CodeFreq = new Int32[MaxCodes]; SaveCodeLength = new Byte[MaxCodes]; SaveCodes = new UInt16[MaxCodes]; FreqTree = new FreqNode[2 * MaxCodes - 1]; BitLengthFreq = new Int32[MaxBitLength]; FirstCode = new Int32[MaxBitLength]; // clear arrays Reset(); return; }