internal bool _tr_tally(int dist, int lc) { this.pending[this._distanceOffset + (this.last_lit * 2)] = (byte)(dist >> 8); this.pending[(this._distanceOffset + (this.last_lit * 2)) + 1] = (byte)dist; this.pending[this._lengthOffset + this.last_lit] = (byte)lc; this.last_lit++; if (dist == 0) { this.dyn_ltree[lc * 2] = (short)(this.dyn_ltree[lc * 2] + 1); } else { this.matches++; dist--; this.dyn_ltree[((ZTree.LengthCode[lc] + InternalConstants.LITERALS) + 1) * 2] = (short)(this.dyn_ltree[((ZTree.LengthCode[lc] + InternalConstants.LITERALS) + 1) * 2] + 1); this.dyn_dtree[ZTree.DistanceCode(dist) * 2] = (short)(this.dyn_dtree[ZTree.DistanceCode(dist) * 2] + 1); } if (((this.last_lit & 0x1fff) == 0) && (this.compressionLevel > CompressionLevel.Level2)) { int num = this.last_lit << 3; int num2 = this.strstart - this.block_start; for (int i = 0; i < InternalConstants.D_CODES; i++) { num += (int)(this.dyn_dtree[i * 2] * (5L + ZTree.ExtraDistanceBits[i])); } num = num >> 3; if ((this.matches < (this.last_lit / 2)) && (num < (num2 / 2))) { return(true); } } return((this.last_lit == (this.lit_bufsize - 1)) || (this.last_lit == this.lit_bufsize)); }
internal void send_compressed_block(short[] ltree, short[] dtree) { int num = 0; if (this.last_lit != 0) { do { int num2 = this._distanceOffset + num * 2; int num3 = ((int)this.pending[num2] << 8 & 65280) | (int)(this.pending[num2 + 1] & 255); int num4 = (int)(this.pending[this._lengthOffset + num] & 255); num++; if (num3 == 0) { this.send_code(num4, ltree); } else { int num5 = (int)ZTree.LengthCode[num4]; this.send_code(num5 + InternalConstants.LITERALS + 1, ltree); int num6 = ZTree.ExtraLengthBits[num5]; if (num6 != 0) { num4 -= ZTree.LengthBase[num5]; this.send_bits(num4, num6); } num3--; num5 = ZTree.DistanceCode(num3); this.send_code(num5, dtree); num6 = ZTree.ExtraDistanceBits[num5]; if (num6 != 0) { num3 -= ZTree.DistanceBase[num5]; this.send_bits(num3, num6); } } }while (num < this.last_lit); } this.send_code(DeflateManager.END_BLOCK, ltree); this.last_eob_len = (int)ltree[DeflateManager.END_BLOCK * 2 + 1]; }
internal void send_compressed_block(short[] ltree, short[] dtree) { int num3 = 0; if (this.last_lit != 0) { do { int index = this._distanceOffset + (num3 * 2); int dist = ((this.pending[index] << 8) & 0xff00) | (this.pending[index + 1] & 0xff); int c = this.pending[this._lengthOffset + num3] & 0xff; num3++; if (dist == 0) { this.send_code(c, ltree); } else { int num4 = ZTree.LengthCode[c]; this.send_code((num4 + InternalConstants.LITERALS) + 1, ltree); int length = ZTree.ExtraLengthBits[num4]; if (length != 0) { c -= ZTree.LengthBase[num4]; this.send_bits(c, length); } dist--; num4 = ZTree.DistanceCode(dist); this.send_code(num4, dtree); length = ZTree.ExtraDistanceBits[num4]; if (length != 0) { dist -= ZTree.DistanceBase[num4]; this.send_bits(dist, length); } } }while (num3 < this.last_lit); } this.send_code(END_BLOCK, ltree); this.last_eob_len = ltree[(END_BLOCK * 2) + 1]; }
internal bool _tr_tally(int dist, int lc) { this.pending[this._distanceOffset + this.last_lit * 2] = (byte)((uint)dist >> 8); this.pending[this._distanceOffset + this.last_lit * 2 + 1] = (byte)dist; this.pending[this._lengthOffset + this.last_lit] = (byte)lc; this.last_lit++; if (dist == 0) { short[] expr_6C_cp_0 = this.dyn_ltree; int expr_6C_cp_1 = lc * 2; expr_6C_cp_0[expr_6C_cp_1] += 1; } else { this.matches++; dist--; short[] expr_A7_cp_0 = this.dyn_ltree; int expr_A7_cp_1 = ((int)ZTree.LengthCode[lc] + InternalConstants.LITERALS + 1) * 2; expr_A7_cp_0[expr_A7_cp_1] += 1; short[] expr_C0_cp_0 = this.dyn_dtree; int expr_C0_cp_1 = ZTree.DistanceCode(dist) * 2; expr_C0_cp_0[expr_C0_cp_1] += 1; } if ((this.last_lit & 8191) == 0 && this.compressionLevel > CompressionLevel.Level2) { int num = this.last_lit << 3; int num2 = this.strstart - this.block_start; for (int i = 0; i < InternalConstants.D_CODES; i++) { num = (int)((long)num + (long)this.dyn_dtree[i * 2] * (5L + (long)ZTree.ExtraDistanceBits[i])); } num >>= 3; if (this.matches < this.last_lit / 2 && num < num2 / 2) { return(true); } } return(this.last_lit == this.lit_bufsize - 1 || this.last_lit == this.lit_bufsize); }