public DeflaterEngine(DeflaterPending pending) { this.pending = pending; this.huffman = new DeflaterHuffman(pending); this.adler = new Adler32(); this.window = new byte[0x10000]; this.head = new short[0x8000]; this.prev = new short[0x8000]; this.blockStart = this.strstart = 1; }
public void WriteTree(DeflaterHuffman.Tree blTree) { int code = -1; int index = 0; while (index < this.numCodes) { int num; int num2; int num3 = 1; int num6 = this.length[index]; if (num6 == 0) { num = 0x8a; num2 = 3; } else { num = 6; num2 = 3; if (code != num6) { blTree.WriteSymbol(num6); num3 = 0; } } code = num6; index++; while ((index < this.numCodes) && (code == this.length[index])) { index++; if (++num3 >= num) { break; } } if (num3 < num2) { while (num3-- > 0) { blTree.WriteSymbol(code); } } else if (code != 0) { blTree.WriteSymbol(DeflaterHuffman.REP_3_6); this.dh.pending.WriteBits(num3 - 3, 2); } else { if (num3 <= 10) { blTree.WriteSymbol(DeflaterHuffman.REP_3_10); this.dh.pending.WriteBits(num3 - 3, 3); continue; } blTree.WriteSymbol(DeflaterHuffman.REP_11_138); this.dh.pending.WriteBits(num3 - 11, 7); } } }
public void CalcBLFreq(DeflaterHuffman.Tree blTree) { int num4 = -1; int index = 0; while (index < this.numCodes) { int num; int num2; int num3 = 1; int num6 = this.length[index]; if (num6 == 0) { num = 0x8a; num2 = 3; } else { num = 6; num2 = 3; if (num4 != num6) { short[] numArray; IntPtr ptr; (numArray = blTree.freqs)[(int) (ptr = (IntPtr) num6)] = (short) (numArray[(int) ptr] + 1); num3 = 0; } } num4 = num6; index++; while ((index < this.numCodes) && (num4 == this.length[index])) { index++; if (++num3 >= num) { break; } } if (num3 < num2) { short[] numArray2; IntPtr ptr2; (numArray2 = blTree.freqs)[(int) (ptr2 = (IntPtr) num4)] = (short) (numArray2[(int) ptr2] + ((short) num3)); } else { short[] numArray5; IntPtr ptr5; if (num4 != 0) { short[] numArray3; IntPtr ptr3; (numArray3 = blTree.freqs)[(int) (ptr3 = (IntPtr) DeflaterHuffman.REP_3_6)] = (short) (numArray3[(int) ptr3] + 1); continue; } if (num3 <= 10) { short[] numArray4; IntPtr ptr4; (numArray4 = blTree.freqs)[(int) (ptr4 = (IntPtr) DeflaterHuffman.REP_3_10)] = (short) (numArray4[(int) ptr4] + 1); continue; } (numArray5 = blTree.freqs)[(int) (ptr5 = (IntPtr) DeflaterHuffman.REP_11_138)] = (short) (numArray5[(int) ptr5] + 1); } } }
public Tree(DeflaterHuffman dh, int elems, int minCodes, int maxLength) { this.dh = dh; this.minNumCodes = minCodes; this.maxLength = maxLength; this.freqs = new short[elems]; this.bl_counts = new int[maxLength]; }