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 CalcBLFreq(DeflaterHuffman.Tree blTree) { int index = -1; int num5 = 0; while (num5 < this.numCodes) { int num; int num2; int num3 = 1; int num6 = this.length[num5]; if (num6 == 0) { num = 0x8a; num2 = 3; } else { num = 6; num2 = 3; if (index != num6) { blTree.freqs[num6] = (short) (blTree.freqs[num6] + 1); num3 = 0; } } index = num6; num5++; while ((num5 < this.numCodes) && (index == this.length[num5])) { num5++; if (++num3 >= num) { break; } } if (num3 < num2) { blTree.freqs[index] = (short) (blTree.freqs[index] + ((short) num3)); } else if (index != 0) { blTree.freqs[0x10] = (short) (blTree.freqs[0x10] + 1); } else if (num3 <= 10) { blTree.freqs[0x11] = (short) (blTree.freqs[0x11] + 1); } else { blTree.freqs[0x12] = (short) (blTree.freqs[0x12] + 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(0x10); this.dh.pending.WriteBits(num3 - 3, 2); } else if (num3 <= 10) { blTree.WriteSymbol(0x11); this.dh.pending.WriteBits(num3 - 3, 3); } else { blTree.WriteSymbol(0x12); this.dh.pending.WriteBits(num3 - 11, 7); } } }
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]; }